rayoptics.raytr.waveabr module

Wavefront aberration calculations

Functions for setting up and calculating wavefront aberrations for (fld, wvl, foc), including focus and image shift.

calculate_reference_sphere(opt_model, fld, wvl, foc, chief_ray_pkg, image_pt_2d=None, image_delta=None)[source]

Compute the reference sphere for a defocussed image point at fld.

The local transform from the final interface to the image interface is included to facilitate infinite refernce sphere calculations.

Parameters:
  • opt_modelOpticalModel instance

  • fldField point for wave aberration calculation

  • wvl – wavelength of ray (nm)

  • foc – defocus amount

  • chief_ray_pkg – input tuple of chief_ray, cr_exp_seg

  • image_pt_2d – x, y image point in (defocussed) image plane, if None, use the chief ray coordinate.

  • image_delta – x, y displacements from image_pt_2d in (defocussed) image plane, if not None.

Returns:

tuple of image_pt, ref_dir, ref_sphere_radius, lcl_tfrm_last

Return type:

ref_sphere

transfer_to_exit_pupil(interface, ray_seg, exp_dst_parax)[source]

Given the exiting interface and chief ray data, return exit pupil ray coords.

Parameters:
  • interface – the exiting :class:’~.Interface’ for the path sequence

  • ray_seg – ray segment exiting from interface

  • exp_dst_parax – z distance to the paraxial exit pupil

Returns:

(exp_pt, exp_dir, exp_dst)

  • exp_pt - ray intersection with exit pupil plane

  • exp_dir - direction cosine of the ray in exit pupil space

  • exp_dst - distance from interface to exit pupil pt

eic_distance(r, r0)[source]

calculate equally inclined chord distance between 2 rays

Parameters:
  • r – (p, d), where p is a point on the ray r and d is the direction cosine of r

  • r0 – (p0, d0), where p0 is a point on the ray r0 and d0 is the direction cosine of r0

Returns:

distance along r from equally inclined chord point to p

Return type:

float

ray_dist_to_perp_from_pt(r, pt)[source]

compute distance along ray to perpendicular to pt.

Parameters:
  • p – a ray, defined by point p and unit direction d

  • d – a ray, defined by point p and unit direction d

  • pt – point to cast perpendicular to

Returns:

distance from p to perpendicular to pt

Return type:

t

ray_dist_to_perp_from_origin(r)[source]

compute distance along ray to perpendicular to the origin.

Parameters:
  • p – a ray, defined by point p and unit direction d

  • d – a ray, defined by point p and unit direction d

Returns:

distance from p to perpendicular to the origin

Return type:

t

dist_to_shortest_join(r1, r2)[source]

compute distance to pts at the closest join between 2 rays.

Parameters:
  • r1 – ray 1, defined by point p1 and unit direction d1

  • r2 – ray 2, defined by point p2 and unit direction d2

Returns: (p1_min, t1), (p2_min, t2)

p1_min: point on ray 1 at the closest join t1: distance from p1 to p1_min p2_min: point on ray 2 at the closest join t2: distance from p2 to p2_min

wave_abr_full_calc(fod, fld, wvl, foc, ray_pkg, chief_ray_pkg, ref_sphere)[source]

Given a ray, a chief ray and an image pt, evaluate the OPD.

The main references for the calculations are in the H. H. Hopkins paper Calculation of the Aberrations and Image Assessment for a General Optical System

Parameters:
  • fodFirstOrderData for object and image space refractive indices

  • fldField point for wave aberration calculation

  • wvl – wavelength of ray (nm)

  • foc – defocus amount

  • ray_pkg – input tuple of ray, ray_op, wvl

  • chief_ray_pkg – input tuple of chief_ray, cr_exp_seg

  • ref_sphere – input tuple of image_pt, ref_dir, ref_sphere_radius

Returns:

OPD of ray wrt chief ray at fld

Return type:

opd

wave_abr_pre_calc(fod, fld, wvl, foc, ray_pkg, chief_ray_pkg, ref_sphere)[source]

Pre-calculate the part of the OPD calc independent of focus.

wave_abr_calc(fod, fld, wvl, foc, ray_pkg, chief_ray_pkg, pre_opd_pkg, ref_sphere)[source]

Given pre-calculated info and a ref. sphere, return the ray’s OPD.

wave_abr_full_calc_finite_pup(fod, fld, wvl, foc, ray_pkg, chief_ray_pkg, ref_sphere)[source]

Given a ray, a chief ray and an image pt, evaluate the OPD.

The main references for the calculations are in the H. H. Hopkins paper Calculation of the Aberrations and Image Assessment for a General Optical System

Parameters:
  • fodFirstOrderData for object and image space refractive indices

  • fldField point for wave aberration calculation

  • wvl – wavelength of ray (nm)

  • foc – defocus amount

  • ray_pkg – input tuple of ray, ray_op, wvl

  • chief_ray_pkg – input tuple of chief_ray, cr_exp_seg

  • ref_sphere – input tuple of image_pt, ref_dir, ref_sphere_radius

Returns:

OPD of ray wrt chief ray at fld

Return type:

opd

wave_abr_pre_calc_finite_pup(fod, fld, wvl, foc, ray_pkg, chief_ray_pkg, ref_sphere)[source]

Pre-calculate the part of the OPD calc independent of focus.

wave_abr_calc_finite_pup(fod, fld, wvl, foc, ray_pkg, chief_ray_pkg, pre_opd_pkg, ref_sphere)[source]

Given pre-calculated info and a ref. sphere, return the ray’s OPD.

wave_abr_full_calc_inf_ref(fod, fld, wvl, foc, ray_pkg, chief_ray_pkg, ref_sphere)[source]

Given a ray, a chief ray and an image pt, evaluate the OPD.

This set of functions calculates the wavefront aberration using an infinite reference sphere. The main references for the calculations are in the paper Dependence of the wave-front aberration on the radius of the reference sphere by Antonı́n Mikš.

Parameters:
  • fodFirstOrderData for object and image space refractive indices

  • fldField point for wave aberration calculation

  • wvl – wavelength of ray (nm)

  • foc – defocus amount

  • ray_pkg – input tuple of ray, ray_op, wvl

  • chief_ray_pkg – input tuple of chief_ray, cr_exp_seg

  • ref_sphere – input tuple of image_pt, ref_dir, ref_sphere_radius, lcl_tfrm_last

Returns:

OPD of ray wrt chief ray at fld

Return type:

opd

wave_abr_pre_calc_inf_ref(fod, fld, wvl, foc, ray_pkg, chief_ray_pkg, ref_sphere)[source]

Pre-calculate the part of the OPD calc independent of focus.

wave_abr_calc_inf_ref(fod, fld, wvl, foc, ray_pkg, chief_ray_pkg, pre_opd_pkg, ref_sphere)[source]

Given pre-calculated info and a ref. sphere, return the ray’s OPD.