#Given
Eg= 1.1
lamda_c = 1.24/Eg
print "The cut off wavelength in um= ",round(lamda_c,2)
Eg_ger =0.67
lamda_ger= 1.24/Eg_ger
print " \nThe cut off wavelength for Germanium in um= ",round(lamda_ger,2)
#Given
Eg = 1.43
lamda = 1.24/Eg
lamda=lamda*1000 # converting in nm
print "The cut off wavelength in nm =",round(lamda,2)
#Given
P = 6*10**6
Eh_pair= 5.4*10**6
n= Eh_pair/P*100
print " The quantum efficiency in % = ",n
#Given
R= 0.65
P0= 10*10**-6
Ip= R*P0
Ip=Ip*10**6 # convertinf in uA...
print " The generated photocurrent in uA = ",Ip
#Given
Ec= 1.2*10**11
P= 3*10**11
lamda = 0.85*10**-6
n= Ec/P*100
print "The efficiency in % =",n
q= 1.602*10**-19
h= 6.625*10**-34
c= 3*10**8
n= n/100
R= n*q*lamda/(h*c)
print " \n\nThe Responsivity of the photodiode in A/W=",round(R ,4)
#Given
n= 0.65
E= 1.5*10**-19
Ip= 2.5*10**-6
h= 6.625*10**-34
c= 3*10**8
lamda= h*c/E
lamda=lamda*10**6 # converting in um for displaying...
print "The wavelength in um =",lamda
lamda=lamda*10**-6
q= 1.602*10**-19
R= n*q*lamda/(h*c)
print "\nThe Responsivity in A/W =",R
Pin= Ip/R
Pin=Pin*10**6 # converting in uW for displaying/..
print " \nThe incidnt power in uW= ",round(Pin,1)
#Given
Iin= 1
lamda= 1550*10**-9
q= 1.602*10**-19
h= 6.625*10**-34
c= 3*10**8
n=0.65
Ip=n*q*lamda*Iin/(h*c)
Ip=Ip*1000 # converting in mA for displaying...
print " The average photon current in mA= ",int(Ip)
#Given
n= 0.70
Ip= 4*10**-6
e= 1.602*10**-19
h= 6.625*10**-34
c= 3*10**8
E= 1.5*10**-19
lamda = h*c/E
lamda=lamda*10**6 # converting um for displaying...
print "The wavelength in um =",round(lamda,3)
R= n*e/E
Po= Ip/R
Po=Po*10**6 # converting um for displaying...
print " \nIncident optical Power in uW =",round(Po,2)
#Given
import math
Ct= 7*10.0**-12
Rt= 50*1*10.0**6/(50+(1*10**6))
B= 1/(2*math.pi*Rt*Ct)
B=B*10**-6 #converting in mHz for displaying...
print "The bandwidth of photodetector in MHz =",round(B,2)
#Given
import math
W= 25*10**-6
Vd= 3*10**4
Bm= Vd/(2*math.pi*W)
RT= 1/Bm
RT=RT*10**9 # converting ns for displaying...
print " The maximum response time in ns =",round(RT,2)
#Given
e= 1.602*10**-19
h= 6.625*10**-34
v= 3*10**8
n=0.65
I= 10*10**-6
lamda= 900*10**-9
R= n*e*lamda/(h*v)
Po= 0.5*10**-6
Ip= Po*R
M= I/Ip
print " The multiplication factor =",round(M,2)
#Given
n=0.65
lamda = 900*10**-9
Pin= 0.5*10**-6
Im= 10*10**-6
q= 1.602*10**-19
h= 6.625*10**-34
c= 3*10**8
R= n*q*lamda/(h*c)
Ip= R*Pin
M= Im/Ip
print " The multiplication factor =",round(M,2)
print "\n***NOTE-Answer wrong in textbook..."
#Given
import math
lamda = 1300*10**-9
Id= 4*10**-9
n=0.9
Rl= 1000
Pincident= 300*10**-9
BW= 20*10**6
q= 1.602*10**-19
h= 6.625*10**-34
v= 3*10**8
Iq= math.sqrt((q*Pincident*n*lamda)/(h*v))
Iq= math.sqrt(Iq)
Iq=Iq*100 # converting in proper format for displaying...
print "Mean square quantum noise current in Amp*10^11 =",round(Iq,2)
I_dark= 2*q*BW*Id
I_dark=I_dark*10**19 # converting in proper format for displaying...
print " \nMean square dark current in Amp*10^-19 =",round(I_dark,3)
k= 1.38*10**-23
T= 25+273
It= 4*k*T*BW/Rl
It=It*10**16 # converting in proper format for displaying...
print " \nMean square thermal nise current in Amp*10^-16 =",round(It,2)
#Given
lamda = 850*10**-9 # meters
BER= 1*10**-9
N_bar = 9*log(10)
h= 6.625*10**-34 # joules-sec
v= 3*10**8 # meters/sec
n= 0.65 # assumption
E=N_bar*h*v/(n*lamda)
E=E*10**18 # /converting in proper format for displaying...
print " The Energy received in Joules*10^-18 =",round(E,2)
#Given
lamda = 850*10**-9
BER = 1*10**-9
BT=10*10**6
h= 6.625*10**-34
c= 3*10**8
Ps= 36*h*c*BT/lamda
Ps=Ps*10**12 # /converting in proper format for displaying...
print "The minimum incidental optical power required id in pW =",round(Ps,2)
#Given
import math
C= 5*10**-12
B =50*10**6
Ip= 1*10**-7
e= 1.602*10**-19
k= 1.38*10**-23
T= 18+273
M= 1
Rl= 1/(2*math.pi*C*B)
S_N= Ip**2/((2*e*B*Ip)+(4*k*T*B/Rl))
S_N = 10*math.log10(S_N) # in db
print " The S/N ratio in dB =",round(S_N,2)
M=41.54
S_N_new= (M**2*Ip**2)/((2*e*B*Ip*M**2.3)+(4*k*T*B/Rl))
S_N_new = 10*math.log10(S_N_new) # in db
print " \n\nThe new S/N ratio in dB =",round(S_N_new,2)
print " \n\nImprovement over M=1 in dB =",round(S_N_new-S_N,1)