Source Catalogs

A module that manages catalogs and source finding algorithms (i.e., SExtractor source finding).

Author:Mihai Cara (for help, contact HST Help Desk)
License:LICENSE
class subpixal.catalogs.SourceCatalog[source]

A class for handling catalog data: storing, filtering, and retrieving sources.

append_filters(fcond)[source]

Add one or more conditions for selecting sources from the raw catalog to already set filters. See set_filters() for description of parameter fcond.

catalog

Get catalog (after applying masks and selection filters).

catmap

Get raw catalog column name mapping.

execute()[source]

Compute catalog applying masks and selecting only sources that satisfy all set filters.

filters

Get a list of all active selection filters.

is_dirty()[source]

Returns the “dirty” status. When a catalog is marked as “dirty”, sources must be (re-)extracted from the raw catalog. In order to update

mark_dirty()[source]

Mark the catalog as “dirty”, indicating whether or not sources should be re-extracted from the raw catalog when execute() is run. Masking and filtering criteria will be applied to the raw catalog during this run of execute().

mask

Get mask indicating “bad” (True) and “good” (False) sources when mask_type is 'image' or a 2D array of shape (N, 2) containing integer coordinates of “bad” pixels.

mask_type

Get mask type: ‘coords’, ‘image’, or None (mask not set).

predefined_catmaps

Get names of available (pre-defined) column name mappings.

rawcat

Get raw catalog.

rawcat_colnames

Get a list of the column names in the raw catalog after catalog column name mapping has been applied.

remove_filter(key, op=None)[source]

Remove a specific filter by column name and, optionally, by comparison operator.

Parameters:
key : str

Column name to which selection criteria (filter) is applied. If more conditions match a column name vale, all of them will be removed.

op : str, optional

Specifies the comparison operation used in a filter. This allows narrowing down which filters should be removed.

required_colnames

Get a list of the minimum column names that are required to be present in the raw catalog after catalog column name mapping has been applied.

reset_filters()[source]

Remove selection filters.

set_default_filters()[source]

Set default source selection criteria.

set_filters(fcond)[source]

Set conditions for selecting sources from the raw catalog.

Parameters:
fcond : tuple, list of tuples

Each selection condition must be specified as a tuple of the form (colname, comp, value) where:

  • colname is a column name from the raw catalog after catalog column name mapping has been applied. Use rawcat_colnames to get a list of available column names.
  • comp is a string representing a comparison operator. The following operators are suported: ['>', '>=', '==', '!=', '<', '<='].
  • value is a numeric value to be used for comparison of column values.

Multiple selection conditions can be provided as a list of the condition tuples described above.

set_raw_catalog(rawcat, catmap=None, origin=0)[source]
Parameters:
rawcat : astropy.table.Table

An Table containing source data.

catmap : dict, str, optional

A dict that provides mapping (a dictionary) between source’s 'x', 'y', 'flux', etc. and the corresponding column names in a Table catalog. Instead of a dictionary, this parameter may be a pre-defined mapping name supported by this class. To get the list of all pre-defined catalog mapping supported by this class, use SourceCatalog’s predefined_catmaps property. When catmap is None, no column name mapping will be applied.

origin: int, float, optional

Coordinates of the sources of SourceCatalog.catalog are zero-based. The origin is used for converting rawcat’s coordinates when raw catalog’s source coordinates are not zero-based.

class subpixal.catalogs.SExCatalog(rawcat=None, max_stellarity=1.0)[source]

A catalog class specialized for handling SExtractor output catalogs, such as being able to load raw SExtractor catalogs directly from text files.

Parameters:
rawcat : astropy.table.Table, str

An Table containing source data or a SExtractor-generated text file name.

max_stellarity : float, optional

Maximum stellarity for selecting sources from the catalog.

set_default_filters()[source]

Sets default filters for selecting sources from the raw catalog.

Default selection criteria are: flux > 0 AND fwhm > 0 AND radius > 0 AND prof-rms-a > 0 AND prof-rms-b > 0 AND stellarity <= max_stellarity.

set_raw_catalog(rawcat)[source]

Set/replace raw catalog.

Parameters:
rawcat : astropy.table.Table, str

An Table containing source data or a SExtractor-generated text file name.

class subpixal.catalogs.SExImageCatalog(image=None, sexconfig=None, max_stellarity=1.0, sextractor_cmd='sex')[source]

A catalog class specialized for finding sources in images using SExtractor and then loading raw SExtractor catalogs directly from output text files.

Parameters:
image : str

A FITS image file name.

sexconfig : str

File name of the SExtractor configuration file to be used for finding sources in the image.

max_stellarity : float, optional

Maximum stellarity for selecting sources from the catalog.

sextractor_cmd : str, optional

Command to invoke SExtractor.

execute()[source]

Compute catalog applying masks and selecting only sources that satisfy all set filters.

image

Get image.

segmentation_file

Get segmentation file name stored in the SExtractor’s configuration file or None.

sexconfig

Get SExtractor configuration file.