summaryrefslogtreecommitdiff
path: root/Fiber_Optics_and_Optoelectronics_by_R._P._Khare/Chapter6.ipynb
blob: 042791dbe4182528668f4f8ba38cd7d42f0439b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter6 - Optical fiber cables and connections"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6.1 : Page 119"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "refractive index = 1.59\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#refractive index\n",
    "l=0.47##in db\n",
    "nf=10**((l/-10))##\n",
    "from sympy import symbols, solve\n",
    "x=symbols(\"x\")\n",
    "p=1+-2.22*x+x**2##\n",
    "y=solve(p,x)##\n",
    "print \"refractive index = %0.2F\"%y[1]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6.2 : Page 121"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "insertion loss at the joint = 0.64 dB\n",
      "part (b)\n",
      "insertion loss at the joint = 0.286 dB\n"
     ]
    }
   ],
   "source": [
    "from math import log10, acos, pi\n",
    "#loss\n",
    "print \"part (a)\"\n",
    "dya=0.1##\n",
    "n1=1.50##refrative index\n",
    "na=1##\n",
    "k1=n1/n1##\n",
    "k2=1##\n",
    "nf=((16*(n1)**2)/((n1+1)**4))##\n",
    "nlat=(2/(3.14))*(acos(dya/2)-(dya/2)*(1-(dya/2)**2)**(1/2))##\n",
    "nt=nf*nlat##\n",
    "lt=(-10*log10(nt))##in dB\n",
    "print \"insertion loss at the joint = %0.2f dB\"%lt\n",
    "print \"part (b)\"\n",
    "dya=0.1##\n",
    "n1=1.50##refrative index\n",
    "na=1##\n",
    "k1=n1/n1##\n",
    "k2=1##\n",
    "nf=((16*(n1)**2)/((n1+1)**4))##\n",
    "nlat=(2/(pi))*(acos(dya/2)-(dya/2)*(1-(dya/2)**2)**(1/2))#\n",
    "nt=k2*nlat##\n",
    "lt=(-10*log10(nt))##in dB\n",
    "print \"insertion loss at the joint = %0.3f dB\"%lt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6.3 : Page 122"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total loss = 0.75 dB\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "#loss\n",
    "d=100##micro meter\n",
    "dx=0##\n",
    "dy=3##in micro mete\n",
    "dth=3##in degree\n",
    "dthr=dth*(pi/180)##\n",
    "dya=0.02##\n",
    "n1=1.48##refrative index\n",
    "na=1##\n",
    "k1=n1/n1##\n",
    "k2=1##\n",
    "nf=((16*(n1)**2)/((n1+1)**4))##\n",
    "nlat=(2/(pi))*(acos(dy/100)-(dy/100)*(1-(dy/100)**2)**(1/2))##\n",
    "NA=n1*(sqrt(2*dya))##\n",
    "nang=((1-(na*dthr)/(pi*NA)))##\n",
    "nt=nf*nlat*nang##\n",
    "lt=(-10*log10(nt))##in dB\n",
    "print \"total loss = %0.2f dB\"%lt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6.4 : Page 124"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total loss = 4.1260 dB\n"
     ]
    }
   ],
   "source": [
    "from scipy import log10\n",
    "#loss\n",
    "d1=80##micro meter\n",
    "na1=0.25##\n",
    "alpha1=2##\n",
    "d2=60##in micro meter\n",
    "na2=0.21##\n",
    "alpha2=1.9##\n",
    "ncd=(d2/d1)**2##\n",
    "nna=(na2/na1)**2##\n",
    "nalpha=((1+(2/alpha1))/(1+((2/alpha2))))##\n",
    "nt=ncd*nna*nalpha##\n",
    "lt=(-10*log10(nt))##in dB\n",
    "print \"total loss = %0.4f dB\"%lt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6.5 : Page 125"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total loss forward direction = 3.52 dB\n",
      "total loss backward direction = 0.217 dB\n"
     ]
    }
   ],
   "source": [
    "#loss\n",
    "d1=60##micro meter\n",
    "na1=0.25##\n",
    "alpha1=2.1##\n",
    "d2=50##in micro meter\n",
    "na2=0.20##\n",
    "alpha2=1.9##\n",
    "ncd=(d2/d1)**2##\n",
    "nna=(na2/na1)**2##\n",
    "nalpha1=1##\n",
    "nalpha=((1+(2/alpha1))/(1+((2/alpha2))))##\n",
    "ncd1=1##\n",
    "nna1=1##\n",
    "nt=ncd*nna*nalpha1##\n",
    "ltf=(-10*log10(nt))##in dB\n",
    "nt1=ncd1*nna1*nalpha##\n",
    "ltb=(-10*log10(nt1))##in dB\n",
    "print \"total loss forward direction = %0.2f dB\"%ltf\n",
    "print \"total loss backward direction = %0.3f dB\"%ltb"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}