StarFinderCatalogBase#

class photutils.detection.StarFinderCatalogBase(data, xypos, kernel, *, n_brightest=None, peak_max=None)[source]#

Bases: object

Abstract base class for star finder catalogs.

This class provides common functionality for catalog classes that store and compute properties of detected sources. External packages may subclass it to create custom star finder catalogs.

Subclasses must implement:

  • x_centroid property – Object centroid in the x direction.

  • y_centroid property – Object centroid in the y direction.

  • apply_filters method – Filter the catalog using algorithm-specific criteria.

  • default_columns attribute – A tuple of column names used by to_table when no explicit columns are given. This should be set in the subclass __init__.

Subclasses may override:

  • _get_init_attributes – Return attribute names to copy during slicing. The override should include 'default_columns' in the returned tuple.

  • make_cutouts – Customize how cutout arrays are extracted.

  • cutout_data – Customize the cutouts used for photometry (e.g., zeroing negative pixels).

Parameters:
data2D ndarray

The 2D image. The image should be background-subtracted.

xyposNx2 ndarray

An Nx2 array of (x, y) pixel coordinates denoting the central positions of the stars.

kernel2D ndarray

A 2D array of the PSF kernel. Internally, the star finder classes may also pass a kernel object.

n_brightestint, None, optional

The number of brightest objects to keep after sorting the source list by flux. If n_brightest is set to None, all objects will be selected.

peak_maxfloat, None, optional

The maximum allowed peak pixel value in an object. Objects with peak pixel values greater than peak_max will be rejected. This keyword may be used, for example, to exclude saturated sources. If the star finder is run on an image that is a Quantity array, then peak_max must have the same units. If peak_max is set to None, then no peak pixel value filtering will be performed.

Attributes Summary

cutout_centroid

The cutout centroids.

cutout_data

The cutout data arrays.

cutout_x_centroid

The cutout x centroids.

cutout_y_centroid

The cutout y centroids.

flux

The instrumental fluxes.

fwhm

The FWHM of the sources.

isscalar

Whether the instance is scalar (e.g., a single source).

mag

The instrumental magnitudes.

moments

The raw image moments.

moments_central

The central image moments.

mu_diff

The difference of the central moments.

mu_sum

The sum of the central moments.

orientation

The angle between the x axis and the major axis of the 2D Gaussian function that has the same second-order moments as the source.

peak

The peak pixel values.

roundness

The roundness of the sources.

x_centroid

Object centroid in the x direction.

y_centroid

Object centroid in the y direction.

Methods Summary

apply_all_filters()

Apply all filters, select the brightest, and reset the source IDs.

apply_filters()

Filter the catalog.

make_cutouts(data)

Make cutouts from the data array.

reset_ids()

Reset the ID column to be consecutive integers.

select_brightest()

Sort the catalog by the brightest fluxes and select the top brightest sources.

to_table(*[, columns])

Create a QTable of catalog properties.

Attributes Documentation

cutout_centroid#

The cutout centroids.

cutout_data#

The cutout data arrays.

Subclasses may override this property to customize the cutouts used for moment-based photometry calculations (e.g., zeroing negative pixels or subtracting a local sky background).

cutout_x_centroid#

The cutout x centroids.

cutout_y_centroid#

The cutout y centroids.

flux#

The instrumental fluxes.

fwhm#

The FWHM of the sources.

isscalar#

Whether the instance is scalar (e.g., a single source).

mag#

The instrumental magnitudes.

moments#

The raw image moments.

moments_central#

The central image moments.

mu_diff#

The difference of the central moments.

mu_sum#

The sum of the central moments.

orientation#

The angle between the x axis and the major axis of the 2D Gaussian function that has the same second-order moments as the source.

The angle increases in the counter-clockwise direction and will be in the range [0, 360) degrees.

peak#

The peak pixel values.

roundness#

The roundness of the sources.

x_centroid#

Object centroid in the x direction.

This property must be implemented in subclasses.

y_centroid#

Object centroid in the y direction.

This property must be implemented in subclasses.

Methods Documentation

apply_all_filters()[source]#

Apply all filters, select the brightest, and reset the source IDs.

abstractmethod apply_filters()[source]#

Filter the catalog.

This method must be implemented in subclasses to apply algorithm-specific filtering criteria.

make_cutouts(data)[source]#

Make cutouts from the data array.

Parameters:
data2D ndarray

The 2D image array.

Returns:
cutouts3D ndarray

The cutout arrays.

reset_ids()[source]#

Reset the ID column to be consecutive integers.

select_brightest()[source]#

Sort the catalog by the brightest fluxes and select the top brightest sources.

to_table(*, columns=None)[source]#

Create a QTable of catalog properties.

Parameters:
columnslist of str, optional

List of column names to include in the table. If None, uses self.default_columns.

Returns:
tableQTable

A table of the catalog properties.