astropy:docs

imagedb API Reference

MongoDB databases for storing references to mosaic image products (at the stack, block and mosaic level).

The databases are backed by the Mo’Astro ImageLog API. Most of the additional methods provided for each database are to preserve backwards compatibility. These subclasses provide additional functionality for storing footprints within a common resampled pixel space.

class skyoffset.imagedb.MosaicDB(dbname, cname, server=None, url='localhost', port=27017)[source]

Database interface for resampled mosaics.

Parameters:

dbname : str

Name of the MongoDB database mosaic documents are stored in.

cname : str

Name of the MongoDB collection where mosaic docs are stored.

server : str

Name of the MongoDB server (using a moastro.json config).

url : str

Hostname/URL of the MongoDB server (if server is not set).

port : int

Port of the MongoDB server (if server is not set).

add_footprint_from_header(mosaic_name, header)[source]

Create a footprint from the WCS embedded in a astropy.io.fits header for the named (pre-existing) mosaic document.

The footprint is stored under the field footprint in the mosaic’s document.

Parameters:

mosaic_name : str

Name of the mosaic (the _id field for the document).

header : astropy.io.fits.Header instance

Header for the mosaic.

add_footprint_from_wcs(mosaic_name, wcs)[source]

Create a footprint from the WCS embedded in a astropy.io.fits header for the named (pre-existing) mosaic document.

The footprint is stored under the field footprint in the mosaic’s document.

In a sense, this is an attempt to persist a WCS instance. Note that we only save a subset of the astropy.wcs data; that is, we’re built around simple WCS with no PV, etc. This could be fixed though...

Note

By default astropy.wcs is 1 based (ie, origins of CRPIX are 1 and not zero; may need to subtract 1 from crpix when used in numpy arrays

Parameters:

mosaic_name : str

Name of the mosaic (the _id field for the document).

wcs : astropy.wcs.WCS instance

WCS for the mosaic.

find_overlapping(mosaic_name, selector)[source]

Returns a list of mosaic names (_id) for mosaics overlapping the principal mosaic, and the fractional area of the overlap compared to the area of the principal footprint.

Parameters:

mosaic_name : str

_id of the mosaic to test other mosaics against.

selector : dict

query document to select mosaics to test overlaps with.

Returns:

overlaps : list

Sequence of (_id, overlap fraction) tuples.

make_resampled_wcs(selector)[source]

Make a list (or one) ResampledWCS object(s) for footprints given by the selector.

Parameters:

selector : dict

MongoDB selector for mosaic documents to make ResampledWCS instances for.

Returns:

resampled_wcs : list or skyoffset.difftools.ResampledWCS

If only one mosaic is found, returns a single skyoffset.difftools.ResampledWCS instance. Otherwise, a list of ResampledWCS``s is returned. ``None is returned if no mosaics match the selector.

skyoffset.imagedb.eq_to_tan(ra, dec, ra0, dec0)[source]

Converts RA,Dec coordinates to xi, eta tangential coordiantes. See Olkin:1996 eq 3 for example, or Smart 1977.

Returns:tuple of xi, eta in degrees.
skyoffset.imagedb.tan_to_eq(xiDeg, etaDeg, ra0Deg, dec0Deg)[source]

Convert tangential coordinates to equatorial (RA, Dec) in degrees.

Page Contents