pythonmatplotlibfresnel

optics: Plot phase shift for both TE en TM


I am trying to plot the phase shift of perpendicular and parallel waves with variable angle of incidence, 0 to 180 degrees. The waves are travelling from index of refraction of 1.33 to medium with index of refraction of 1.5.

i used the following eqaution: Theory with equations <-- page 18

i used the following code:

def Phase(theta):

    n=1.5/1.33

    Shift=np.sqrt(np.sin(theta*np.pi/180)**2-n**2)
    Shift=Shift/np.cos(theta*np.pi/180)
    Shift=2*np.degrees(np.arctan(Shift))

    return Shift

print(Phase(x))

x=np.linspace(0,180,30)  

The problem is that i get [ nan nan nan nan nan nan nan nan nan nan] as return.


Solution

  • You are using the equation for total internal reflection (TIR), which is valid for theta > theta_critical. You will need to limit your input angles to this range. In addition, these equations require n < 1 with n defined as the ratio of the transmitted medium to the incident medium. For TIR, you are going from the higher index to the lower index, so n = n_2/n_1 = 1.33/1.5. Finally, incident angles are defined relative to the surface normal, so they should be in the range of 0 <= theta <= 90°.