0
Prisms
M
Mike
@mike
10 days ago
40
0
I'm new to optical design and I'm greatful for optiland as a playground to learn. There are a lot of great examples/tutorials, but I didn't see any involving prisms so I thought I would share my experience in getting a 180 degree fold prism to work. I created a helper function that greatly simplifies accumulated thickness with persistent angle changes (it handles Z and Y computation) as well as offsets perpendicular to the local optical axis. TIR didn't seem to work so I added the mirror surfaces to the prism definition. Let me know if there is a way to fix that.
import numpy as np
import math
import matplotlib.pyplot as plt
from optiland.optic import Optic
WAVELENGTHS = (0.4861, 0.5876, 0.6563) # F, d, C
EPD = 45
HALF_FOV = 2
def apply_system_spec(lens: Optic) -> Optic:
"""Apply the aperture, fields and wavelengths from the requirements."""
lens.set_aperture(aperture_type="EPD", value=EPD)
lens.fields.set_type("angle")
for y in (0.0, 0.7 * HALF_FOV, HALF_FOV):
lens.fields.add(y=y)
for value in WAVELENGTHS:
lens.wavelengths.add(value=value, is_primary=(value == 0.5876))
return lens
yg=0
zg=0
rxg=0
idxg=0
lensg=None
def addSurface(prerotation=0, thickness=0, offset=0, rotation=0, *args, **kwargs):
global yg, zg, rxg, idxg, lensg
if lensg == None:
lensg = Optic()
lensg.surfaces.add(index=0, thickness=np.inf)
idxg = 1
print(f"Adding surface {idxg} at z={zg}, y={yg}, rx={rxg*180/math.pi}deg, parameters={args} {kwargs}")
lensg.surfaces.add(*args, **kwargs, index=idxg, z=zg, y=yg, rx=rxg)
rxg += prerotation
zg += thickness * math.cos(rxg) + offset * math.sin(rxg)
yg += thickness * math.sin(rxg) + offset * math.cos(rxg)
rxg += rotation
idxg += 1
# ThorLabs 2" diameter 500mm focal length achromatic doublet
def THOR_ACT508_500_A(flip=False):
if flip:
m1 = "N-SF2"
m2 = "N-BK7"
r1 = 471.2
r2 = 182.1
r3 = -382.5
else:
m1 = "N-BK7"
m2 = "N-SF2"
r1 = 382.5
r2 = -182.1
r3 = -471.2
addSurface(thickness = 6.0, material=m1, is_stop=True, radius=r1)
addSurface(thickness = 6.0, material=m2, radius=r2)
addSurface(radius=r3)
# ThorLabs 60mm face right angle prism
def THOR_PS913(ccw=False):
if ccw:
stepAng = np.pi/4
else:
stepAng = -np.pi/4
addSurface(thickness=42.42640687/2, rotation=stepAng, material="N-BK7")
addSurface(material="mirror")
addSurface(thickness=42.42640687, prerotation=stepAng, rotation=stepAng, material="N-BK7")
addSurface(material="mirror")
addSurface(thickness=42.42640687/2, prerotation=stepAng, material="N-BK7")
# Build the system
THOR_ACT508_500_A()
addSurface(thickness=240, offset=5)
THOR_PS913()
addSurface(thickness=200)
addSurface()
lengs = apply_system_spec(lensg)
fig,ax = lensg.draw(num_rays=10)
plt.show()