python光学仿真通过菲涅耳公式实现波动模型
作者:微小冷 时间:2022-10-25 06:08:19
从物理学的机制出发,波动模型相对于光线模型,显然更加接近光的本质;但是从物理学的发展来说,波动光学旨在解决几何光学无法解决的问题,可谓光线模型的一种升级。从编程的角度来说,波动光学在某些情况下可以简单地理解为在光线模型的基础上,引入一个相位项。
波动模型
一般来说,三个特征可以确定空间中的波场:频率、振幅和相位,故光波场可表示为:
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()
得
来源:https://blog.csdn.net/m0_37816922/article/details/100894611
标签:光学仿真,菲涅耳,波动模型
0
投稿
猜你喜欢
GO必知必会的常见面试题汇总
2023-07-14 01:47:07
php操作SVN版本服务器类代码
2023-09-08 07:22:41
带你了解Python妙开根号的三种方式
2021-10-18 08:27:56
Django项目中用JS实现加载子页面并传值的方法
2022-07-05 00:18:28
python中logging库的使用总结
2022-10-29 09:36:28
详解pycharm配置python解释器的问题
2022-10-14 13:22:08
Python实现抖音热搜定时爬取功能
2022-01-03 03:48:29
Python 装饰器代码解析
2022-06-29 20:48:01
关于交互设计在QQ秀赠送流程中的优化
2009-06-11 12:30:00
讲解数据库加密技术的功能特性与实现方法
2008-12-18 14:24:00
python读取hdfs上的parquet文件方式
2021-04-07 11:54:31
Python pandas中read_csv参数示例详解
2021-05-14 06:17:12
JS阻止事件冒泡的方法详解
2023-09-10 08:57:36
python3 scrapy框架的执行流程
2022-04-12 08:53:35
pandas抽取行列数据的几种方法
2022-06-19 09:32:16
python break和continue用法对比
2021-11-03 14:36:20
Python中列表、字典、元组、集合数据结构整理
2022-08-02 05:54:57
pandas数据聚合与分组运算的实现
2021-09-18 18:29:12
python如何实现不可变字典inmutabledict
2023-11-20 11:09:46
用 Python 脚本实现电脑唤醒后自动拍照并截屏发邮件通知
2023-08-30 14:15:44