create_image_handlers

one_pass_fitting.create_image_handlers(images: list[str], catalogs: list[list] = []) list[ImageHandler]

Create a list of ImageHandler-like objects, to be used for catalog merging.

This function takes a list of image filenames and, optionally, a list of corresponding input catalogs. It processes the images and their catalogs, and turns them into ImageHandler-like objects. If no input catalogs are provided, the function will attempt to find them using the find_catalogs function. For more documentation on ImageHandler, see the data_handlers package documentation.

Parameters:

imageslist of str, ImageModel, or HDUList

A list of image filenames, `ImageModel`s, or `HDUList`s for which to create a final catalog.

catalogslist of lists of astropy.table.Table, optional

A list of input catalogs corresponding to the images (default is an empty list).

Returns:

list of ImageHandler subclasses

A list of all the ImageHandler subclass objects created for the input images and their catalogs

Notes:

This function processes a list of images and their corresponding catalogs, and produces a list of ImageHandlers. It first checks if input catalogs are provided; if not, it uses the find_catalogs function to attempt to locate them. find_catalogs requires the catalogs to be named specifically with the suffix _sci<X>_xyrd.cat replacing the .fits (where <X> corresponds to the number of the science extension, i.e. idny01a1q_flc_sci1_xyrd.cat corresponding to extension `idny01a1q_flc.fits[SCI, 1] )

After loading image catalogs into ImageHandler objects, you can apply corrections to the catalogs, such as aperture corrections, if necessary. Then, the corrected catalogs can be combined into a final output catalog using merge_catalogs.

Example:

To create a final catalog from a list of images, you can use this function as follows:

>>> image_files = ["image1.fits", "image2.fits"]
# Note how one image can have multiple SCI extensions, and thus multiple catalogs (e.g. WFC3/UVIS)
>>> catalogs = [["image1_sci1_xyrd.cat", "image1_sci2_xyrd.cat"], ["image2_sci1_xyrd.cat"]]
>>> im_handlers =  = create_image_handlers(images=image_files, catalogs=catalogs)
>>> final_catalog = merge_catalogs(im_handlers, match_size=0.5)