{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter8 - Optoelectronic detectors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.1 : Page 204"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "The photon energy = 1.31 micro-m \n",
      "part (b)\n",
      "The optical power = 4.07 micro W \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#The photon energy and optical power\n",
    "#given data :\n",
    "print \"part (a)\"\n",
    "h=6.626*10**-34## in Js\n",
    "c=3*10**8## in ms**-1\n",
    "E=1.52*10**-19## in J\n",
    "lamda=((h*c)/E)*10**6#\n",
    "print \"The photon energy = %0.2f micro-m \"%lamda\n",
    "print \"part (b)\"\n",
    "e=1.6*10**-19## in J\n",
    "Ip=3*10**6## in A\n",
    "E=1.52*10**-19## in J\n",
    "eta=70/100#\n",
    "R=(eta*e)/E#\n",
    "P_in=(Ip/R)*10**-6#\n",
    "print \"The optical power = %0.2f micro W \"%P_in"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.2 : Page 205"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "The quantum efficiency, eta = 50.00 %\n",
      "part (b)\n",
      "Maximum possible band gap energy,Eg = 1.46 eV \n",
      "part (c)\n",
      "The mean output, Ip = 3.42 micro A\n"
     ]
    }
   ],
   "source": [
    "#The quantum efficiency,Maximum possible band gap energy and mean output\n",
    "#given data :\n",
    "print \"part (a)\"\n",
    "e=1## electron\n",
    "p=2## photon\n",
    "eta=(e/p)*100#\n",
    "print \"The quantum efficiency, eta = %0.2f %%\"%eta\n",
    "print \"part (b)\"\n",
    "h=6.626*10**-34##in Js\n",
    "c=3*10**8## in m s**-1\n",
    "lamda_c=0.85*10**-6## in m\n",
    "Eg=((h*c)/lamda_c)/1.6*10**19#\n",
    "print \"Maximum possible band gap energy,Eg = %0.2f eV \"%Eg\n",
    "print \"part (c)\"\n",
    "e=1## electron\n",
    "p=2## photon\n",
    "eta=(e/p)#\n",
    "e=1.6*10**-19## in J\n",
    "h=6.626*10**-34##in Js\n",
    "c=3*10**8## in m s**-1\n",
    "lamda_c=0.85*10**-6## in m\n",
    "Eg=((h*c)/lamda_c)#\n",
    "P_in=10*10**-6## in W\n",
    "Ip=((eta*e*P_in)/Eg)*10**6#\n",
    "print \"The mean output, Ip = %0.2f micro A\"%Ip"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.3 : Page 205"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "The quantum efficiency  =  0.4\n",
      "part (b)\n",
      "The responsivity of the diode,R = 0.29 AW**-1\n"
     ]
    }
   ],
   "source": [
    "#The quantum efficiency and The responsivity of the diode\n",
    "#given data :\n",
    "print \"part (a)\"\n",
    "e=2*10**10## in s**-1\n",
    "p=5*10**10## in s**-1\n",
    "eta=e/p#\n",
    "print \"The quantum efficiency  = \",eta\n",
    "print \"part (b)\"\n",
    "e=2*10**10## in s**-1\n",
    "p=5*10**10## in s**-1\n",
    "eta=e/p#\n",
    "e=1.6*10**-19## in J\n",
    "h=6.626*10**-34##in Js\n",
    "c=3*10**8## in m s**-1\n",
    "lamda=0.90*10**-6## in m\n",
    "R=(eta*e*lamda)/(h*c)#\n",
    "print \"The responsivity of the diode,R = %0.2f AW**-1\"%R"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.4 : Page 210"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The multiplication factor,M = 47.8\n"
     ]
    }
   ],
   "source": [
    "#The multiplication\n",
    "#given data :\n",
    "eta=40/100##\n",
    "e=1.6*10**-19## in J\n",
    "h=6.626*10**-34##in Js\n",
    "c=3*10**8## in m s**-1\n",
    "lamda=1.3*10**-6## in m\n",
    "P_in=0.3*10**-6## in W\n",
    "I=6*10**-6## in A\n",
    "M=(I*h*c)/(P_in*eta*e*lamda)#\n",
    "print \"The multiplication factor,M = %0.1f\"%M"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.5 : Page 210"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Photon incident rate = 1.74e+07 s**-1\n"
     ]
    }
   ],
   "source": [
    "#Photon rate\n",
    "#given data :\n",
    "e=1.6*10**-19## in J\n",
    "M=800#\n",
    "eta=90/100## quantum efficiency\n",
    "I=2*10**-9## in A\n",
    "P_rate=I/(e*eta*M)#\n",
    "print \"Photon incident rate = %0.2e s**-1\"%P_rate"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.6 : Page 212"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "the gain = 58.95\n",
      "part (b)\n",
      "The output photo-current, I = 2.313e-04 A\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "#Gain and The output photocurrent\n",
    "#given data :\n",
    "print \"part (a)\"\n",
    "tf=6*10**-12## in s\n",
    "del_f=450*10**6## in Hz\n",
    "G=1/(2*pi*tf*del_f)#\n",
    "print \"the gain = %0.2f\"%G\n",
    "print \"part (b)\"\n",
    "tf=6*10**-12## in s\n",
    "del_f=450*10**6## in Hz\n",
    "G=1/(2*pi*tf*del_f)#\n",
    "eta=75/100#\n",
    "P_in=5*10**-6## in W\n",
    "e=1.6*10**-19## in J\n",
    "lamda=1.3*10**-6#\n",
    "h=6.626*10**-34##in Js\n",
    "c=3*10**8## in m s**-1\n",
    "I=(G*eta*P_in*e*lamda)/(h*c)#\n",
    "print \"The output photo-current, I = %0.3e A\"%I"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.7 : Page 215"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "rms value of shot noise current is = 1.712 nA\n",
      "rms value of dark current is = 0.20 nA\n",
      "rms value of thermal noise current is = 20.35 nA \n",
      "part (b)\n",
      "S/N ratio = 321\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "#rms value of shot noise ,dark noise and thermal noise current and S/N ratio\n",
    "print \"part (a)\"\n",
    "n=0.7##efficiency\n",
    "e=1.6*10**-19##charge\n",
    "h=1.3##in micro meter\n",
    "hc=6.626*10**-34##plack constant\n",
    "c=3*10**8##m/s\n",
    "pin=500##nW\n",
    "Ip=((n*e*h*10**-6*pin*10**-9)/(hc*c))##in amperes\n",
    "df=25##Mhz\n",
    "f1=1##\n",
    "is2=(2*e*Ip*df*10**6*f1)##\n",
    "Is=sqrt(is2)##in amperes\n",
    "Id=5*10**-9##amperes\n",
    "id2=(2*e*Id*df*10**6)##\n",
    "Id=sqrt(id2)##in amperes\n",
    "k=1.38*10**-23##\n",
    "t=300##in kelvin\n",
    "rl=1000##ohms\n",
    "it2=((4*k*t*df*10**6)/rl)##\n",
    "it=sqrt(it2)##in amperes\n",
    "print \"rms value of shot noise current is = %0.3f nA\"%(Is*10**9)\n",
    "print \"rms value of dark current is = %0.2f nA\"%(Id*10**9)\n",
    "print \"rms value of thermal noise current is = %0.2f nA \"%(it*10**9)\n",
    "print \"part (b)\"\n",
    "n=0.7##efficiency\n",
    "e=1.6*10**-19##charge\n",
    "h=1.3##in micro meter\n",
    "hc=6.626*10**-34##plack constant\n",
    "c=3*10**8##m/s\n",
    "pin=500##nW\n",
    "Ip=((n*e*h*10**-6*pin*10**-9)/(hc*c))##in amperes\n",
    "df=25##Mhz\n",
    "f1=1##\n",
    "is2=(2*e*Ip*df*10**6*f1)##\n",
    "Is=sqrt(is2)##in amperes\n",
    "Id=5*10**-9##amperes\n",
    "id2=(2*e*Id*df*10**6)##\n",
    "Id=sqrt(id2)##in amperes\n",
    "k=1.38*10**-23##\n",
    "t=300##in kelvin\n",
    "rl=1000##ohms\n",
    "it2=((4*k*t*df*10**6)/rl)##\n",
    "it=sqrt(it2)##in amperes\n",
    "itt2=is2+id2+it2##in A**2\n",
    "ip2=Ip**2##\n",
    "sn=ip2/itt2##\n",
    "print \"S/N ratio = %d\"%sn\n",
    "#S/N ratio is calculated wrong in the textbook"
   ]
  }
 ],
 "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
}