ImagingSensor#
- class optika.sensors.ImagingSensor(name=None, width_pixel=<Quantity 0. um>, axis_pixel=None, num_pixel=None, timedelta_exposure=<Quantity 0. s>, material=None, aperture_mechanical=None, is_field_stop=False, is_pupil_stop=False, transformation=None, kwargs_plot=None)[source]#
Bases:
AbstractImagingSensorAn arbitrary imaging sensor described by a pixel grid and a light-sensitive material.
Attributes
The light-sensitive aperture of the sensor.
The shape of the physical substrate supporting the sensor.
The names of the logical axes corresponding to the rows and columns of the pixel grid.
A flag controlling whether this sensor is the field stop for the system.
A flag controlling whether this sensor is the pupil stop for the system.
If this surface is pupil stop or the field stop, return
True.Extra keyword arguments to pass to
plot()A model of the light-sensitive material composing this sensor.
The human-readable name of this sensor.
The number of pixels along each axis of the sensor.
The optional ruling profile of this surface.
The sag profile of this surface.
The array shape of this object.
The exposure time of the sensor.
The position and orientation of the sensor in the global coordinate system.
The physical size of each pixel on the sensor.
Methods
__init__([name, width_pixel, axis_pixel, ...])collect(rays, wavelength[, axis, where])Bin a cloud of rays onto the pixel grid.
expose(image[, direction, axis_wavelength, ...])Convert a per-pixel photon image into the electrons measured by the sensor.
measure(rays, wavelength[, axis, ...])Bin a set of rays onto the pixel grid and convert them to the electrons measured by the sensor.
plot([ax, transformation, components])Plot the selected components onto the given axes.
propagate_rays(rays)Refract, reflect, and/or diffract the given rays off of this surface
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

- Parameters:
name (None | str)
width_pixel (Quantity | AbstractCartesian2dVectorArray)
axis_pixel (Cartesian2dVectorArray[str, str])
num_pixel (Cartesian2dVectorArray[int, int])
timedelta_exposure (Quantity | AbstractScalar)
material (AbstractSensorMaterial)
aperture_mechanical (RectangularAperture)
is_field_stop (bool)
is_pupil_stop (bool)
transformation (None | AbstractTransformation)
kwargs_plot (None | dict)
- collect(rays, wavelength, axis=None, where=True)#
Bin a cloud of rays onto the pixel grid.
Returns the per-pixel photon image (the binned ray intensity) and the flux-weighted mean cosine of the refracted angle inside the light-sensitive region in each pixel: the two quantities
expose()needs. Refracting each ray here (with its own ambient index of refraction) and binning the result is what letsexpose()and the material’ssignal()model be shared with systems that have no rays, without threading a separate ambient-index argument through them.- Parameters:
rays (RayVectorArray) – A set of incident rays in local coordinates to bin.
wavelength (AbstractScalar) – The edges of the wavelength bins to sample.
axis (None | str | Sequence[str]) – The logical axes along which to collect photons.
where (bool | AbstractScalar) – A boolean mask used to indicate which rays should be considered.
- Return type:
tuple[FunctionArray[SpectralPositionalVectorArray, AbstractScalar], AbstractScalar]
- expose(image, direction=1, axis_wavelength=None, timedelta=None, noise=True)#
Convert a per-pixel photon image into the electrons measured by the sensor.
This is the detector-physics step shared by every optical system: it operates on a pixel grid (a photon image plus a refracted-cosine map), so it can be driven by
collect()for a ray-traced system, or by any model that produces a per-pixel photon image directly.The photon flux is multiplied by the exposure time and converted to electrons using
signal(), which applies the quantum efficiency, noise, and charge-diffusion models.- Parameters:
image (FunctionArray[SpectralPositionalVectorArray, AbstractScalar]) – The expected photon flux incident on each pixel, as a function of wavelength and pixel position. The wavelength inputs (
image.inputs.wavelength) must be the bin edges, not the centers.direction (float | AbstractScalar) – The cosine of the refracted angle inside the light-sensitive region in each pixel, as produced by
collect().axis_wavelength (None | str) – The logical axis of image corresponding to changing wavelength. If
None(the default),image.inputs.wavelengthmust have only one logical axis.timedelta (None | Quantity | AbstractScalar) – The exposure time of the measurement. If
None(the default), the value intimedelta_exposurewill be used.noise (bool) – Whether to add shot noise and intrinsic sensor noise to the result.
- Return type:
FunctionArray[SpectralPositionalVectorArray, AbstractScalar]
- measure(rays, wavelength, axis=None, axis_wavelength=None, where=True, timedelta=None, noise=True)#
Bin a set of rays onto the pixel grid and convert them to the electrons measured by the sensor.
This composes
collect()(gather rays into the pixel grid) withexpose()(apply the detector physics).- Parameters:
rays (RayVectorArray) – A set of incident rays in local coordinates to measure.
wavelength (AbstractScalar) – The edges of the wavelength bins to sample.
axis (None | str | Sequence[str]) – The logical axes along which to collect photons.
axis_wavelength (None | str) – The logical axis of wavelength corresponding to changing wavelength coordinate, forwarded to
expose(). IfNone(the default), wavelength must have only one logical axis.where (bool | AbstractScalar) – A boolean mask used to indicate which rays should be considered.
timedelta (None | Quantity | AbstractScalar) – The exposure time of the measurement. If
None(the default), the value intimedelta_exposurewill be used.noise (bool) – Whether to add shot noise and intrinsic sensor noise to the result.
- Return type:
FunctionArray[SpectralPositionalVectorArray, AbstractScalar]
- plot(ax=None, transformation=None, components=None, **kwargs)#
Plot the selected components onto the given axes.
- Parameters:
ax (None | Axes | ScalarArray[ndarray[tuple[Any, ...], dtype[_ScalarT]]]) – The matplotlib axes to plot onto
transformation (None | AbstractTransformation) – Any extra transformations to apply to the coordinate system before plotting
components (None | tuple[str, ...]) – Which 3d components to plot, helpful if plotting in 2d.
kwargs – Additional keyword arguments that will be passed along to
named_arrays.plt.plot()
- Return type:
- propagate_rays(rays)#
Refract, reflect, and/or diffract the given rays off of this surface
- Parameters:
rays (RayVectorArray) – A set of input rays that will interact with this surface.
- Return type:
- 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.
- property aperture#
The light-sensitive aperture of the sensor.
- aperture_mechanical: RectangularAperture = None#
The shape of the physical substrate supporting the sensor.
- axis_pixel: Cartesian2dVectorArray[str, str] = None#
The names of the logical axes corresponding to the rows and columns of the pixel grid.
- is_field_stop: bool = False#
A flag controlling whether this sensor is the field stop for the system.
- is_pupil_stop: bool = False#
A flag controlling whether this sensor is the pupil stop for the system.
- material: AbstractSensorMaterial = None#
A model of the light-sensitive material composing this sensor.
If
None(the default),optika.sensors.IdealImagingSensorwill be used.
- num_pixel: Cartesian2dVectorArray[int, int] = None#
The number of pixels along each axis of the sensor.
- property sag: AbstractSag#
The sag profile of this surface.
- timedelta_exposure: Quantity | AbstractScalar = <Quantity 0. s>#
The exposure time of the sensor.
- transformation: None | AbstractTransformation = None#
The position and orientation of the sensor in the global coordinate system.
- width_pixel: Quantity | AbstractCartesian2dVectorArray = <Quantity 0. um>#
The physical size of each pixel on the sensor.