Moment

class giant.point_spread_functions.moments.Moment(centroid_x=None, centroid_y=None, **kwargs)[source]

Bases: PointSpreadFunction

This class implements a moment based (center of illumination) algorithm for locating the centroid of a PSF.

This class implements a fully functional PSF object for GIANT, however, because it does not actually model how light is spread out, if applied to an image or scan lines it just returns the input unaltered. Also, since this isn’t actually an estimation, the covariance and residuals are undefined so these are always set to NaN.

Note:

This object can be biased toward the center of an image if it is applied naively. You must be careful in selecting which points to pass to this function.

Parameters:
  • centroid_x (float) – The x component of the centroid in pixels

  • centroid_y (float) – The y component of the centroid in pixels

save_residuals = 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 either before or after initialization.

centroid_x: float

The x location of the centroid

centroid_y: float

The y location of the centroid

property centroid: ndarray

The location of the center of the PSF as an (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).

Returns:

The (x, y) location of the peak of the PSF as a 1D numpy array

property residual_rss: Real | None

The rss of the residuals (undefined).

Returns:

NaN or None since this is undefined.

property residual_std: Real | None

The standard deviation of the residuals (undefined).

Returns:

NaN or None since this is undefined.

property covariance: Sequence | ndarray | None

The covariance of the fit (undefined).

Returns:

A 2x2 array of NaN or None since this is undefined.

Summary of Methods

fit

This function identifies the centroid of the PSF for the input data using a moment algorithm (center of illumination).

__call__

Just returns the input image as an array

apply_1d

Just returns the input scan lines as is.

evaluate

Returns an array of zeros the same shape of x/y.

generate_kernel

Returns a 3x3 array of zeros except the center which is one because this does nothing.