{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter7 -  Optoelectronic sources"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.1: Page 153"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Intrinsic carrier concentration ,ni = 2.2e+12 m**-3\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt, pi, exp\n",
    "#Intrinsic carrier\n",
    "#given data :\n",
    "m=9.11*10**-31## in kg\n",
    "k=1.38*10**-23## in JK**-1\n",
    "h=6.626*10**-34## in Js\n",
    "ev=1.6*10**-19## in J\n",
    "T=300## in K\n",
    "me=0.07*m## in kg\n",
    "mh=0.56*m## in kg\n",
    "Eg=1.43*ev## in J\n",
    "ni=2*((2*pi*k*T)/h**2)**(3/2)*(me*mh)**(3/4)*exp(-Eg/(2*k*T))#\n",
    "print \"Intrinsic carrier concentration ,ni = %0.1e m**-3\"%ni"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.2: Page 155"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Diffusion potential, Vd = 1.234 V\n"
     ]
    }
   ],
   "source": [
    "#Diffusion potential\n",
    "from math import log\n",
    "#given data :\n",
    "Na=5*10**23## in m**-3\n",
    "Nd=5*10**21## in m**-3\n",
    "T=300## in K\n",
    "e=1.6*10**-19## in J\n",
    "k=1.38*10**-23## in JK**-1\n",
    "V=(k*T)/e#\n",
    "ni=2.2*10**12## in m**-3\n",
    "Vd=V*log((Na*Nd)/ni**2)#\n",
    "print \"Diffusion potential, Vd = %0.3f V\"%Vd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.3: Page 161"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Injection efficiency, eta_inj = 0.8247\n"
     ]
    }
   ],
   "source": [
    "#Injection efficiency\n",
    "#given data :\n",
    "Na=10**23## in m**-3\n",
    "Nd=10**21## in m**-3\n",
    "T=300## in K\n",
    "e=1.6*10**-19## in J\n",
    "k=1.38*10**-23## in JK**-1\n",
    "mue=0.85## in m**2V**-1s**-1\n",
    "muh=0.04## in m**2V**-1s**-1\n",
    "De=(mue*k*T)/e## in m**2s**-1\n",
    "Dh=(muh*k*T)/e## in m**2s**-1\n",
    "Le=1#\n",
    "Lh=Le#\n",
    "eta_inj=1/(1+((De/Dh)*(Lh/Le)*(Nd/Na)))#\n",
    "print \"Injection efficiency, eta_inj = %0.4f\"%eta_inj"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.4: Page 171"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "Internal quantum efficiency = 0.50\n",
      "part (b)\n",
      "External quantum efficiency = 0.0337\n"
     ]
    }
   ],
   "source": [
    "#Internal and quantum efficiency\n",
    "#given data :\n",
    "print \"part (a)\"\n",
    "tau_rr=1#\n",
    "tau_nr=tau_rr#\n",
    "eta_int=1/(1+(tau_rr/tau_nr))#\n",
    "print \"Internal quantum efficiency = %0.2f\"%eta_int\n",
    "print \"part (b)\"\n",
    "ns=3.7#\n",
    "na=1.5#\n",
    "As=0#\n",
    "eta_ext=eta_int*(1-As)*((2*na**3)/(ns*(ns+na)**2))#\n",
    "print \"External quantum efficiency = %0.4f\"%eta_ext"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.5: Page 180"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The number of longitudinal modes excited = 1.001e-03 nm\n"
     ]
    }
   ],
   "source": [
    "#The number of longitudinal modes excited\n",
    "#given data :\n",
    "lamda=632.8*10**-9## in m\n",
    "n=1#\n",
    "L=20*10**-2## in m\n",
    "del_lamda=((lamda)**2/(2*n*L))*10**9#\n",
    "print \"The number of longitudinal modes excited = %0.3e nm\"%del_lamda"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.6: Page 183"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "The reduction in threshold gain = 1.31 mm**-1\n",
      "part (b)\n",
      "Differential quantum efficiency =  0.42\n"
     ]
    }
   ],
   "source": [
    "#The reduction and Differential quantum efficiency\n",
    "#given data :\n",
    "print \"part (a)\"\n",
    "alfa_eff=1.5## in mm**-1\n",
    "gama=0.8#\n",
    "L=0.5## in mm\n",
    "R1=0.35#\n",
    "R2=R1#\n",
    "R2a=1.0#\n",
    "g_th1=(1/gama)*(alfa_eff+(1/(2*L))*log(1/(R1*R2)))#\n",
    "g_th2=(1/gama)*(alfa_eff+(1/(2*L))*log(1/(R1*R2a)))#\n",
    "del_gth=g_th1-g_th2#\n",
    "print \"The reduction in threshold gain = %0.2f mm**-1\"%del_gth\n",
    "print \"part (b)\"\n",
    "eta_D=(gama*(g_th2-alfa_eff))/(g_th2)#\n",
    "print \"Differential quantum efficiency =  %0.2f\"%eta_D"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.7: Page 192"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "The internal power efficiency = 0.48\n",
      "part (b)\n",
      "The external power efficiency = 0.012\n",
      "part (c)\n",
      "The overall source fiber power coupling efficiency  = 8.51e-04\n",
      "The optical loss = 30.70 dB\n"
     ]
    }
   ],
   "source": [
    "from math import log10\n",
    "#Internal and external power efficiency\n",
    "#given data :\n",
    "print \"part (a)\"\n",
    "As=0##\n",
    "ns=3.7## assuming that the example 7.4\n",
    "eta_int=0.50## internal efficiency\n",
    "V=1.5## in V\n",
    "I=120*10**-3## in A\n",
    "IBYe=120*10**-3## \n",
    "Eph=1.43## in eV\n",
    "eta_int=0.50## internal efficiency\n",
    "fi_int=eta_int*IBYe*Eph#\n",
    "t_power=I*V#\n",
    "P_int=fi_int/t_power#\n",
    "print \"The internal power efficiency = %0.2f\"%P_int\n",
    "print \"part (b)\"\n",
    "eta_ext=eta_int*(1-As)*2/(ns*(ns+1)**2)#\n",
    "fi_ext=eta_ext*IBYe*Eph#\n",
    "t_power=I*V#\n",
    "P_ext=fi_ext/t_power#\n",
    "print \"The external power efficiency = %0.3f\"%P_ext\n",
    "print \"part (c)\"\n",
    "V=1.5## in V\n",
    "I=120*10**-3## in A\n",
    "IBYe=120*10**-3## \n",
    "Eph=1.43## in eV\n",
    "n1=1.5#\n",
    "n2=1.48#\n",
    "na=n1#\n",
    "eta_ext=0.0337#\n",
    "eta_T=eta_ext*((n1**2-n2**2)/na**2)#\n",
    "fi_T=eta_T*IBYe*Eph#\n",
    "t_power=I*V#\n",
    "sfpc=fi_T/t_power#\n",
    "O_loss=-10*log10(sfpc)#\n",
    "print \"The overall source fiber power coupling efficiency  = %0.2e\"%sfpc\n",
    "print \"The optical loss = %0.2f dB\"%O_loss"
   ]
  }
 ],
 "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
}