eloy.centroid#

Centroiding utilities for astronomical images.

This module provides functions to compute centroids of sources in images using photutils, with robust handling of edge cases.

Attributes#

Functions#

photutils_centroid(data, coords[, cutout, centroid_fun])

Compute centroids for a list of coordinates using photutils.

ballet_centroid(data, coords, cnn[, nans])

Compute centroids for sources using a CNN-based model.

Module Contents#

eloy.centroid.default_centroid_func[source]#
eloy.centroid.photutils_centroid(data, coords, cutout=21, centroid_fun=None)[source]#

Compute centroids for a list of coordinates using photutils.

Parameters:
  • data (np.ndarray) – 2D image data.

  • coords (np.ndarray) – Array of (x, y) coordinates.

  • cutout (int, optional) – Size of the cutout box for centroiding.

  • centroid_fun (callable or None) – Centroiding function to use.

Returns:

Array of centroid coordinates.

Return type:

np.ndarray

eloy.centroid.ballet_centroid(data, coords, cnn, nans=False)[source]#

Compute centroids for sources using a CNN-based model.

Parameters:
  • data (np.ndarray) – 2D image data.

  • coords (np.ndarray) – Array of (x, y) coordinates for sources.

  • cnn (object) – CNN model with a centroid method that accepts cutouts.

  • nans (bool, optional) – If True, NaN values in the output will be replaced with the original coordinates.

Returns:

Array of refined centroid coordinates.

Return type:

np.ndarray