visisipy.opticstudio.analysis.psf#
PSF analyses for OpticStudio.
Functions#
|
Calculate the FFT Point Spread Function (PSF) at the retina surface. |
|
Calculate the Huygens Point Spread Function (PSF) at the retina surface. |
|
Calculate the Strehl ratio of the optical system. |
Module Contents#
- visisipy.opticstudio.analysis.psf.fft_psf(backend: visisipy.opticstudio.OpticStudioBackend, field_coordinate: visisipy.types.FieldCoordinate | None = None, wavelength: float | None = None, field_type: visisipy.types.FieldType = 'angle', sampling: visisipy.types.SampleSize | str | int = 128) tuple[pandas.DataFrame, pandas.DataFrame]#
Calculate the FFT Point Spread Function (PSF) at the retina surface.
- Parameters:
- backendOpticStudioBackend
Reference to the OpticStudio backend.
- field_coordinatetuple[float, float], optional
The field coordinate (x, y) in mm. If None, the first field in OpticStudio is used. Defaults to None.
- wavelengthfloat, optional
The wavelength in μm. If None, the first wavelength in OpticStudio is used. Defaults to None.
- field_typeLiteral[“angle”, “object_height”], optional
The field type. Either “angle” or “object_height”. Defaults to “angle”. This parameter is only used if field_coordinate is not None.
- samplingSampleSize | str | int, optional
The size of the ray grid used to sample the pupil, either string (e.g. ‘32x32’) or int (e.g. 32). Defaults to 128.
- Returns:
- DataFrame
The PSF data as a pandas DataFrame.
- DataFrame
The raw PSF data from OpticStudio as a pandas DataFrame.
- Raises:
- ValueError
If the FFT PSF analysis fails or returns no data.
- visisipy.opticstudio.analysis.psf.huygens_psf(backend: visisipy.opticstudio.OpticStudioBackend, 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) tuple[pandas.DataFrame, zospy.analyses.psf.huygens_psf.HuygensPSFResult]#
Calculate the Huygens Point Spread Function (PSF) at the retina surface.
- Parameters:
- backendOpticStudioBackend
Reference to the OpticStudio backend.
- field_coordinatetuple[float, float], optional
The field coordinate (x, y) in mm. If None, the first field in OpticStudio is used. Defaults to None.
- wavelengthfloat, optional
The wavelength in μm. If None, the first wavelength in OpticStudio is used. Defaults to None.
- field_typeLiteral[“angle”, “object_height”], optional
The field type. Either “angle” or “object_height”. Defaults to “angle”. This parameter is only used if field_coordinate is not None.
- pupil_samplingSampleSize | str | int, optional
The size of the ray grid used to sample the pupil, either string (e.g. ‘32x32’) or int (e.g. 32). Defaults to 128.
- image_samplingSampleSize | str | int, optional
The size of the PSF grid, either string (e.g. ‘32x32’) or int (e.g. 32). Defaults to 128.
- Returns:
- DataFrame
The PSF data as a pandas DataFrame.
- HuygensPSFData
The Huygens PSF result from OpticStudio.
- visisipy.opticstudio.analysis.psf.strehl_ratio(backend: visisipy.opticstudio.OpticStudioBackend, 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') tuple[float, zospy.analyses.psf.huygens_psf.HuygensPSFResult]#
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:
- backendOpticStudioBackend
Reference to the OpticStudio backend.
- field_coordinateFieldCoordinate | None
The field coordinate at which the Strehl ratio is calculated. If None, the first field coordinate in OpticStudio is used.
- wavelengthfloat | None
The wavelength at which the Strehl ratio is calculated. If None, the first wavelength in OpticStudio 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. 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”; OpticStudio’s FFT PSF does not support calculating the Strehl ratio, so only “huygens” is supported.
- Returns:
- float
The Strehl ratio of the optical system at the specified field coordinate and wavelength.
- HuygensPSFResult
The PSF object used to calculate the Strehl ratio. The type of the object depends on the psf_type parameter.