AbstractSequentialSystem#
- class optika.systems.AbstractSequentialSystem[source]#
Bases:
AbstractSystemAn interface describing a sequential optical system.
A sequential optical system is a system where the ordering of the optical surfaces is known in advance.
Attributes
The name of the logical axis representing the sequence of surfaces.
The upper right corner of this optical system's field of view.
The lower left corner of this optical system's field of view.
The field stop surface.
The input grid to sample with rays.
The index of the field stop in
surfaces_all.The index of the pupil stop in
surfaces_all.Extra keyword arguments that will be used in the call to
named_arrays.plt.plot()within theplot()method.The external object being imaged or illuminated by this system.
A boolean flag indicating if the object is at infinity.
The upper right corner of this optical system's entrance pupil in physical units.
The lower left corner of this optical system's entrance pupil in physical units.
The pupil stop surface.
Computes the rays in local coordinates at the last surface in the system as a function of input wavelength and position using
grid_input.A rayfunction defined on the input surface of the optical system, which is designed to exactly strike the borders of both the field stop and the pupil stop.
The imaging sensor that measures the light captured by this system.
The array shape of this object.
A sequence of surfaces representing this optical system.
Concatenate
objectwithsurfacesinto a single list of surfaces.the coordinate transformation between the global coordinate system and this object's local coordinate system
Methods
__init__()image(scene[, wavelength, pupil, ...])Forward model of the optical system.
plot([ax, transformation, components, ...])Plot the surfaces of the system and the default raytrace.
rayfunction([intensity, wavelength, field, ...])Given the wavelength, field position, and pupil position of some input rays, trace those rays through the system and return the resulting rays in local coordinates at the last surface.
raytrace([intensity, wavelength, field, ...])Given the wavelength, field position, and pupil position of some input rays, trace those rays through the system and return the result in global coordinates, including all intermediate rays.
spot_diagram([figsize, s, cmap])Create a spot diagram of the rays at each field point to inspect the performance of this optical system.
to_dxf(file, unit[, transformation])to_string([prefix])Public-facing version of the
__repr__method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.Inheritance Diagram

