%matplotlib inline
from opticspy.ray_tracing import *
New_Lens = lens.Lens(lens_name='Triplet',creator='XF')
New_Lens.FNO = 5
New_Lens.lens_info()
New_Lens.add_wavelength(wl = 656.30)
New_Lens.add_wavelength(wl = 587.60)
New_Lens.add_wavelength(wl = 486.10)
New_Lens.list_wavelengths()
New_Lens.add_field_YAN(angle=0)
New_Lens.add_field_YAN(angle=14)
New_Lens.add_field_YAN(angle=20)
New_Lens.list_fields()
New_Lens.add_surface(number=1,radius=10000000,thickness=1000000,glass='air',output=True)
New_Lens.add_surface(number=2,radius=41.15909,thickness=6.097555 ,glass='S-BSM18_ohara',output=True)
New_Lens.add_surface(number=3,radius=-957.83146,thickness=9.349584,glass='air',output=True)
New_Lens.add_surface(number=4,radius=-51.32104,thickness=2.032518,glass='N-SF2_schott',output=True)
New_Lens.add_surface(number=5,radius=42.37768 ,thickness=5.995929 ,glass='air',output=True)
New_Lens.add_surface(number=6,radius=10000000,thickness=4.065037,glass='air',STO=True,output=True)
New_Lens.add_surface(number=7,radius=247.44562,thickness=6.097555,glass='S-BSM18_ohara',output=True)
New_Lens.add_surface(number=8,radius=-40.04016,thickness=85.593426,glass='air',output=True)
New_Lens.add_surface(number=9,radius=10000000,thickness=0,glass='air',output=True)
New_Lens.refresh_paraxial()
dict_list = trace.trace_draw_ray(New_Lens)
draw.draw_system(New_Lens)
field.grid_generator(12,grid_type='grid',output = 1)
analysis.spotdiagram(New_Lens,[1,2,3],[1,2,3],n=12,grid_type='grid')
field.grid_generator(6,grid_type='circular',output = 1)
analysis.spotdiagram(New_Lens,[1,2,3],[1,2,3],n=6,grid_type='circular')
field.grid_generator(100,grid_type='random',output = 1)
analysis.spotdiagram(New_Lens,[1,2,3],[1,2,3],n=100,grid_type='random')
analysis.Ray_fan(New_Lens,[1,2,3],[1,2,3])
trace.trace_one_ray(New_Lens,field_num=2,wave_num=1,ray=[0,-1],start=0,end=0,output=True,output_list=['X','Y','Z'])
trace.trace_one_ray(New_Lens,3,2,[0,0],start=3,end=7,output=True,output_list=['X','Y','Z','K','L','M'])
New_Lens.image_position()
New_Lens.EFY()
New_Lens.EFY(2,3)
New_Lens.BFL()
New_Lens.EP()
New_Lens.EPD
New_Lens.EX()
New_Lens.OAL(2,7)