summaryrefslogtreecommitdiff
path: root/sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb
blob: 7649fb4557eeb2409fbd847bd812224d616ad957 (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
247
248
249
250
251
{
 "metadata": {
  "name": "",
  "signature": "sha256:256c8b99e0e56930e177cf311c8d82ebc12805b19dc6acba2736a9016b128039"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1: Overview of optical fiber communication"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1, Page Number: 8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "f1 = 100*1e3                #frequency1 = 100KHz\n",
      "f2 = 1e9                    #frequency2 = 1GHz\n",
      "T1 = 1.0/f1                 #Time period1 = 0.01ms\n",
      "T2 = 1.0/f2                 #Time period2 = 1 ns\n",
      "\n",
      "#calculation\n",
      "phi = (0.25)*360.0          # Phase shift(degree)\n",
      "\n",
      "#result\n",
      "print \"Phase shift = \",round(phi),\"Degree\",\"= \",round((round(phi)*math.pi)/180,4), \"radian\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Phase shift =  90.0 Degree =  1.5708 radian\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2, Page Number: 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable Declaration\n",
      "flow=10*1e3                  #Lowest frequency\n",
      "fhigh=100*1e3                #Highest frequency\n",
      "\n",
      "#calculation\n",
      "bandwidth=fhigh-flow\n",
      "\n",
      "#result\n",
      "print \"Bandwidth=\",bandwidth/1000 ,\"KHz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bandwidth= 90.0 KHz\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4, Page Number: 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable Declaration\n",
      "B = 10*1e6                    # Bandwidth of noisy channel 1MHZ\n",
      "S_N = 1                       # signal to noise ratio is 1\n",
      "\n",
      "#calculation\n",
      "C=B*(math.log(1+S_N)/math.log(2))   #capacity of channel(Mb/s)\n",
      "\n",
      "#result\n",
      "print \"Capacity of channel =\",C/(10*1e6),\"Mb/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacity of channel = 1.0 Mb/s\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5, Page Number: 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable Declaration\n",
      "fLow = 3*1e6                        #low frequency = 3MHz\n",
      "fHigh = 4*1e6                       #high frequency = 4MHz\n",
      "SNR_dB = 20                         #signal to noise ratio 20 dB\n",
      "\n",
      "#calculation\n",
      "B = fHigh-fLow                      #Bandwidth(MHz)\n",
      "S_N = 10**(SNR_dB/10)\n",
      "C = B*(math.log(1+S_N)/math.log(2)) #capacity of channel(Mb/s)\n",
      "\n",
      "#result\n",
      "print \"Capacity of channel=\",round(C/(1e6),1),\"Mb/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacity of channel= 6.7 Mb/s\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6, Page Number: 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable Declaration\n",
      "P1 = 1                              # Let p1 be 1 watt\n",
      "P2 = P1*0.5                         # P2 is half of p1 so 1/2\n",
      "\n",
      "#calculation\n",
      "Atten_dB = 10*(math.log(P2/P1)/math.log(10))     #attenuation or loss of power(dB)\n",
      "\n",
      "#result\n",
      "print \"Attenuation loss =\",round(Atten_dB,0), \"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Attenuation loss = -3.0 dB\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7, Page Number: 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable Declaration\n",
      "Loss_line1 = -9                #attenuation of signal between point 1 to 2 = 9 dB\n",
      "Amp_gain2 = 14                 #Amplification of signal between point 2 to 3 = 14 dB\n",
      "Loss_line3 = -3                #attenuation of signal between point 3 to 4 = 3 dB\n",
      "\n",
      "#calculation\n",
      "dB_at_line4 = Loss_line1+Amp_gain2+Loss_line3     #power gain\n",
      "\n",
      "#result\n",
      "print \"Power gain for a signal travelling from point1 to another point4 = \",dB_at_line4, \"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power gain for a signal travelling from point1 to another point4 =  2 dB\n"
       ]
      }
     ],
     "prompt_number": 29
    }
   ],
   "metadata": {}
  }
 ]
}