visisipy.analysis.mtf#

Calculate the modulation transfer function (MTF) of an eye model.

Classes#

SingleMTFResult

Result of the MTF analysis.

MTFResult

Result of the MTF analysis for multiple fields.

Functions#

fft_mtf(…)

Calculate the FFT Modulation Transfer Function (MTF).

Module Contents#

class visisipy.analysis.mtf.SingleMTFResult#

Result of the MTF analysis.

Attributes:
tangentialSeries

The tangential MTF.

sagittalSeries

The sagittal MTF.

tangential: pandas.Series#

The tangential MTF.

sagittal: pandas.Series#

The sagittal MTF.

class visisipy.analysis.mtf.MTFResult(dict=None, /, **kwargs)#

Bases: collections.UserDict[visisipy.types.FieldCoordinate, SingleMTFResult]

Result of the MTF analysis for multiple fields.

tangential(field: visisipy.types.FieldCoordinate | None = None) pandas.Series#

Get the tangential MTF for a specific field.

Parameters:
fieldFieldCoordinate, optional

The field coordinate for which to get the tangential MTF. If not specified, the tangential MTF for the single field will be returned. If multiple fields are present, a ValueError will be raised.

Returns:
Series

The tangential MTF for the specified field.

sagittal(field: visisipy.types.FieldCoordinate | None = None) pandas.Series#

Get the sagittal MTF for a specific field.

Parameters:
fieldFieldCoordinate, optional

The field coordinate for which to get the sagittal MTF. If not specified, the sagittal MTF for the single field will be returned. If multiple fields are present, a ValueError will be raised.

Returns:
Series

The sagittal MTF for the specified field.

visisipy.analysis.mtf.fft_mtf(model: visisipy.models.EyeModel | None = None, field_coordinate: visisipy.types.FieldCoordinate | Literal['all'] = 'all', field_type: visisipy.types.FieldType = 'angle', wavelength: float | None = None, sampling: visisipy.types.SampleSize | str | int = 128, maximum_frequency: float | Literal['default'] = 'default', *, return_raw_result: Literal[False] = False, backend: visisipy.backend.BaseBackend = _AUTOMATIC_BACKEND) MTFResult#
visisipy.analysis.mtf.fft_mtf(model: visisipy.models.EyeModel | None = None, field_coordinate: visisipy.types.FieldCoordinate | Literal['all'] = 'all', field_type: visisipy.types.FieldType = 'angle', wavelength: float | None = None, sampling: visisipy.types.SampleSize | str | int = 128, maximum_frequency: float | Literal['default'] = 'default', *, return_raw_result: Literal[True] = True, backend: visisipy.backend.BaseBackend = _AUTOMATIC_BACKEND) tuple[MTFResult, Any]

Calculate the FFT Modulation Transfer Function (MTF).

Parameters:
modelEyeModel | None

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

field_coordinateFieldCoordinate | Literal[“all”]

The field coordinate(s) at which the MTF is calculated. Can be a specific coordinate (e.g., (0, 0)) or “all” to calculate for all fields in the backend. Defaults to “all”.

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.

wavelengthfloat | None

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

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.

maximum_frequencyfloat | Literal[“default”]

The maximum frequency (in cycles per millimeter) to calculate the MTF up to. If “default”, the default maximum frequency is used by the backend. Defaults to “default”.

return_raw_resultbool, optional

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

backendBaseBackend, optional

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

Returns:
MTFResult

The MTF data as an MTFResult object, which provides access to the tangential and sagittal MTF values for each field coordinate.

Raises:
ValueError

If field_coordinate is not a valid FieldCoordinate or “all”.