小編給大家分享一下python光學仿真通過菲涅耳公式如何實現波動模型,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
從物理學的機制出發,波動模型相對于光線模型,顯然更加接近光的本質;但是從物理學的發展來說,波動光學旨在解決幾何光學無法解決的問題,可謂光線模型的一種升級。從編程的角度來說,波動光學在某些情況下可以簡單地理解為在光線模型的基礎上,引入一個相位項。
一般來說,三個特征可以確定空間中的波場:頻率、振幅和相位,故光波場可表示為:
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D z = np.arange(15,200)*10 #單位為nm x = np.arange(15,200)*10 x,z = np.meshgrid(x,z) #創建坐標系 E = 1/np.sqrt(x**2+z**2)*np.cos(2*np.pi*np.sqrt(x**2+z**2)/(532*1e-9)) fig = plt.figure() ax = Axes3D(fig) ax.plot_surface(x,z,E) plt.show()
其結果如圖所示
幾何光學可以通過費馬原理得到折射定律,但是無法獲知光波的透過率,菲涅耳公式在幾何光學的基礎上,解決了這個問題。
由于光是一群橫波的集合,故可以根據其電矢量的震動方向,將其分為平行入射面與垂直入射面的兩個分量,分別用 p分量和 s 分量來表示。一束光在兩介質交界處發生折射,兩介質折射率分別為 n1和 n2,對于 p光來說,其電矢量平行于入射面,其磁矢量則垂直于入射面,即只有s分量;而對于 s光來說,則恰恰相反,如圖所示。
則對于 p 光來說即
對于磁矢量而言,有
我們可以通過python繪制出當入射光的角度不同時,其振幅反射率和透過率的變化
import matplotlib.pyplot as plt import numpy as np def fresnel(theta, n1, n2): theta = theta*np.pi/180 xTheta = np.cos(theta) mid = np.sqrt(1-(n1/n2*np.sin(theta))**2) #中間變量 rp = (n2*xTheta-n1*mid)/(n2*xTheta+n1*mid) #p分量振幅反射率 rs = (n1*xTheta-n2*mid)/(n1*xTheta+n2*mid) tp = 2*n1*xTheta/(n2*xTheta+n1*mid) ts = 2*n1*xTheta/(n1*xTheta+n2*mid) return rp, rs, tp, ts def testFres(n1=1,n2=1.45): #默認n2為1.45 theta = np.arange(0,90,0.1)+0j a = theta*np.pi/180 rp,rs,tp,ts = fresnel(theta,n1,n2) fig = plt.figure(1) plt.subplot(1,2,1) plt.plot(theta,rp,'-',label='rp') plt.plot(theta,rs,'-.',label='rs') plt.plot(theta,np.abs(rp),'--',label='|rp|') plt.plot(theta,np.abs(rs),':',label='|rs|') plt.legend() plt.subplot(1,2,2) plt.plot(theta,tp,'-',label='tp') plt.plot(theta,ts,'-.',label='ts') plt.plot(theta,np.abs(tp),'--',label='|tp|') plt.plot(theta,np.abs(ts),':',label='|ts|') plt.legend() plt.show() if __init__=="__main__": testFres()
得到其圖像為
通過python進行繪圖,將上面程序中的testFres
改為以下代碼即可。
def testFres(n1=1,n2=1.45): theta = np.arange(0,90,0.1)+0j a = theta*np.pi/180 rp,rs,tp,ts = fml.fresnel(theta,n1,n2) Rp = np.abs(rp)**2 Rs = np.abs(rs)**2 Rn = (Rp+Rs)/2 Tp = n2*np.sqrt(1-(n1/n2*np.sin(a))**2)/(n1*np.cos(a))*np.abs(tp)**2 Ts = n2*np.sqrt(1-(n1/n2*np.sin(a))**2)/(n1*np.cos(a))*np.abs(ts)**2 Tn = (Tp+Ts)/2 fig = plt.figure(2) plt.subplot(1,2,1) plt.plot(theta,Rp,'-',label='R_p') plt.plot(theta,Rs,'-.',label='R_s') plt.plot(theta,Rn,'-',label='R_n') plt.legend() plt.subplot(1,2,2) plt.plot(theta,Tp,'-',label='T_p') plt.plot(theta,Ts,'-.',label='T_s') plt.plot(theta,Tn,'--',label='T_n') plt.legend() plt.show()
得
以上是“python光學仿真通過菲涅耳公式如何實現波動模型”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。