astropy:docs

twomass API Reference

Access the 2MASS survey as a local MongoDB.

class moastro.twomass.PSC(dbname='twomass', cname='psc', server=None, url='localhost', port=27017)[source]

2MASS Point Source Catalog representation in MongoDB.

Parameters:

dbname : str

Name of MongoDB database.

cname : str

Name of MongoDB collection.

server : str

Name of the MongoDB server, as specified in ~/.moastro.json. If None, then the values of url and port will be adopted instead.

url : str

URL of MongoDB server.

port : int

Port of MongoDB server.

find(spec, fields=[], center=None, radius=None, box=None, polygon=None, header=None, wcs=None)[source]

General purpose query method for 2MASS PSC.

Parameters:

spec : dict

A pymongo query specification. Note that spatial query parameters will override those passed in spec.

fields : list

List of PSC fields to return (in addition to self.default_fields.)

center: (2,) tuple or list :

For spherical spatial queries, defines the query center as an (RA, Dec.) tuple in degrees.

radius: float (degrees) :

Radius of the spherical query, in degrees. Use with center.

polygon: list of [RA,Dec] vertices in degrees. The polygon is :

automatically closed.

box: list or tuple `[[RA_min,Dec_min],[RA_max,Dec_max]]` :

Queries for stars inside a rectangular range of RA and Dec. Assumes decimal degrees for RA and Dec.

header: `pyfits.header` instance :

Queries stars within the footprint defined by the pyfits image header.

wcs: pywcs.WCS instance :

Queries stars within the footprint defined by the WCS.

Returns:

recs : pymongo.Cursor instance

The cursor can be iterated to access each star. Stars are represented as dictionaries whose keys are the requested data fields.

Notes

Only one type of spatial query is performed, even if several are defined by the keyword arguments passed by the user. The spatial query is resolved in the following order:

  1. wcs
  2. header
  3. polygon
  4. box
  5. center and radius

Examples

To query for all stars with J-K_s > 0.5 mag within 2 degrees of M31, and returning only the RA,Dec position, J magnitude and K_s magnitude:

>>> psc = PSC()
>>> recs = psc.find({"j_m-k_m": {"$gt": 0.5}},
        fields=["coord","j_m","k_m"],
        center=(13.,41.), radius=2.)
classmethod import_psc(f, dbname='twomass', cname='psc', server=None, url='localhost', port=27017, drop=False)[source]

Build a PSC database in MongoDB from the ascii data streams.

Parameters:

f : file-like object

A file-like object conforming to the 2MASS PSC file spec.

dbname : str

Name of MongoDB database.

cname : str

Name of MongoDB collection.

server : str

Name of the MongoDB server, as specified in ~/.moastro.json. If None, then the values of url and port will be adopted instead.

url : str

URL of MongoDB server.

port : int

Port of MongoDB server.

drop : bool

Set to True if any existing PSC collection should be dropped useful for re-doing an import.

classmethod index_space_color(dbname='twomass', cname='psc', server=None, url='localhost', port=27017)[source]

Generates an geospatial+colour+magnitude index.

The index is constructed so that RA,Dec is indexed first as this is most useful in using 2MASS for targeted applications.

moastro.twomass.import_compressed_psc(dataDir, host='localhost', port=27017, dbname='twomass', cname='psc')[source]

Import decompressed PSC text catalogs from dataDir.

The psc collection is dropped before this operation.

moastro.twomass.reset_psc(dbname='twomass', cname='psc')[source]

Drops the 2MASS PSC collection!

moastro.twomass.test_import_psc(testPath, host='localhost', port=27017, dbname='twomass', cname='psc', drop=True)[source]

Import the test_psc practice file.

Page Contents