PointSpreadFunction

class giant.point_spread_functions.psf_meta.PointSpreadFunction[source]

This abstract base class serves as the template for implementing a point spread function in GIANT.

A point spread function models how a camera spreads out a point source of light across multiple pixels in an image. GIANT uses PSFs both for making rendered templates more realistic for correlation in relative_opnav and for centroiding of stars and unresolved bodies for center finding (unresolved), attitude estimation (stellar_opnav), and camera calibration (calibration).

In general, a PSF class is assigned to the ImageProcessing.psf attribute and an initialized version of the class is assigned to the Camera.psf attribute. GIANT will then use the specified PSF wherever it is needed. For more details refer to the point_spread_functions package documentation.

This class serves as a prototype for implementing a PSF in GIANT. It defines all the interfaces that GIANT expects for duck typing as abstract methods and properties to help you know you’ve implemented everything you need.

Note

Because this is an ABC, you cannot create an instance of this class (it will raise a TypeError)

save_residuals: bool = False

This class attribute specifies whether to save the residuals when fitting the specified PSF to data.

Saving the residuals can be important for in depth analysis but can use a lot of space when many fits are being performed and stored so this defaults to off. To store the residuals simply set this to True before initialization.

abstract property centroid: ndarray

This should return the centroid or peak of the initialized PSF as a x, y length 2 numpy array.

This property is used to enable the PSF class to be used in identifying the center of illumination in image processing (see ImageProcessing.centroiding).

abstract property residual_rss: float | None

This should return residual sum of squares (RSS) of the post-fit residuals from fitting this PSF to the data.

If the PSF is not the result of a fit or the save_residuals is False this will return None.

abstract property residual_std: float | None

This should return the standard deviation of the post-fit residuals from fitting this PSF to the data.

If the PSF is not the result of a fit or the save_residuals is False this will return None.

abstract property covariance: ndarray | None

This should return the formal covariance of the PSF parameters (if the PSF was fit and not initialized).

If the PSF is not the result of a fit or the save_residuals is False this will return None.

Summary of Methods

fit

This function fits the defined PSF to the input data and returns an initialize version of the class based on the fit.

__call__

Point spread functions are callable on images and should apply the stored PSF to the image and return the result.

apply_1d

Applies the defined PSF using the stored parameters to the 1D image scans provided.

evaluate

This method evaluates the PSF at the given x and y.

generate_kernel

Generates a square kernel centered at the centroid of the PSF normalized to have a volume (sum) of 1.