rayoptics.raytr.vigcalc module

Vignetting and clear aperture setting operations

max_aperture_at_surf(rayset, i)[source]
set_clear_apertures(opt_model: OpticalModel, avoid_list: Sequence[int] | None = None, include_list: Sequence[int] | None = None)[source]

From existing fields and vignetting, calculate clear apertures.

Parameters:
  • avoid_list – list of surfaces to skip when setting apertures.

  • include_list – list of surfaces to include when setting apertures.

If specified, only one of either avoid_list or include_list should be specified. If neither is specified, all surfaces are set. If both are specified, the avoid_list is used.

If a surface is specified as the aperture stop, that surface’s aperture is determined from the boundary rays of the first field.

The avoid_list idea and implementation was contributed by Quentin Bécar

set_ape(opt_model, avoid_list=None, include_list=None)[source]

From existing fields and vignetting, calculate clear apertures.

This function modifies the max_aperture maintained by the list of Interface in the SequentialModel. For each interface, the smallest aperture that will pass all of the (vignetted) boundary rays, for each field, is chosen.

The change of the apertures is propagated to the ElementModel via sync_to_seq().

set_vig(opm, **kwargs)[source]

From existing fields and clear apertures, calculate vignetting.

set_stop_aperture(opm, **kwargs)[source]

Set the aperture on the stop surface to satisfy the pupil spec.

The vignetting is recalculated after the stop aperture change.

set_pupil(opm, use_parax=False)[source]

From existing stop size, calculate pupil spec and vignetting.

Use the upper Y marginal ray on-axis (field #0) and iterate until it goes through the edge of the stop surface. Use the object or image segments of this ray to update the pupil specification value e.g. EPD, NA or f/#.

calc_vignetting_for_field(opm, fld, wvl, **kwargs)[source]

Calculate and set the vignetting parameters for fld.

calc_vignetted_ray(opm, xy, start_dir, fld, wvl, max_iter_count=50)[source]

Find the limiting aperture and return the vignetting factor.

Parameters:
  • opmOpticalModel instance

  • xy – 0 or 1 depending on x or y axis as the pupil direction

  • start_dir – the unit length starting pupil coordinates, e.g [1., 0.]. This establishes the radial direction of the ray iteration.

  • fldField point for wave aberration calculation

  • wvl – wavelength of ray (nm)

  • max_iter_count – fail-safe limit on aperture search

Returns:

(vig, clip_indx, ray_pkg)

  • vig - vignetting factor

  • clip_indx - the index of the limiting interface

  • ray_pkg - the vignetting-limited ray

calc_vignetted_ray_by_bisection(opm, xy, start_dir, fld, wvl, max_iter_count=10)[source]

Find the limiting aperture and return the vignetting factor.

Parameters:
  • opmOpticalModel instance

  • xy – 0 or 1 depending on x or y axis as the pupil direction

  • start_dir – the unit length starting pupil coordinates, e.g [1., 0.]. This establishes the radial direction of the ray iteration.

  • fldField point for wave aberration calculation

  • wvl – wavelength of ray (nm)

  • max_iter_count – fail-safe limit on aperture search

Returns:

(vig, clip_indx, ray_pkg)

  • vig - vignetting factor

  • clip_indx - the index of the limiting interface

  • ray_pkg - the vignetting-limited ray

iterate_pupil_ray(opt_model, indx, xy, start_r0, r_target, fld, wvl, **kwargs)[source]

iterates a ray to r_target on interface indx, returns aim points on the paraxial entrance pupil plane

If indx is None, i.e. a floating stop surface, returns r_target.

If the iteration fails, a TraceError will be raised

Parameters:
  • opmOpticalModel instance

  • indx – index of interface whose edge is the iteration target

  • xy – 0 or 1 depending on x or y axis as the pupil direction

  • start_r0 – iteration starting point

  • r_target – clear aperture radius that is the iteration target.

  • fldField point for wave aberration calculation

  • wvl – wavelength of ray (nm)

Returns:

pupil coordinates for ray thru r_target on ifc indx.

Return type:

start_coords