StarFinderCatalogBase#
- class photutils.detection.StarFinderCatalogBase(data, xypos, kernel, *, n_brightest=None, peak_max=None)[source]#
Bases:
objectAbstract 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_centroidproperty: the object centroid in the x direction.y_centroidproperty: the object centroid in the y direction.apply_filtersmethod: filter the catalog using algorithm-specific criteria.default_columnsattribute: a tuple of column names used byto_tablewhen 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
ndarrayorQuantity 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. The positions are rounded to the nearest pixel.
- 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_brightestis set toNone, 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_maxwill be rejected. This keyword may be used, for example, to exclude saturated sources. If the star finder is run on an image that is aQuantityarray, thenpeak_maxmust have the same units. Ifpeak_maxis set toNone, then no peak pixel value filtering will be performed.
- data2D
Attributes Summary
The centroids within the cutouts as an Nx2 array in
(y, x)order.The cutout data arrays.
The cutout x centroids.
The cutout y centroids.
The instrumental fluxes.
The FWHM of the sources.
Whether the instance is scalar (e.g., a single source).
The instrumental magnitudes.
The raw image moments.
The central image moments up to second order, normalized by the zeroth raw moment (the total cutout flux).
The difference of the second-order central moments in x and y (x minus y).
The sum of the second-order central moments in x and y.
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 peak pixel values.
The roundness of the sources, computed from the second-order central moments.
Object centroid in the x direction.
Object centroid in the y direction.
Methods Summary
Apply all filters, select the brightest, and reset the source IDs.
Filter the catalog.
make_cutouts(data)Make cutouts from the data array.
Reset the ID column to be consecutive integers.
Select the
n_brightestsources with the largest fluxes.to_table(*[, columns])Create a QTable of catalog properties.
Attributes Documentation
- cutout_data[source]#
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).
- moments_central[source]#
The central image moments up to second order, normalized by the zeroth raw moment (the total cutout flux).
- orientation[source]#
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 counterclockwise direction and is in the range (-90, 90] degrees.
- roundness[source]#
The roundness of the sources, computed from the second-order central moments.
The value is 0 for a circular source and approaches 1 for a highly elongated source.
- 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.
- Returns:
- catalog
StarFinderCatalogBaseorNone The filtered catalog, or
Noneif no sources pass the filters.
- catalog
- abstractmethod apply_filters()[source]#
Filter the catalog.
This method must be implemented in subclasses to apply algorithm-specific filtering criteria.
- Returns:
- catalog
StarFinderCatalogBaseorNone The filtered catalog, or
Noneif no sources remain.
- catalog
- select_brightest()[source]#
Select the
n_brightestsources with the largest fluxes.- Returns:
- catalog
StarFinderCatalogBase A new catalog of the
n_brightestsources sorted by decreasing flux. Ifn_brightestisNone, the catalog itself is returned unchanged. The source IDs are not reset.
- catalog
- to_table(*, columns=None)[source]#
Create a QTable of catalog properties.
- Parameters:
- columnsstr or list of str, optional
Names of column(s) to include in the table. If
None, usesself.default_columns. The valid names are'id', the names indefault_columns, and the cached source properties.
- Returns:
- table
QTable A table of the catalog properties.
- table
- Raises:
- ValueError
If any name in
columnsis not a valid (or deprecated) column name.