设计菲涅尔透镜(python)

本文介绍如何利用Python编程实现菲涅尔透镜的设计过程,主要涉及numpy库的应用,通过代码snell.py来阐述具体的实现细节。
摘要由CSDN通过智能技术生成

代码主体

# -*- coding: utf-8 -*-
"""
Created on Fri Feb 24 09:30:12 2023

@author: Conway
"""

'''
@Default unit: mm

'''
#%% Diagram of the optical path
'''           z3
    \      \  :
*   \      \  :
    \      \  :
    z1     z2
    
    
    
*   light source
\   surface
:   micron structure
'''
#%% import libraries
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('Qt5Agg')
import sys
sys.path.append(r'D:\Python program\Snells law')
import snell
#%% parameters
'''
z1: the front surface of substrate
z2: the rear surface of substrate
z3: the micron structrue vertex z-axis coordinate
n3  the refractive index between surface 2&3 (unable)
n2: the refractive index between surface 1&2
n1: the refractive index in front of surface 1
thickness: thickness of substrate
'''

thickness=0.25#constant
z1=2 #constant
z2=z1+thickness #iter
z3=z2+0.08  #iter

n1=1
n2=1.5
# n3=n2
#%%
'''
theta1: incident angle of substrate front surface
theta2: emergent angle of substrate front surface
h2: corresponding to z2, denoting the y coordinate
max_step: maxinum depth of the micron structure
shift: y-shift of (z2,h2)
cvector: denoting the emergent light direction on substrate rear surface
'''
theta2=np.arange(0,np.pi/180*41.5,1e-5)
theta1=np.arcsin(n2/n1*np.sin(theta2))

h2=0

y=np.array([])
z=y

max_step=0.08
shift=max_step/2
cvector=[0,1]
#%% parameters
'''
Radius: Radius of substrate
spread_degree: spread degree of the designed collimated light
center: focus coordinates of the designed collimated light
'''
radius=2
spread_degree=6
center=[0,z2-radius/np.tan(spread_degree/180*np.pi)] # collimating light focus
#%%
while h2<=radius:
    temporary=np.array([float(h2),thickness+z1])-np.array(center)
    angle=np.arctan2(temporary[0],temporary[1])
    cvector=[float(np.sin
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值