extract_stars

photutils.psf.extract_stars(data, catalogs, *, size=(11, 11))[source]

Extract cutout images centered on stars defined in the input catalog(s).

Stars where the cutout array bounds partially or completely lie outside of the input data image will not be extracted.

Parameters:
dataNDData or list of NDData

A NDData object or a list of NDData objects containing the 2D image(s) from which to extract the stars. If the input catalogs contain only the sky coordinates (i.e., not the pixel coordinates) of the stars then each of the NDData objects must have a valid wcs attribute.

catalogsTable, list of Table

A catalog or list of catalogs of sources to be extracted from the input data. To link stars in multiple images as a single source, you must use a single source catalog where the positions defined in sky coordinates.

If a list of catalogs is input (or a single catalog with a single NDData object), they are assumed to correspond to the list of NDData objects input in data (i.e., a separate source catalog for each 2D image). For this case, the center of each source can be defined either in pixel coordinates (in x and y columns) or sky coordinates (in a skycoord column containing a SkyCoord object). If both are specified, then the pixel coordinates will be used.

If a single source catalog is input with multiple NDData objects, then these sources will be extracted from every 2D image in the input data. In this case, the sky coordinates for each source must be specified as a SkyCoord object contained in a column called skycoord. Each NDData object in the input data must also have a valid wcs attribute. Pixel coordinates (in x and y columns) will be ignored.

Optionally, each catalog may also contain an id column representing the ID/name of stars. If this column is not present then the extracted stars will be given an id number corresponding the the table row number (starting at 1). Any other columns present in the input catalogs will be ignored.

sizeint or array_like (int), optional

The extraction box size along each axis. If size is a scalar then a square box of size size will be used. If size has two elements, they must be in (ny, nx) order. size must have odd values and be greater than or equal to 3 for both axes.

Returns:
starsEPSFStars instance

A EPSFStars instance containing the extracted stars.