rayoptics.raytr.wideangle module
Wide angle raytrace and ray aiming
This package was developed to ray trace fisheye, i.e. very wide field, lenses. These lenses have significant pupil spherical aberration. In order to trace highly oblique field angles, one must locate the actual entrance pupil location for a field angle. The function find_real_enp implements the search by parameterizing the z offset from the 1st interface along the object space optical axis. For extreme field angles, the rays that successfully reach the stop surface are far from the z offset for the paraxial entrance pupil.
The function z_enp_coordinate is used to evaluate where the chief ray hits the stop surface. This function is evaluated at regular intervals, spaced between the z distance of the paraxial entrance pupil and the first surface vertex (i. e. z_enp = 0). When the range of z values is identified that pass rays through the complete system, find_z_enp is called to find the exact conjugate point to the center of the stop surface.
The entrance pupil for the wide angle package is taken as normal to the chief ray at that field angle. The set_vignetting function using bisection works well with this definition.
- enp_z_coordinate(z_enp, *args)[source]
Trace a ray thru the center of the entrance pupil at z_enp.
- Parameters:
z_enp – The z distance from the 1st interface of the entrance pupil for the field angle dir0
seq_model – The sequential model
stop_idx – index of the aperture stop interface
dir0 – direction cosine vector in object space
obj_dist – object distance to first interface
wvl – wavelength of raytrace (nm)
- find_z_enp(opt_model, stop_idx, z_enp_0, fld, wvl, **kwargs)[source]
iterates a ray to [0, 0] on interface stop_ifc, returning aim info
- Parameters:
opt_model – input OpticalModel
stop_idx – index of the aperture stop interface
z_enp_0 – estimate of pupil location. this estimate must support a raytrace up to stop_ifc
fld – field point
wvl – wavelength of raytrace (nm)
Returns z distance from 1st interface to the entrance pupil.
If stop_ifc is None, i.e. a floating stop surface, returns paraxial entrance pupil.
If the iteration fails, a TraceError will be raised
- find_real_enp(opm, stop_idx, fld, wvl)[source]
Locate the z center of the real pupil for fld, wrt 1st ifc
This function implements a 2 step process to finding the chief ray for fld and wvl for wide angle systems. fld should be of type (‘object’, ‘angle’), even for finite object distances.
The first phase searches for the window of pupil locations by sampling the z coordinate from the paraxial pupil location towards the first interface vertex. Failed rays are discarded until a range of z coordinates is found where rays trace successfully. If only a single successful trace is in hand, a second, more finely subdivided search is conducted about the successful point.
The outcome is a range, start_z -> end_z, that is divided in 3 and a ray iteration (using
find_z_enp()
) to find the center of the stop surface is done. Sometimes the start point doesn’t produce a solution; use of the mid-point as a start is a reliable second try.
- eval_real_image_ht(opt_model, fld, wvl)[source]
Trace reverse ray from image point to get object space inputs.
This function traces the chief ray for fld and wvl through the center of the stop surface, starting from the specified real image height.
This is the implementation of
obj_coords()
for (‘image’, ‘real height’). It returns the starting ray in object space and the z entrance pupil distance wrt the first interface.