summaryrefslogtreecommitdiff
path: root/sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb
diff options
context:
space:
mode:
authorkinitrupti2017-05-12 18:53:46 +0530
committerkinitrupti2017-05-12 18:53:46 +0530
commit6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d (patch)
tree22789c9dbe468dae6697dcd12d8e97de4bcf94a2 /sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb
parentd36fc3b8f88cc3108ffff6151e376b619b9abb01 (diff)
downloadPython-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.gz
Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.bz2
Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.zip
Removed duplicates
Diffstat (limited to 'sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb')
-rwxr-xr-xsample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb251
1 files changed, 251 insertions, 0 deletions
diff --git a/sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb b/sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb
new file mode 100755
index 00000000..7649fb45
--- /dev/null
+++ b/sample_notebooks/kushrami/Chapter_1_-_Overview_of_optical.ipynb
@@ -0,0 +1,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": {}
+ }
+ ]
+} \ No newline at end of file