In [ ]:
from pyoptools.all import *
In [ ]:
L=Edmund.get("32494")
C=CCD()
S=System(complist=[(L,(0,0,156.),(0,-pi,0)),(C,(0,0,570),(.001,0,0))],n=1.)
R=point_source_c(span=(0.06,0.06),wavelength=.65)
S.ray_add(R)
S.propagate()
plot3D(S,center=(0,0,300), size=(600,100),scale=2,rot=[(0,0,-3*pi/8),(0,3*pi/8,0)])
In [ ]:
imshow(C.get_optical_path_map())
colorbar()
In [ ]:
poly,error=C.get_optical_path_map_lsq(order=2)
In [ ]:
print error
print poly
In [ ]:
def opsystem(lp):
L=Edmund.get("32494")
C=CCD()
S=System(complist=[(L,(0,0,lp),(0,-pi,0)),(C,(0,0,570),(0,0,0))],n=1.)
R=point_source_c(span=(0.06,0.06),wavelength=.65)
S.ray_add(R)
S.propagate()
X,Y,Z=C.get_optical_path_data()
return array(Z).std()
In [ ]:
opsystem(158)
In [ ]:
from scipy.optimize import fmin
fmin(opsystem,158)
In [ ]: