find_catalogs

one_pass_fitting.data_handlers.find_catalogs(image: str) list[Table]

For a given FITS image, return a list of Astropy Tables representing catalogs for each science extension.

Parameters

imagestr

The path to the FITS image file.

Returns

list of astropy.table.Table

A list containing Astropy Tables, each representing a catalog for a science extension in the input image. Each of the returned tables also contains the “sci_ext” key in the table’s metadata dictionary, which is an integer corresponding to the science extension of the catalog.

Notes

The function looks for catalog files associated with the input image by searching for files with names following the pattern {image_root}_sci?_xyrd.cat or {image_root}_sci?_xyrd*.ecsv, where ? represents a single character wildcard and {image_root} is the name of the image with the .fits extension removed from the name. DO NOT have both a .cat and .ecsv file for the same catalog in the directory as the image as this could potentially give quite confusing results.

Examples

>>> image_path = 'path/to/image1.fits'
>>> catalogs = find_catalogs(image_path)
>>> for catalog in catalogs:
...     print(catalog)
>>> # prints "path/to/image1_sci1_xyrd.cat" (or .ecsv for JWST)
>>> # "path/to/image1_sci2_xyrd.cat" (If image is an HST file with multiple SCI exts)