rayoptics.raytr.opticalspec module

Container class for optical usage information

class OpticalSpecs(opt_model, specsheet=None, **kwargs)[source]

Bases: object

Container class for optical usage information

Contains optical usage information to specify the aperture, field of view, spectrum and focal position. These can be accessed via the mapping interface:

It also maintains a repository of paraxial data.

do_aiming

if True, iterate chief rays to stop center, else entrance pupil

do_aiming_default = True
listobj_str()[source]
property spectral_region
property pupil
property field_of_view
property defocus
set_from_list(dl)[source]
set_from_specsheet(ss)[source]
sync_to_restore(opt_model)[source]
update_model(**kwargs)[source]
update_optical_properties(**kwargs)[source]
lookup_fld_wvl_focus(fi, wl=None, fr=0.0)[source]

returns field, wavelength and defocus data

Parameters:
  • fi (int) – index into the field_of_view list of Fields

  • wl (int) – index into the spectral_region list of wavelengths

  • fr (float) – focus range parameter, -1.0 to 1.0

Returns:

(fld, wvl, foc)

  • fld - Field instance for field_of_view[fi]

  • wvl - wavelength in nm

  • foc - focus shift from image interface

obj_coords(fld)[source]
list_first_order_data()[source]
list_parax_trace(**kwargs)[source]
class WvlSpec(wlwts=[('d', 1.0)], ref_wl=0, do_init=True, **kwargs)[source]

Bases: object

Class defining a spectral region

A spectral region is a list of wavelengths (in nm) and corresponding weights. The central wavelength of the spectral region is central_wvl. The index into the wavelength list for central_wvl is reference_wvl.

listobj_str()[source]
property central_wvl
set_from_list(wlwts)[source]
sync_to_restore(optical_spec)[source]
set_from_specsheet(ss)[source]
update_model(**kwargs)[source]
add(wl, wt)[source]
sort_spectrum()[source]
calc_colors()[source]
class PupilSpec(parent, key=('object', 'pupil'), value=1.0)[source]

Bases: object

Aperture specification

key

‘aperture’, ‘object’|’image’, ‘pupil’|’NA’|’f/#’

value

size of the pupil

pupil_rays

list of relative pupil coordinates for pupil limiting rays

ray_labels

list of string labels for pupil_rays

default_pupil_rays = [[0.0, 0.0], [1.0, 0.0], [-1.0, 0.0], [0.0, 1.0], [0.0, -1.0]]
default_ray_labels = ['00', '+X', '-X', '+Y', '-Y']
listobj_str()[source]
sync_to_restore(optical_spec)[source]
set_from_specsheet(ss)[source]
get_input_for_specsheet()[source]
update_model(**kwargs)[source]
mutate_pupil_type(ape_key)[source]
class FieldSpec(parent, key=('object', 'angle'), value=0.0, flds=[0.0], is_relative=False, do_init=True, **kwargs)[source]

Bases: object

Field of view specification

key

‘field’, ‘object’|’image’, ‘height’|’angle’

value

maximum field, per the key

fields

list of Field instances

is_relative

if True, fields are relative to max field

listobj_str()[source]
sync_to_restore(optical_spec)[source]
set_from_list(flds)[source]
set_from_specsheet(ss)[source]
get_input_for_specsheet()[source]
update_model(**kwargs)[source]
mutate_field_type(fld_key)[source]
obj_coords(fld)[source]
max_field()[source]

calculates the maximum field of view

Returns:

magnitude of maximum field, maximum Field instance

class Field(x=0.0, y=0.0, wt=1.0)[source]

Bases: object

a single field point, largely a data container

x

x field component

y

y field component

vux

+x vignetting factor

vuy

+y vignetting factor

vlx

-x vignetting factor

vly

-y vignetting factor

wt

field weight

aim_pt

x, y chief ray coords on the paraxial entrance pupil plane

chief_ray

ray package for the ray from the field point throught the center of the aperture stop, traced in the central wavelength

ref_sphere

a tuple containing (image_pt, ref_dir, ref_sphere_radius)

listobj_str()[source]
update()[source]
vignetting_bbox(pupil_spec: PupilSpec, oversize=1.02)[source]

returns a bbox of the vignetted pupil ray extents.

apply_vignetting(pupil)[source]
class FocusRange(focus_shift=0.0, defocus_range=0.0)[source]

Bases: object

Focus range specification

focus_shift

focus shift (z displacement) from nominal image interface

defocus_range

+/- half the total focal range, from the focus_shift position

listobj_str()[source]
set_from_specsheet(ss)[source]
update()[source]
get_focus(fr=0.0)[source]

return focus position for input focus range parameter

Parameters:

fr (float) – focus range parameter, -1.0 to 1.0

Returns:

focus position for input focus range parameter