visisipy.analysis.psf#

Calculate the point spread function (PSF) of the eye.

Functions#

fft_psf(…)

Calculate the FFT Point Spread Function (PSF) at the retina surface.

huygens_psf(…)

Calculate the Huygens Point Spread Function (PSF) at the retina surface.

strehl_ratio(…)

Calculate the Strehl ratio of the optical system.

Module Contents#

visisipy.analysis.psf.fft_psf(model: visisipy.EyeModel | None = None, field_coordinate: visisipy.types.FieldCoordinate | None = None, wavelength: float | None = None, field_type: visisipy.types.FieldType = 'angle', sampling: visisipy.types.SampleSize | str | int = 128, *, return_raw_result: Literal[False] = False, backend: visisipy.backend.BaseBackend = _AUTOMATIC_BACKEND) pandas.DataFrame#
visisipy.analysis.psf.fft_psf(model: visisipy.EyeModel | None = None, field_coordinate: visisipy.types.FieldCoordinate | None = None, wavelength: float | None = None, field_type: visisipy.types.FieldType = 'angle', sampling: visisipy.types.SampleSize | str | int = 128, *, return_raw_result: Literal[True] = True, backend: visisipy.backend.BaseBackend = _AUTOMATIC_BACKEND) tuple[pandas.DataFrame, Any]

Calculate the FFT Point Spread Function (PSF) at the retina surface.

Parameters:
modelEyeModel | None

The eye model to be used in the ray trace. If None, the current eye model will be used.

field_coordinateFieldCoordinate | None

The field coordinate at which the PSF is calculated. If None, the first field coordinate in the backend is used.

wavelengthfloat | None

The wavelength at which the PSF is calculated. If None, the first wavelength in the backend is used.

field_typeFieldType

The field type to be used in the analysis. Can be either “angle” or “object_height”. Defaults to “angle”. This parameter is only used when field_coordinate is specified.

samplingSampleSize | str | int

The size of the ray grid used to sample the pupil. Can be an integer or a string in the format “NxN”, where N is an integer. Only symmetric sample sizes are supported. Defaults to 128.

return_raw_resultbool, optional

Return the raw analysis result from the backend. Defaults to False.

backendBaseBackend

The backend to be used for the analysis. If not provided, the default backend is used.

Returns:
DataFrame

The PSF data as a DataFrame. The DataFrame contains the PSF values at the specified field coordinate and wavelength.

visisipy.analysis.psf.huygens_psf(model: visisipy.EyeModel | None = None, field_coordinate: visisipy.types.FieldCoordinate | None = None, wavelength: float | None = None, field_type: visisipy.types.FieldType = 'angle', pupil_sampling: visisipy.types.SampleSize | str | int = 128, image_sampling: visisipy.types.SampleSize | str | int = 128, *, return_raw_result: Literal[False] = False, backend: visisipy.backend.BaseBackend = _AUTOMATIC_BACKEND) pandas.DataFrame#
visisipy.analysis.psf.huygens_psf(model: visisipy.EyeModel | None = None, field_coordinate: visisipy.types.FieldCoordinate | None = None, wavelength: float | None = None, field_type: visisipy.types.FieldType = 'angle', pupil_sampling: visisipy.types.SampleSize | str | int = 128, image_sampling: visisipy.types.SampleSize | str | int = 128, *, return_raw_result: Literal[True] = True, backend: visisipy.backend.BaseBackend = _AUTOMATIC_BACKEND) tuple[pandas.DataFrame, Any]

Calculate the Huygens Point Spread Function (PSF) at the retina surface.

Parameters:
modelEyeModel | None

The eye model to be used in the analysis. If None, the current eye model will be used.

field_coordinateFieldCoordinate | None

The field coordinate at which the PSF is calculated. If None, the first field coordinate in the backend is used.

wavelengthfloat | None

The wavelength at which the PSF is calculated. If None, the first wavelength in the backend is used.

field_typeFieldType

The field type to be used in the analysis. Can be either “angle” or “object_height”. Defaults to “angle”. This parameter is only used when field_coordinate is specified.

pupil_samplingSampleSize | str | int

The size of the ray grid used to sample the pupil. Can be an integer or a string in the format “NxN”, where N is an integer. Only symmetric sample sizes are supported. Defaults to 128.

image_samplingSampleSize | str | int

The size of the PSF grid. Can be an integer or a string in the format “NxN”, where N is an integer. Only symmetric sample sizes are supported. Defaults to 128.

return_raw_resultbool, optional

Return the raw analysis result from the backend. Defaults to False.

backendBaseBackend

The backend to be used for the analysis. If not provided, the default backend is used.

Returns:
DataFrame

The PSF data as a DataFrame. The DataFrame contains the PSF values at the specified field coordinate and wavelength.

visisipy.analysis.psf.strehl_ratio(model: visisipy.EyeModel | None = None, field_coordinate: visisipy.types.FieldCoordinate | None = None, wavelength: float | None = None, field_type: visisipy.types.FieldType = 'angle', sampling: visisipy.types.SampleSize | str | int = 128, psf_type: Literal['fft', 'huygens'] = 'huygens', *, return_raw_result: Literal[False] = False, backend: visisipy.backend.BaseBackend = _AUTOMATIC_BACKEND) float#
visisipy.analysis.psf.strehl_ratio(model: visisipy.EyeModel | None = None, field_coordinate: visisipy.types.FieldCoordinate | None = None, wavelength: float | None = None, field_type: visisipy.types.FieldType = 'angle', sampling: visisipy.types.SampleSize | str | int = 128, psf_type: Literal['fft', 'huygens'] = 'huygens', *, return_raw_result: Literal[True] = True, backend: visisipy.backend.BaseBackend = _AUTOMATIC_BACKEND) tuple[float, Any]

Calculate the Strehl ratio of the optical system.

The Strehl ratio is calculated from the point spread function. Which PSF is used depends on the psf_type parameter.

Parameters:
modelEyeModel | None

The eye model to be used in the ray trace. If None, the current eye model will be used.

field_coordinateFieldCoordinate | None

The field coordinate at which the Strehl ratio is calculated. If None, the first field coordinate in the backend is used.

wavelengthfloat | None

The wavelength at which the Strehl ratio is calculated. If None, the first wavelength in the backend is used.

field_typeFieldType

The field type to be used in the analysis. Can be either “angle” or “object_height”. Defaults to “angle”. This parameter is only used when field_coordinate is specified.

samplingSampleSize | str | int

The size of the ray grid used to sample the pupil. Can be an integer or a string in the format “NxN”, where N is an integer. Only symmetric sample sizes are supported. Defaults to 128.

psf_typeLiteral[“fft”, “huygens”]

The type of PSF to be used for the Strehl ratio calculation. Can be either “fft” or “huygens”. Defaults to “huygens”. Not all psf types are supported by all backends.

return_raw_resultbool, optional

Return the raw analysis result from the backend. Defaults to False.

backendBaseBackend

The backend to be used for the analysis. If not provided, the default backend is used.

Returns:
float

The Strehl ratio of the optical system at the specified field coordinate and wavelength.

Any

The raw analysis result from the backend.

Raises:
ValueError

If psf_type is not “fft” or “huygens”.