Catalogο
- class Catalog[source]ο
Catalog class for handling source catalog data.
This class is designed to handle source catalog data from a FITS file. It automatically loads the corresponding target image from the FITS file.
- __init__(path, catalog_type='all', info=None, load=True)[source]ο
Initialize the Catalog instance.
- Parameters:
path (Union[Path, str]) β Path to the catalog file.
catalog_type (str, optional) β Catalog type. Default is βallβ. [βallβ, βreferenceβ, βvalidβ, βtransientβ, βforcedβ]
info (Info, optional) β Info object. Default is None.
load (bool, optional) β Whether to load the catalog data. Default is True.
Methodsο
- select_sources(self, x, y, unit='coord', matching_radius=5.0, x_key='X_WORLD', y_key='Y_WORLD')ο
Select all sources within matching_radius.
- show_source(self, ra, dec, radius_arcsec=5.0, downsample=4, zoom_radius_pixel=50, matching_radius_arcsec=3.0, ra_key='X_WORLD', dec_key='Y_WORLD')ο
Show two-panel view of the target image with a single source marked (red). The left panel shows the full image, and the right panel shows a zoomed-in view of the target position. If a source is matched, it is marked with a blue circle.
- Parameters:
ra (float) β Right ascension of the target source.
dec (float) β Declination of the target source.
downsample (int, optional) β Downsampling factor for the image. Default is 4.
zoom_radius_pixel (float, optional) β Radius of the zoomed-in view in pixels. Default is 50.
matching_radius_arcsec (float, optional) β Matching radius in arcseconds. Default is 3.0.
- Returns:
fig β Figure object.
- Return type:
matplotlib.figure.Figure
- copy(self)ο
Return a deep copy of this Catalog instance.
- Returns:
copied_catalog β A deep copy of the Catalog instance.
- Return type:
Examples
>>> catalog = Catalog(path='catalog.fits') >>> copied_catalog = catalog.copy() >>> copied_catalog.path 'catalog.fits'
- write(self, format='ascii', verbose=True)ο
Write catalog data to the savepath (self.savepath.savepath).
- Parameters:
format (str, optional) β Format of the output file. Default is βasciiβ.
- Return type:
None
Examples
- remove(self, remove_main=True, remove_connected_files=True, skip_patterns=[['*.png', '*.cat']], verbose=True)ο
- Return type:
dict
- apply_mask(self, target_ivpmask, x_key='X_IMAGE', y_key='Y_IMAGE')ο
Apply a mask to the catalog.
- Parameters:
target_ivpmask (Mask) β Mask to apply to the catalog.
x_key (str, optional) β Column name for X coordinates. Default is βX_IMAGEβ.
y_key (str, optional) β Column name for Y coordinates. Default is βY_IMAGEβ.
- Returns:
masked_sources β Catalog with sources that are not masked.
- Return type:
Table
- to_stamp(self, target_img, sort_by='FLUX_AUTO', max_number=50000, x_key='X_WORLD', y_key='Y_WORLD')ο
Convert X_WORLD and Y_WORLD to pixel coordinates and save to a stamp catalog.
- Parameters:
target_img (ScienceImage or ReferenceImage) β Target image to convert to pixel coordinates.
sort_by (str, optional) β Column name to sort the catalog by. Default is βFLUX_AUTOβ.
max_number (int, optional) β Maximum number of sources to save. Default is 50000.
- Returns:
stamppath β Path to the stamp catalog.
- Return type:
str
- to_region(self, reg_size=6.0, shape='circle')ο
Convert X_IMAGE and Y_IMAGE to a region file.
- Parameters:
reg_size (float, optional) β Size of the region in pixels. Default is 6.0.
shape (str, optional) β Shape of the region. Default is βcircleβ.
Additional Methodsο
- save_info(self, verbose=False)ο
Save processing info to a JSON file.
- Parameters:
verbose (bool, optional) β If True, print the path of the info file. Default is False.
- Return type:
None
- load_info(self, verbose=False)ο
Load processing info from a JSON file.
- Parameters:
verbose (bool, optional) β If True, print the path of the info file. Default is False.
- Returns:
info β Info object loaded from the JSON file.
- Return type:
Info
Propertiesο
Key Properties
Property |
Description |
|---|---|
|
Return all associated files that would be deleted in remove() if remove_connected_files=True, |
|
Lazy-load table data from path by trying multiple formats. |
|
Check if the data is loaded. |
|
Check if the catalog file exists. |
|
Check if the catalog has been saved. |
|
Number of selected sources in the target data. |
|
Number of sources in the catalog. |
|
Return the directory where this image and associated files will be saved. |
|
Dynamically builds save paths based on the path |
|
Return the selected sources by self.select_sources(). |