autowisp.catalog module
Class Inheritance Diagram

Utilities for querying catalogs for astrometry.
- class autowisp.catalog.WISPGaia(*, tap_plus_conn_handler=None, datalink_handler=None, gaia_tap_server='https://gea.esac.esa.int/', gaia_data_server='https://gea.esac.esa.int/', tap_server_context='tap-server', data_server_context='data-server', verbose=False, show_server_messages=True)[source]
Bases:
GaiaClass
Extend queries with condition and sorting.
- _get_result(query, add_propagated, verbose=False)[source]
Get and format the result as specified by user.
- query_brightness_limited(*, magnitude_expression, magnitude_limit, **query_kwargs)[source]
Get sources within a box and a range of magnitudes.
- Parameters:
magnitude_expression – Expression for the relevant magnitude involving Gaia columns.
magnitude_limit – Either upper limit or lower and upper limit on the magnitude defined by
magnitude_expression
.**query_kwargs – Arguments passed directly to query_object_filtered().
- Returns:
The result of the query.
- Return type:
astropy Table
- query_object_filtered(*, ra, dec, width, height, order_by, condition=None, epoch=None, columns=None, order_dir='ASC', max_objects=None, verbose=False, count_only=False)[source]
Get GAIA sources within a box satisfying given condition (ADQL).
- Parameters:
ra – The RA of the center of the box to query, with units.
dec – The declination of the center of the box to query, with units.
width – The width of the box (half goes on each side of
ra
), with units.height – The height of the box (half goes on each side of
dec
), with units.order_by (str) – How should the stars be ordered.
condition (str) – Condition the returned sources must satisfy (typically imposes a brightness limit)
epoch – The epoch to propagate the positions to. If unspecified, no propagation will be done.
columns (iterable) – List of columns to select from the catalog. If unspecified, all columns will be returned.
order_dir (str) – Should the order be ascending (
'ASC'
) or descending ('DESC'
).max_objects (int) – Maximum number of objects to return.
verbose (bool) – Use verbose mode when submitting querries to GAIA.
count_only (bool) – If
True
, only the number of objects is returned without actually fetching the data.
- Returns:
The result of the query.
- Return type:
astropy Table
- autowisp.catalog._find_best_fov(points, fov_size)[source]
Find square of a given size that fits the most points.
Example
>>> import numpy >>> from autowisp.catalog import _find_best_fov >>> points = numpy.array([(0.0, 0.0), ... (0.1, 0.0), ... (0.1, 0.1), ... (3.2, 0.0), ... (3.2, 3.1)], ... dtype=[('RAcosDec', float), ('Dec', float)]) >>> _find_best_fov(points, 1.0) ((0.0, 0.0), 3) >>> _find_best_fov(points, 10.0) ((0.0, 0.0), 5) >>> _find_best_fov(points, 0.11) ((0.0, 0.0), 3) >>> _find_best_fov(points, 0.05) ((0.0, 0.0), 1) >>> _find_best_fov(points, 3.11) ((0.1, 0.0), 4) >>> points = numpy.array([(0.0, 0.0), ... (0.1, 0.0), ... (0.1, -0.1), ... (3.2, 0.0), ... (3.2, 3.0)], ... dtype=[('RAcosDec', float), ('Dec', float)]) >>> _find_best_fov(points, 1.0) ((0.0, -0.1), 3) >>> _find_best_fov(points, 10.0) ((0.0, -0.1), 5) >>> _find_best_fov(points, 0.11) ((0.0, -0.1), 3) >>> _find_best_fov(points, 0.05) ((0.0, 0.0), 1) >>> _find_best_fov(points, 3.11) ((0.1, -0.1), 4)
- autowisp.catalog.check_catalog_coverage(header, transformation, catalog_header, safety_margin)[source]
Return True iff te catalog covers the frame fully including a safety margin.
- Parameters:
header (dict-like) – The header of the frame being astrometried.
transformation (dict) – The transformation to assume applies to the given image. Should contain entries for
'trans_x'
,'trans_y'
,'ra_cent'
and'dec_cent'
.catalog_header (dict-like) – The header of the catalog being used for astrometry.
safety_margin (float) – The absolute values of xi and eta (relative to the catalog center) corresponding to the corners of the frame increased by this fraction must be smaller than the field of view of the catalogfor the frame to be considered covered.
- Returns:
Whether the catalog covers the frame fully including the safety margin.
- Return type:
- autowisp.catalog.create_catalog_file(fname, overwrite=False, **query_kwargs)[source]
Create a catalog FITS file from a Gaia query.
- Parameters:
fname (str) – Name of the catalog file to create.
**query_kwargs – Arguments passed directly to gaia.query_brightness_limited().
- autowisp.catalog.ensure_catalog(*, dr_files=None, transformation=None, header=None, configuration, lock=<contextlib.nullcontext object>, return_metadata=True, **dr_path_substitutions)[source]
Re-use or create astrometry catalog suitable for the given frame.
- autowisp.catalog.find_outliers(center_ra_dec, max_allowed_offset)[source]
Find frames that are outliers in pointing.
- Parameters:
center_ra_dec (numpy.array) – The center RA and Dec of all the frames being considered. The data type should include columns named
'RA'
and'Dec'
.max_allowed_offset (float) – The maximum allowed offset in the RA and Dec directions in degrees. The most outlier frames is iteratively rejected until this criterion is satisfied.
- Returns:
List of the indices within
center_ra_dec
that were rejected as outliers.- Return type:
[int]
- autowisp.catalog.get_catalog_info(*, dr_files=None, transformation=None, header=None, configuration, **dr_path_substitutions)[source]
Get the configuration of the catalog needed for this frame.
- autowisp.catalog.get_max_abs_corner_xi_eta(header, *, transformation=None, dr_files=None, center=None, max_offset=10.0, **dr_path_substitutions)[source]
Return the max absolute values of the frame corners xi and eta.
- Parameters:
header (astropy.io.fits.Header) – The header of the image to find corner xi and eta of..
transformation – The transformation to assume applies to the image. If not specified, transformations are read from
dr_files
and max is taken over all of them.dr_files – The list of DR files to read transformations from. If transformation is not specified. Ignored if transformation is specified.
center – The center to assume for the projection. If not specified, the center is calculated as average of max and min RA and Dec for all DR files.
max_offset – The largest allowed offset in the RA or Dec directions between the centers of frames. Outliers by more than this many degrees are flagged and excluded from consideration.
dr_path_substitutions – The substitutions to use when reading transformations from DR files.
- Returns:
The maximum absolute value of xi over all corners of all frame.
- float:
The maximum absolute value of eta over all corners of all frame.
- structured array:
The center around which xi, eta are defined. Returned only if center was not specified and more than one DR file was specified.
- array(int):
The indices within DR files that were dropped as outliers in the pointing. Returned only if center was not specified and more than one DR file was specified.
- Return type:
- autowisp.catalog.read_catalog_file(cat_fits, filter_expr=None, sort_expr=None, return_metadata=False, add_gnomonic_projection=False)[source]
Read a catalog FITS file.
- Parameters:
cat_fits (str, or opened FITS file) – The file to read.
- Returns:
The catalog information as columns.
- Return type:
pandas.DataFrame