RadioSource¶
-
class
dendrocat.
RadioSource
(hdu, name=None, freq_id=None)[source]¶ Bases:
object
An object to store radio image data.
Parameters: - hdu :
PrimaryHDU
An astropy FITS HDU object containing the radio image data and header.
- region_id : str, optional
An identifier specifying what sky object the radio image contains.
- freq_id : str, optional
An identifier specifying the observation frequency (Ex: 226.0GHz). If not specified, it will be generated from the FITS image header.
Methods Summary
accept
(accepted_list)Accept specific sources in the catalog. add_sources
(*args)Adds external source entries to the existing catalog. autoreject
([threshold])Reject noisy detections. dump
(outfile)Dump the RadioSource
object via pickle.get_pixels
(aperture[, catalog, data, …])Get pixels within an aperture for each entry in the specified catalog. get_snr
([source, background, catalog, data, …])Return the SNR of all sources in the catalog. grab
(name[, skip_rejects])Search the catalog for an entry matching a specific name, and return plot_grid
([catalog, data, cutouts, …])Plot sources in a grid. reject
(rejected_list)Reject specific sources in the catalog. reset
()Reset all sources’ rejection flags to 0 (all accepted). set_metadata
()Sets RadioSource metadata using nu, WCS, and other FITS header data. to_catalog
([dendrogram])Creates a new position-position catalog of leaves in a dendrogram. to_dendrogram
([min_value, min_delta, …])Calculates a dendrogram for the image. Methods Documentation
-
accept
(accepted_list)[source]¶ Accept specific sources in the catalog.
Parameters: - accpeted_list: list
A list of ``_name``s, for which each corresponding entry will be marked accepted.
-
add_sources
(*args)[source]¶ Adds external source entries to the existing catalog.
Parameters: - *args: `~astropy.table.Table`
A source catalog containing the sources you wish to add to the existing catalog.
-
autoreject
(threshold=None)[source]¶ Reject noisy detections.
Parameters: - threshold : float, optional
The signal-to-noise threshold below which sources are rejected
-
dump
(outfile)[source]¶ Dump the
RadioSource
object via pickle.Parameters: - outfile : str
Desired output file path.
-
get_pixels
(aperture, catalog=None, data=None, cutouts=None, save=True)[source]¶ Get pixels within an aperture for each entry in the specified catalog.
Parameters: - aperture: `~dendrocat.aperture.Aperture`
The aperture determining which pixels to grab.
- catalog: `~astropy.table.Table`, optional
A source catalog containing the center positions of each source.
- data: array-like
Image data for the sources in the catalog.
- cutouts:
For developer use
Returns: - pixels, masks
- `~numpy.ndarray`, `~numpy.ndarray`
-
get_snr
(source=None, background=None, catalog=None, data=None, cutouts=None, cutout_data=None, peak=True, save=True)[source]¶ Return the SNR of all sources in the catalog.
Parameters: - source: array-like
Array of source fluxes to use in SNR calculation.
- background: array-like
Array of background fluxes to use in SNR calculation.
- catalog: `~astropy.table.Table`
The catalog of sources for which to calculate the SNR.
- data: array-like
Image data for the sources in the catalog.
- cutouts:
For debugging. Provides a specific set of cutouts instead of letting the function generate them.
- cutout_data:
For debugging. Provides a specific set of cutout data instead of letting the function generate it.
- peak : bool, optional
Use peak flux of source pixels as ‘signal’. Default is True.
- save : bool, optional
If enabled, the snr will be saved as a column in the source catalog and as an instance attribute. Default is True.
Returns: - `~numpy.ndarray`
-
grab
(name, skip_rejects=False)[source]¶ - Search the catalog for an entry matching a specific name, and return
- it.
Parameters: - name: tuple, list, or str
The name or names of the sources to search for.
- skip_rejects: bool, optional
If enabled, will only search accepted sources.
-
plot_grid
(catalog=None, data=None, cutouts=None, cutout_data=None, source_aperture=None, bkg_aperture=None, skip_rejects=True, outfile=None, figurekwargs={})[source]¶ Plot sources in a grid.
Parameters: - catalog : astropy.table.Table object, optional
The catalog used to extract source positions.
- data : numpy.ndarray, optional
The image data displayed and used to make cutouts.
- cutouts : list of astropy.nddata.utils.Cutout2D objects, optional
Image cutout regions to save computation time, if they have already been calculated.
- cutout_data : list of numpy.ndarrays, optional
Image cutout region data to save on computation time, if it has already been calculated.
- apertures : list of dendrocat.aperture functions, optional
Apertures to plot over the image cutouts.
- skip_rejects : bool, optional
If enabled, don’t plot rejected sources. Default is True.
-
reject
(rejected_list)[source]¶ Reject specific sources in the catalog.
Parameters: - rejected_list: list
A list of ``_name``s, for which each corresponding entry will be marked rejected.
-
to_catalog
(dendrogram=None)[source]¶ Creates a new position-position catalog of leaves in a dendrogram. This task will overwrite the existing catalog if there is one.
Parameters: - dendrogram :
Dendrogram
object, optional The dendrogram object to extract sources from.
Returns: - `~astropy.table.Table`
- dendrogram :
-
to_dendrogram
(min_value=None, min_delta=None, min_npix=None, save=True)[source]¶ Calculates a dendrogram for the image.
Parameters: - min_value : float, optional
Minimum detection level to be considered in the dendrogram.
- min_delta : float, optional
How significant a dendrogram structure has to be in order to be considered a separate entity.
- min_npix : float, optional
Minimum number of pixel needed for a dendrogram structure to be considered a separate entity.
- save : bool, optional
If enabled, the resulting dendrogram will be saved as an instance attribute. Default is True.
Returns: - `~astrodendro.dendrogram.Dendrogram` object
A dendrogram object calculated from the radio image.
- hdu :