opticks.imaging_model.optics
Classes
|
Class containing generic Optics parameters. |
- class Optics(**data)[source]
Class containing generic Optics parameters.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
name (str)
focal_length (Annotated[Quantity, BeforeValidator(func=~opticks.utils.parser_helpers._parse_quantity, json_schema_input_type=PydanticUndefined), AfterValidator(func=~opticks.utils.parser_helpers._validate_positive_quantity), PlainSerializer(func=~opticks.utils.parser_helpers._serialize_quantity, return_type=str, when_used=always)])
aperture_diameter (Annotated[Quantity, BeforeValidator(func=~opticks.utils.parser_helpers._parse_quantity, json_schema_input_type=PydanticUndefined), AfterValidator(func=~opticks.utils.parser_helpers._validate_positive_quantity), PlainSerializer(func=~opticks.utils.parser_helpers._serialize_quantity, return_type=str, when_used=always)])
image_diam_on_focal_plane (Annotated[Quantity, BeforeValidator(func=~opticks.utils.parser_helpers._parse_quantity, json_schema_input_type=PydanticUndefined), AfterValidator(func=~opticks.utils.parser_helpers._validate_positive_quantity), PlainSerializer(func=~opticks.utils.parser_helpers._serialize_quantity, return_type=str, when_used=always)])
pupil_functs (dict[str, PupilFunction])
aperture_dx (Quantity | None)
aperture (Aperture | None)
- add_mono_pupil_function(name, wavelength, opd=None)[source]
Create a monochromatic PupilFunction and register it.
- Return type:
- Parameters:
name (
str) – identifier for this pupil functionwavelength (
Quantity) – wavelength of light (in microns)opd (
OptPathDiff, optional) – optical path difference (in nm), or None for zero phase
- Returns:
PupilFunction– the created PupilFunction for convenience
- add_poly_pupil_function(name, wavelengths, opds, spectral_weights=None)[source]
Create a polychromatic PupilFunction and register it.
- Return type:
- Parameters:
name (
str) – identifier for this pupil functionwavelengths (
Quantity) – wavelengths array (in microns)opds (
list[OptPathDiff | None]) – list of optical path differences (in nm), one per wavelengthspectral_weights (
np.ndarray, optional) – spectral weight of each wavelength, by default uniform
- Returns:
PupilFunction– the created PupilFunction for convenience
- aperture_diameter: Annotated[Quantity, BeforeValidator(func=_parse_quantity, json_schema_input_type=PydanticUndefined), AfterValidator(func=_validate_positive_quantity), PlainSerializer(func=_serialize_quantity, return_type=str, when_used=always)]
- compute_psf(pupil_name, psf_dx, psf_samples=512, wvl_ref=None, with_units=True)[source]
Compute PSF for the named PupilFunction (caches + returns).
- Return type:
RichData- Parameters:
pupil_name (
str) – identifier of the pupil functionpsf_dx (
Quantity) – sample distance of the output PSF plane grid (in microns)psf_samples (
int, optional) – number of samples in the output plane, by default 512wvl_ref (
WvlRef, optional) – reference wavelength selector for output metadatawith_units (
bool, optional) – output the PSF with or without units, by default True
- Returns:
RichData– PSF model
- field_mtf_model_1d(field_model, h, wavelength)[source]
Aberrated 1D MTF at normalised field position h (Tier B path).
Uses the Seidel model to compute the total RMS WFE at the given field position and feeds it into the empirical ATF model.
- Return type:
- Parameters:
- Returns:
MTF_Model_1D– Aberrated 1D MTF model at the given field position
- focal_length: Annotated[Quantity, BeforeValidator(func=_parse_quantity, json_schema_input_type=PydanticUndefined), AfterValidator(func=_validate_positive_quantity), PlainSerializer(func=_serialize_quantity, return_type=str, when_used=always)]
- property full_optical_fov: Quantity
Full optical Field of View.
Actual FoV depends on the detector size, but cannot be wider than this value.
- get_pupil_function(name)[source]
Retrieve a named PupilFunction.
- Return type:
- Parameters:
name (
str) – identifier of the pupil function- Returns:
PupilFunction– the requested PupilFunction
- image_diam_on_focal_plane: Annotated[Quantity, BeforeValidator(func=_parse_quantity, json_schema_input_type=PydanticUndefined), AfterValidator(func=_validate_positive_quantity), PlainSerializer(func=_serialize_quantity, return_type=str, when_used=always)]
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- mtf(pupil_name)[source]
Return MTF derived from cached PSF for the named PupilFunction.
Lazily computed on first access; cached until PSF is recomputed.
- Return type:
RichData- Parameters:
pupil_name (
str) – identifier of the pupil function- Returns:
RichData– MTF model- Raises:
ValueError – if compute_psf() has not been called yet
- normalised_field_from_angle(theta_x, theta_y)[source]
Convert a field angle to normalised field coordinates.
Maps a (theta_x, theta_y) field angle (relative to the optical axis) to dimensionless field coordinates
(H_x, H_y)in[-1, 1], whereH = 1corresponds to the edge of the full optical field of view.
- normalised_field_from_focal_plane_xy(x, y)[source]
Convert a focal-plane position to normalised field coordinates.
Maps a focal-plane location
(x, y)(relative to the optical axis intercept) to dimensionless field coordinates(H_x, H_y)in[-1, 1], using the image diameter on the focal plane to setH = 1.
- psf(pupil_name)[source]
Return cached PSF for the named PupilFunction.
- Return type:
RichData- Parameters:
pupil_name (
str) – identifier of the pupil function- Returns:
RichData– cached PSF model- Raises:
ValueError – if compute_psf() has not been called yet
- pupil_functs: dict[str, PupilFunction]
- set_aperture_model(aperture=None, samples=400)[source]
Sets the aperture model for the optics.
The aperture model is as defined by prysm, it contains an ndarray grid of True and False data, where True allows light through. It can also be an ndarray grid of 0 and 1 (and anything in between).
If None, a new circular aperture is defined using the aperture diameter of the optics and the samples parameter (for one side of the square grid). If an aperture is defined, samples is ignored.
Grid is optional and is added only when a new aperture is defined
- spatial_cutoff_freq(ref_wavelength)[source]
Spatial cut-off frequency, assumes perfect incoherent optics.
Determines the theoretical limit of the optical resolution, or the smallest object resolvable by the optical system.
Computed as: 1/(wavelength x F#) in cycles per mm
- Return type:
- Parameters:
ref_wavelength (
Quantity) – Reference wavelength- Returns:
Quantity– Spatial cutoff frequency (in cycles/mm)
- to_MTF_Model_1D(pupil_name, slice)[source]
Convert the cached 2D MTF to a 1D MTF model for the named PupilFunction.
- Return type:
- Parameters:
- Returns:
MTF_Model_1D– 1D MTF model- Raises:
ValueError – if compute_psf() has not been called yet