summaryrefslogtreecommitdiff
path: root/sample_notebooks/Mohdarif/Chapter2.ipynb
blob: 588b4703ba7281d31f5f0ce9e90fa1c273b3f13f (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:682987e4618d85f3223ce09c9f676959c97dc81b85e6ff92270d30168f8d3c6a"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2 - Optical Fibers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 2.4.1 - p:2-10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "n1=1.46  #refractive index\n",
      "d=0.01  #difference\n",
      "na=n1*(2*d)**(1.0/2) #numerical aperture\n",
      "x=1-d  #\n",
      "oc=math.asin(x)  #in radian\n",
      "oc*=180/math.pi # in degree\n",
      "print \"Numerical Aperture is \",round(na,2)\n",
      "print \"Critical angle at core cladding interface is \",round(oc,1),\" degree.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Numerical Aperture is  0.21\n",
        "Critical angle at core cladding interface is  81.9  degree.\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.5.1 - p:2-11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "n2=1.45  #core refrative index\n",
      "n1=1.49  #cladding refrative index\n",
      "oc=math.asin(n2/n1)  #in radian\n",
      "oc*=180/math.pi # in degree\n",
      "na=(n1**2-n2**2)**(1.0/2)  #numerical aperture\n",
      "pc=math.asin(na)  # in radian\n",
      "pc*=180/math.pi # in degree\n",
      "print oc,\"Critical angle is \",round(oc,2),\" degree.\"\n",
      "print \"Numerical aperture is \",round(na,3)\n",
      "print \"Acceptance angle is \",round(pc,2),\" degree.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "76.693896868 Critical angle is  76.69  degree.\n",
        "Numerical aperture is  0.343\n",
        "Acceptance angle is  20.06  degree.\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.5.2 - p:2-11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "delta = 1.2/100        # Relative refractive difference index\n",
      "n1=1.45          # Core refractive index \n",
      "NA= n1*(2*delta)**(1.0/2)         #computing numerical aperture\n",
      "Acceptance_angle = math.asin(NA)     #computing acceptance angle\n",
      "si = math.pi*NA**2          #computing solid acceptance angle\n",
      "print \"Numerical aperture is %.3f.\\nAcceptance angle is %.2f degree.\\nSolid acceptance angle is %.3f radians.\"%(NA,Acceptance_angle,si)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Numerical aperture is 0.225.\n",
        "Acceptance angle is 0.23 degree.\n",
        "Solid acceptance angle is 0.159 radians.\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.5.4 - p:2-12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "diameter = 1.0         #Diameter in centimeter\n",
      "Focal_length = 10.0        #Focal length in centimeter\n",
      "radius=diameter/2.0    #computing radius\n",
      "Acceptance_angle = math.atan(radius/Focal_length)    #computing acceptance angle in radian\n",
      "Acceptance_angle*=180/math.pi  # in degree\n",
      "Conical_full_angle = 2*Acceptance_angle          #computing conical angle in degree\n",
      "Solid_acceptance_angle = math.pi*Acceptance_angle**2      #computing solid acceptance angle in degree\n",
      "NA = (Solid_acceptance_angle/math.pi)**(1.0/2)        #computing Numerical aperture\n",
      "print \"Numerical aperture is %.2f.\\nConical full angle is %.2f degree.\" %(NA,Conical_full_angle)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Numerical aperture is 2.86.\n",
        "Conical full angle is 5.72 degree.\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.8.1 - p:2-21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "core_diameter=78*10**-6          #core diameter\n",
      "delta=1.4/100        #relative index difference\n",
      "lamda=0.8*10**-6         #operating wavelength\n",
      "n1=1.47       #core refractive index\n",
      "a=core_diameter/2        #computing core radius\n",
      "v= 2*3.14*a*n1*(2*delta)**(1.0/2)/lamda        #computing normalized frequency\n",
      "M=(v)**2/2        #computing guided modes\n",
      "print \"Normalized Frequency is %.3f.\\nTotal number of guided modes are %.1f\" %(v,M) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Normalized Frequency is 75.306.\n",
        "Total number of guided modes are 2835.5\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.8.2 - p:2-23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "n1=1.47     #refractive index of core\n",
      "a=4.3         #radius of core in um\n",
      "delta=0.2/100       #relative index difference\n",
      "lamda= 2*math.pi*a*n1*(2*delta)**(1.0/2)/2.405       #computing wavelength in um\n",
      "lamda=lamda*10**3  # nm\n",
      "\n",
      "print \"Wavelength of fiber is %0.2f nm.\" %lamda"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength of fiber is 1044.43 nm.\n"
       ]
      }
     ],
     "prompt_number": 30
    }
   ],
   "metadata": {}
  }
 ]
}