{
 "metadata": {
  "name": "Chapter_5"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": "Chapter 5 : Optical fiber connection: joints, couplers and isolators"
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 5.1, page 220"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nn1=1.5                                 #core refractive index\nn=1.0                                  #refractive index of medium\n\n#Calculation\nr=((n1-n)/(n1+n))**2                   #magnitude of the Fresnel reflection at the fiber\u2013air interface\nLoss=-10*math.log10(1-r)               #loss in decibels at the single interface\nLoss1=2*Loss                           #total loss\n\n#Result\nprint'Total loss due to Fresnel reflection = %.2f dB'%Loss1         #loss due to fresnel resolution = 0.18X2 dB\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Total loss due to Fresnel reflection = 0.35 dB\n"
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 5.2, page 224"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nn1=1.5                                   #refractive index\ny=5                                      #lateral offset of the fiber core axes in um\na=25                                     #radius in um\n\n#Calculation\nb=(16*n1**2)/(math.pi*(1+n1)**4)\nc=math.acos(y*(2*a)**-1)\ne=(y*a**-1)\nf=math.sqrt(1-(y*(2*a)**-1)**2)\nn=b*((2*c)-(e*f))                                             #coupling efficiency \nLoss=-10*math.log10(n)                                         #insertion loss\nna=(math.pi**-1)*((2*c)-(e*f))\nLoss1=-10*math.log10(na) \n\n#Result\nprint'(a) Insertion loss = %.3f dB'%Loss\nprint'(b) Insertion loss = %.2f dB'%Loss1",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "(a) Insertion loss = 0.945 dB\n(b) Insertion loss = 0.59 dB\n"
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 5.3, page 226"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\ny=3                               #lateral misalignment in um\na=25                              #core radius in um\n\n#Calculation\nLt=0.85*(y*a**-1)                     #misalignment loss for guided modes\nn=1-Lt                            #coupling efficiency\nLoss=-10*math.log10(n)            #insertion loss\nLt1=0.75*(y*a**-1)                    #both guided and leaky modes \nn1=1-Lt1                          #coupling efficiency\nLoss1=-10*math.log10(n1)          #insertion loss\n\n#Result\nprint'(a) Uniform illumination of all guided modes only = %.2f dB'%Loss\nprint'(b) Uniform illumination of all guided and leaky modes = %.2f dB'%Loss1",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "(a) Uniform illumination of all guided modes only = 0.47 dB\n(b) Uniform illumination of all guided and leaky modes = 0.41 dB\n"
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 5.4, page 227"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nNA=0.2                                  #numerical aperture\nn1=1.48                                 #core refractive index\nang=(5*math.pi)/180                     #angular misalignment (radians)\nNA1=0.4                                 #numerical aperture\n\n#Calculation\nna=((16*(n1)**2)/((1+n1)**4))*(1-(ang/(math.pi*NA)))               #angular coupling efficiency\nLoss=-10*math.log10(na)                                            #insertion loss\nna1=((16*(n1)**2)/((1+n1)**4))*(1-(ang/(math.pi*NA1)))             #angular coupling efficiency\nLoss1=-10*math.log10(na1)                                          #insertion loss\n\n#Result\nprint'Insertion loss at a joint (NA = 0.2) = %.2f dB'%Loss\nprint'Insertion loss at a joint (NA = 0.4) = %.2f dB'%Loss1         #in textbook, value is not calculated",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Insertion loss at a joint (NA = 0.2) = 0.98 dB\nInsertion loss at a joint (NA = 0.4) = 0.64 dB\n"
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 5.5, page 231"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nV=2.4                                          #normalized frequency\na=4                                            #core radius in um\nNA=0.1                                         #numerical aperture \nn1=1.46                                        #core refractive index\ny=1                                            #lateral misalignment in um\nteta=math.pi/180                               #angular misalignment in rad\n\n#Calculation\nw=a*(0.65+(1.62/V**1.5)+(2.88/V**6))/(2**0.5)  #normalized spot size\nTl=2.17*(y/w)**2                               #loss due to the lateral offset\nTa=2.17*((teta*w*n1*V)/(a*NA))**2              #loss due to angular misalignment\nTt=Tl+Ta                                       #total insertion loss\n\n#Result\nprint'Total insertion loss = %.2f dB'%Tt",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Total insertion loss = 0.72 dB\n"
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 5.6, page 232"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nw01=5.6                                   #mode-field radius in um\nw02=4.2                                   #mode-field radius in um\n\n#Calculation\nLoss=-10*math.log10(4*((w02/w01)+(w01/w02))**(-2))      #intrinsic loss \n\n#Result\nprint'Intrinsic loss  = %.2f dB'%Loss",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Intrinsic loss  = 0.35 dB\n"
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 5.7, page 262"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\np1=60                                         #input port power\np2=0.004                                      #output port power\np3=26                                         #output port power\np4=27.5                                       #output port power\n\n\n#Calculation\nxloss=10*math.log10(p1/(p3+p4))              #Excess Loss\niloss1=10*math.log10(p1*p3**-1)                  #Insertion Loss at input\niloss2=10*math.log10(p1/p4)                  #Insertion Loss at output\ncross=10*math.log10(p2/p1)                   #Crosstalk ratio\nsrat=((p3/(p3+p4))*100)                      #Split ratio\n\n#Result\nprint'Excess Loss = %.1f dB'%xloss\nprint'Insertion Loss at input = %.2f dB'%iloss1\nprint'Insertion Loss at output = %.2f dB'%iloss2\nprint'Crosstalk ratio = %.1f dB'%cross\nprint'Split ratio = %.1f percent'%srat",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Excess Loss = 0.5 dB\nInsertion Loss at input = 3.63 dB\nInsertion Loss at output = 3.39 dB\nCrosstalk ratio = -41.8 dB\nSplit ratio = 48.6 percent\n"
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 5.8, page 266"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nN=32                                           #total no of ports\npi=10**3                                       #optical power at input in micro-watt\npj=14                                          #optical power at input in micro-watt\n\n\n#Calculation\nsloss=10*math.log10(N)                               #splitting loss\nxloss=10*math.log10(pi*(pj*N)**-1)                   #excess loss\ntloss=sloss+xloss                                    #total loss\niloss=10*math.log10(pi*pj**-1)                       #insertion loss\n\n#Result\nprint'Total loss = %.2f dB'%tloss\nprint'Insertion loss = %.2f dB'%iloss\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Total loss = 18.54 dB\nInsertion loss = 18.54 dB\n"
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 5.9, page 268"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\np=16                                       #output ports\nl=0.2                                      #excess loss with split ratio of 50%\nl1=0.1                                     #splice loss\n\n#Calculation\nm=math.log(p)/math.log(2)                  #no of stages\nxloss=(4*l)+(3*l1)                         #excess loss\nsloss=10*math.log10(p)                     #split loss\niloss=sloss+xloss                          #insertion loss\n\n#Result\nprint'Insertion loss = %.2f dB'%iloss",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Insertion loss = 13.14 dB\n"
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 5.10, page 277"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "#Variable declaration\nh=1.55*10**-6                      #optical signal wavelength\nN=1.46                             #refractive index\n\n\n#Calculation\nv=h/(2*N)                           #grating period of the FBG\n\n#Result\nprint'Grating period of FBG = %.2f um'%(v*10**6)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Grating period of FBG = 0.53 um\n"
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "",
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 11
    }
   ],
   "metadata": {}
  }
 ]
}