Replies: 2 comments
-
Investigate issue #131The issue is described as a fold mirror followed by a "inserted" optical system doesn't give the expected results. This notebook shows a set of steps that will produce a model that gives the expected results. To be fair, these steps are non-intuitive at best (NIAB) The Sasian Triplet from the rayoptics/models directory is used for the inserted optical system. %matplotlib inline
isdark = False
from rayoptics.environment import *
import itertools
root_pth = Path(rayoptics.__file__).resolve().parent opm = OpticalModel()
opm['system_spec'].title = 'Issue 131 example'
sm = opm['seq_model']
osp = opm['optical_spec']
pm = opm['parax_model']
em = opm['ele_model']
pt = opm['part_tree']
ar = opm['analysis_results'] Use the same optical specs as are used by the Sasian Triplet. The fold mirror in front of the lens needs to be sized by tracing the top and bottom field points. osp['pupil'] = PupilSpec(osp, key=['object', 'pupil'], value=12.5)
osp['fov'] = FieldSpec(osp, key=['object', 'angle'], value=20., flds=[0., -1., 1.], is_relative=True)
osp['wvls'] = WvlSpec([("F", 0.5), ('d', 1.0), ('C', 0.5)], ref_wl=2) opm.radius_mode = True
sm.do_apertures = False
sm.gaps[0].thi=1e10 A dummy surface is added first. This will be used as the reference coordinate system for lens pictures, global coordinates, etc. I list the sequential model and do an update_model() after each change. sm.add_surface([0, 0, 'air', 25.])
sm.list_model()
opm.update_model(src_model=sm)
Add the mirror and define it as a Bend surface; update the model. opm.add_mirror(label='M1',t = -100, sd=100.)
sm.ifcs[-2].decenter = srf.DecenterData('bend', alpha=-45)
opm.update_model() List the decenter data and the sequential model. List the global coordinates and rotation matrix for each surface with respect to the first surface. sm.list_sg()
print()
sm.list_gbl_tfrms()
Add the triplet following the fold mirror. The thickness following the triplet is entered as a positive value; we'll fix it up later. opm.add_from_file(root_pth/'models/Sasian Triplet.roa', t = 50)
sm.list_model()
The aperture stop is at the central, negative element of the triplet. Set the stop surface at that element. sm.set_cur_surface(5)
sm.set_stop() The sign convention for surfaces following a reflection is that the thicknesses are negative. The sm.list_model() above shows the airspace following the mirror is -100 but the triplet spacings are positive. Starting at the first lens surface, scale the remaining surfaces by -1 and update the model. start = 3
seq = itertools.zip_longest(sm.ifcs[start:], sm.gaps[start:])
for i, sg in enumerate(seq, start=start):
ifc, g = sg
ifc.apply_scale_factor(-1)
if g:
g.apply_scale_factor(-1) opm.update_model() sm.list_model()
listobj(osp)
pm.first_order_data()
Change the backfocus to be the paraxial bfl sm.gaps[-1].thi = ar['parax_data'].fod.bfl
opm.update_model() layout_plt = plt.figure(FigureClass=InteractiveLayout, opt_model=opm, is_dark=isdark).plot() ta_plt = plt.figure(FigureClass=RayFanFigure, opt_model=opm, data_type='Ray',
scale_type=Fit.User_Scale, user_scale_value=.05, dpi=130).plot() wav_plt = plt.figure(FigureClass=RayFanFigure, opt_model=opm, data_type='OPD',
scale_type=Fit.All_Same, user_scale_value=0.5, dpi=130).plot() |
Beta Was this translation helpful? Give feedback.
-
Hi Mike. I'm trying to apply the above instructions for an Edmund catalog lens, a plano convex even asphere. I'm trying to fold the optical axis back on itself, so that I get refraction trough the same lens again. In the non-tilted fold, my lens changes shape. I experimented with 45 and 30 degree folds (commented out in the following script), which produce even worse results, where it seems that maybe something is rendered wrong. In this example, however, the traced rays match the rendering, but the lenses don't match each other. Are the asphere coeffs not considered in the flipping and/or -1 scales? import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
plt.ion()
from rayoptics.environment import OpticalModel, FieldSpec, PupilSpec
from rayoptics.environment import InteractiveLayout
opm = OpticalModel()
sm = opm['seq_model']
osp = opm['optical_spec']
em = opm['ele_model']
ar = opm['analysis_results']
pm = opm['parax_model']
osp['pupil'] = PupilSpec(osp, key=['object', 'epd'], value=7.)
osp['fov'] = FieldSpec(osp, key=('object', 'angle'), value=0.0, flds=[1.], is_relative=True)
sm.do_apertures = False
sm.gaps[0].thi = 1e10
opm.add_from_file('CODV_48176.seq', t=1)
bfl = ar['parax_data'].fod.bfl
sm.gaps[-1].thi = bfl
opm.add_mirror(label='M1', t=-bfl)
# sm.ifcs[-2].decenter = srf.DecenterData('bend', alpha=45)
opm.add_from_file('CODV_48176.seq', label='L2', t=20)
lens22 = em.elements[-3]
opm.flip(lens22)
opm.update_model()
start = 4
import itertools
seq = itertools.zip_longest(sm.ifcs[start:], sm.gaps[start:])
for i, sg in enumerate(seq, start=start):
ifc, g = sg
ifc.apply_scale_factor(-1)
if g:
g.apply_scale_factor(-1)
opm.update_model()
layout_plt = plt.figure(FigureClass=InteractiveLayout, opt_model=opm,
do_draw_rays=False, do_paraxial_layout=False,
do_draw_beams=False, do_draw_ray_fans=True, num_rays_in_fan=7).plot() |
Beta Was this translation helpful? Give feedback.
-
After placing a mirror and rotating it as follows.
opm.add_mirror(label='1',t = -100)
sm.ifcs[-2].decenter = srf.DecenterData('bend', alpha=-45)
And then adding a relay lens (triplet example from the docs)
opm.add_from_file('Parts/RelayLens.roa', t = -50)
We get the following results
As we can see this is not the desired result.
If we now flip the relay system, we get .
opm.flip(6,11)
And still we do not have the desired result. How can I fix this?
Beta Was this translation helpful? Give feedback.
All reactions