- image(scene, wavelength=None, pupil=None, axis_wavelength=None, axis_field=None, axis_pupil=None, noise=True, **kwargs)[source]#
Forward model of the optical system. Maps the given spectral radiance of a scene to detector counts.
- Parameters:
scene (FunctionArray[SpectralPositionalVectorArray, AbstractScalar]) – The spectral radiance of the scene as a function of wavelength and field position. The inputs must be cell vertices.
wavelength (None | AbstractScalar) – The vertices of the final wavelength grid on the image plane. If
None(the default),scene.inputs.wavelengthis used.pupil (None | AbstractCartesian2dVectorArray) – The vertices of the pupil grid in either normalized or physical coordinates. If
None,self.grid_input.pupilis used.axis_wavelength (None | str) – The logical axis corresponding to changing wavelength coordinate. If
None,set(scene.inputs.wavelength.shape) - set(self.shape), should have only one element.axis_field (None | tuple[str, str]) – The two logical axes corresponding to changing field coordinate. If
None,set(scene.inputs.position.shape) - set(self.shape) - {axis_wavelength}, should have exactly two elements.axis_pupil (None | tuple[str, str]) – The two logical axes corresponding to changing pupil coordinate. If
None,set(pupil.shape) - set(self.shape) - {axis_wavelength,} - set(axis_field), should have exactly two elements.noise (bool) – Whether to add noise to the result.
kwargs – Additional keyword arguments used by subclass implementations of this method.
- Return type:
FunctionArray[SpectralPositionalVectorArray, AbstractScalar]
- plot(ax=None, transformation=None, components=None, plot_rays=True, plot_rays_vignetted=False, kwargs_rays=None, **kwargs)[source]#
Plot the surfaces of the system and the default raytrace.
- Parameters:
ax (None | Axes | ScalarArray[ndarray[tuple[Any, ...], dtype[_ScalarT]]]) – The matplotlib axes on which to plot the system
transformation (None | AbstractTransformation) – Any additional transformation to apply to the system before plotting.
components (None | tuple[str, ...]) – The vector components to plot if ax is 2-dimensional.
plot_rays (bool) – Boolean flag indicating whether to plot the rays.
plot_rays_vignetted (bool) – Boolean flag indicating whether to plot the vignetted rays.
kwargs_rays (None | dict[str, Any]) – Any additional keyword arguments to use when plotting the rays.
kwargs – Any additional keyword arguments to use when plotting the surfaces.
- Return type:
- rayfunction(intensity=None, wavelength=None, field=None, pupil=None, normalized_field=True, normalized_pupil=True)[source]#
Given the wavelength, field position, and pupil position of some input rays, trace those rays through the system and return the resulting rays in local coordinates at the last surface.
- Parameters:
intensity (None | float | Quantity | AbstractScalar) – The energy density of the input rays.
wavelength (None | Quantity | AbstractScalar) – The wavelengths of the input rays. If
None(the default),self.grid_input.wavelengthwill be used.field (None | AbstractCartesian2dVectorArray) – The field positions of the input rays, in either normalized or physical units. If
None(the default),self.grid_input.fieldwill be used.pupil (None | AbstractCartesian2dVectorArray) – The pupil positions of the input rays, in either normalized or physical units. If
None(the default),self.grid_input.pupilwill be used.normalized_field (bool) – A boolean flag indicating whether the field parameter is given in normalized or physical units.
normalized_pupil (bool) – A boolean flag indicating whether the pupil parameter is given in normalized or physical units.
- Return type:
See also
raytraceSimilar to rayfunction except it computes all the intermediate rays, and it returns results in global coordinates.
- raytrace(intensity=None, wavelength=None, field=None, pupil=None, axis=None, normalized_field=True, normalized_pupil=True)[source]#
Given the wavelength, field position, and pupil position of some input rays, trace those rays through the system and return the result in global coordinates, including all intermediate rays.
- Parameters:
intensity (None | float | Quantity | AbstractScalar) – The energy density of the input rays.
wavelength (None | Quantity | AbstractScalar) – The wavelengths of the input rays. If
None(the default),self.grid_input.wavelengthwill be used.field (None | AbstractCartesian2dVectorArray) – The field positions of the input rays, in either normalized or physical units. If
None(the default),self.grid_input.fieldwill be used.pupil (None | AbstractCartesian2dVectorArray) – The pupil positions of the input rays, in either normalized or physical units. If
None(the default),self.grid_input.pupilwill be used.axis (None | str) – The axis along which the rays are accumulated. If
None(the default),axis_surfacewill be used.normalized_field (bool) – A boolean flag indicating whether the field parameter is given in normalized or physical units.
normalized_pupil (bool) – A boolean flag indicating whether the pupil parameter is given in normalized or physical units.
- Return type:
See also
rayfunctionSimilar to raytrace except it only returns the rays at the last surface in local coordinates.
- spot_diagram(figsize=(8, 6), s=5, cmap=None)[source]#
Create a spot diagram of the rays at each field point to inspect the performance of this optical system.
- to_dxf(file, unit, transformation=None)#
- Parameters:
file (Path)
unit (Unit)
transformation (None | AbstractTransformation)
- to_string(prefix=None)#
Public-facing version of the
__repr__method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.
- abstract property axis_surface: str#
The name of the logical axis representing the sequence of surfaces.
- property field_max: AbstractCartesian2dVectorArray#
The upper right corner of this optical system’s field of view.
- property field_min: AbstractCartesian2dVectorArray#
The lower left corner of this optical system’s field of view.
- property field_stop: AbstractSurface#
The field stop surface.
- abstract property grid_input: ObjectVectorArray#
The input grid to sample with rays.
This grid is simultaneously projected onto both the field stop and the pupil stop.
Positions on the stop can be specified in either absolute or normalized coordinates. Using normalized coordinates allows for injecting different grid types (cylindrical, stratified random, etc.) without specifying the scale of the stop surface.
If positions are specified in absolute units, they are measured in the coordinate system of the corresponding stop surface.
- property index_field_stop: int#
The index of the field stop in
surfaces_all.
- property index_pupil_stop: int#
The index of the pupil stop in
surfaces_all.
- abstract property kwargs_plot: None | dict#
Extra keyword arguments that will be used in the call to
named_arrays.plt.plot()within theplot()method.
- abstract property object: AbstractSurface#
The external object being imaged or illuminated by this system.
If
None, the external object is assumed to be at infinity.
- property object_is_at_infinity: bool#
A boolean flag indicating if the object is at infinity.
If
objectdoesn’t have an aperture, it is assumed that the object is at infinity.
- property pupil_max#
The upper right corner of this optical system’s entrance pupil in physical units.
- property pupil_min: AbstractCartesian2dVectorArray#
The lower left corner of this optical system’s entrance pupil in physical units.
- property pupil_stop: AbstractSurface#
The pupil stop surface.
- property rayfunction_default: RayFunctionArray#
Computes the rays in local coordinates at the last surface in the system as a function of input wavelength and position using
grid_input.This property is cached to increase performance. If
grid_inputis updated, the cache must be cleared withdel system.rayfunction_defaultbefore calling this property.
- property rayfunction_stops: RayFunctionArray#
A rayfunction defined on the input surface of the optical system, which is designed to exactly strike the borders of both the field stop and the pupil stop.
- abstract property sensor: None | AbstractImagingSensor#
The imaging sensor that measures the light captured by this system.
This is the last surface in the optical system.
- abstract property surfaces: Sequence[AbstractSurface]#
A sequence of surfaces representing this optical system.
At least one of these surfaces needs to be marked as the pupil surface, and if the object surface is not marked as the field stop, one of these surfaces needs to be marked as the field stop.
- property surfaces_all: list[AbstractSurface]#
Concatenate
objectwithsurfacesinto a single list of surfaces.
- abstract property transformation: None | AbstractTransformation#
the coordinate transformation between the global coordinate system and this object’s local coordinate system