CatalogData#

class stellarphot.CatalogData(*args, input_data=None, catalog_name=None, catalog_source=None, colname_map=None, passband_map=None, no_catalog_error=False, **kwargs)[source]#

Bases: BaseEnhancedTable

A class to hold astronomical catalog data while performing validation to confirm the minimum required columns (‘id’, ‘ra’, ‘dec’, ‘mag’, and ‘passband’) are present and have the correct units.

As a convenience function, when the user passes in an astropy table to validate, the user can also pass in a col_rename dict which can be used to rename columns in the data table BEFORE the check that the required columns are present.

Parameters:
input_data: `astropy.table.Table`, optional (Default: None)

A table containing all the astronomical catalog data to be validated. This data is copied, so any changes made during validation will not affect the input data, only the data in the class.

catalog_name: str, optional (Default: None)

User readable name for the catalog.

catalog_source: str, optional (Default: None)

User readable designation for the source of the catalog (could be a URL or a journal reference).

colname_map: dict, optional (Default: None)

A dictionary containing old column names as keys and new column names as values. This is used to automatically update the column names to the desired names BEFORE the validation is performed.

passband_map: `stellarphot.settings.PassbandMap`, optional (Default: None)

An object containing a mapping from instrumental passband names to AAVSO passband names. This is used to automatically update the passband column to AAVSO standard names if desired. See the documentation for stellarphot.settings.PassbandMap for more information. The object behaves like a dictionary when accessing it.

no_catalog_error: bool, optional (Default: False)

If True, the catalog data does not contain error information, so a column of NaNs will be added for the error values.

Attributes:
catalog_name: str

User readable name for the catalog.

catalog_source: str

User readable designation for the source of the catalog (could be a URL or a journal reference).

passband_map: `stellarphot.settings.PassbandMap`

An object containing a mapping from instrumental passband names to AAVSO passband names. This is used to automatically update the passband column to AAVSO standard names if desired. See the documentation for stellarphot.settings.PassbandMap for more information. The object behaves like a dictionary when accessing it.

Notes

For validation of inputs, you must provide input_data, catalog_name, and catalog_source. If you do not, an empty table will be returned.

input_data MUST contain the following columns with the following units:

Column Name

Unit

id

None

ra

u.deg

dec

u.deg

mag

None

mag_error

None (see note below)

passband

None

If the catalog data does not contain error information, then set the option no_catalog_error=True when creating the object. This will add a column of NaNs for the error values.

Attributes Summary

Methods Summary

from_vizier(field_center, desired_catalog[, ...])

Return the items from catalog that are within the search radius and (optionally) within the field of view of a frame.

passband_columns([passbands, transformer, ...])

Return an astropy.table.Table with passbands as column names instead of the default format, which has a single column for passbands.

Attributes Documentation

catalog_descript = {'dec': Unit("deg"), 'id': None, 'mag': None, 'mag_error': None, 'passband': None, 'ra': Unit("deg")}#
catalog_name#
catalog_source#
passband_map#

Methods Documentation

classmethod from_vizier(field_center, desired_catalog, radius=<Quantity 0.5 deg>, clip_by_frame=False, padding=100, magnitude_limit=None, magnitude_limit_passband=None, colname_map=None, mag_column_regex="^([a-zA-Z]+'?|[a-zA-Z]+'?-[a-zA-Z]+'?)_?mag$", color_column_regex='^([a-zA-Z]+-[a-zA-Z]+)$', prepare_catalog=None, no_catalog_error=False, tidy_catalog=True)[source]#

Return the items from catalog that are within the search radius and (optionally) within the field of view of a frame.

Parameters:
field_centerastropy.coordinates.SkyCoord, astropy.wcs.WCS, or FITS header

Either a SkyCoord object, a WCS object or a FITS header with WCS information. The input coordinate should be the center of the frame; if a header or WCS is the input then the center of the frame will be determined from the WCS.

desired_catalogstr

Vizier name of the catalog to be searched.

radiusfloat, optional

Radius, in degrees, around which to search. Default is 0.5.

clip_by_framebool, optional

If True, only return items that are within the field of view of the frame. Default is True.

paddingint, optional

Coordinates need to be at least this many pixels in from the edge of the frame to be considered in the field of view. Default value is 100.

magnitude_limitfloat, optional

If provided, only return items with magnitudes less than or equal to this value, and magnitude_limit_passband must also be provided.

magnitude_limit_passbandstr, optional

If provided, the passband column to use for the magnitude limit. The name of the passband must be the name native to the catalog. If this is provided then the magnitude_limit must also be provided.

colname_mapdict, optional

Dictionary mapping column names in the catalog to column names in a stellarphot.CatalogData object. Default is None.

mag_column_regexstr, optional

Regular expression to match magnitude columns. See notes below for more information about the default value.

color_column_regexstr, optional

Regular expression to match color columns. See notes below for more information about the default value.

prepare_catalogcallable, optional

Function to call on the catalog after it is retrieved from Vizier.

no_catalog_error: bool, optional (Default: False)

If True, the catalog data does not contain error information, so a column of NaNs will be added for the error values.

tidy_catalogbool, optional

If True, the catalog will be tidied into a long format with one row per passband after running the catalog through prepare_catlog if that is not None. If False, no tidying will be done. See Notes below for more information about tidy data format.

Returns:
stellarphot.CatalogData

Table of catalog information.

Notes

In many Vizier catalogs, the magnitude columns are named with a passband name followed by mag, sometimes with an underscore _ in between. For example, the Johnson V magnitude column is Vmag or V_mag. The default value for mag_column_regex will match any column name that starts with a letter or letters, followed by mag or _mag.

In many Vizier catalogs, the color columns are named with the passbands separated by a hyphen. For example, the Johnson V-I color column is V-I. The default value for color_column_regex will match any column name that starts with a letter or letters, followed by a hyphen, followed by a letter or letters.

Tidy data formats are those where each row is a single observation of a single object in a single passband.

passband_columns(passbands=None, transformer=None, transformer_kwargs=None)[source]#

Return an astropy.table.Table with passbands as column names instead of the default format, which has a single column for passbands.

Parameters:
passbandslist, optional

List of passbands to include in the output. If not provided, all passbands in the catalog will be included.

transformercallable, optional

Function to transform the data in the passband columns. The function should take a single argument, which is the data in the passband column, and return the transformed data. If not provided, no transformation will be applied.

transformer_kwargsdict, optional

Keyword arguments to pass to the transformer function. If not provided, an empty dictionary will be used.

Returns:
astropy.table.Table

Table of catalog information with passbands as column names. See Notes below for important details about column names.

Notes

The column names in the output will be the passband names with mag_ as a prefix. An error column for each passband will be generated, with the prefix mag_error_. If the catalog already has columns with these names, they will be overwritten. The input catalog will not be changed.