NOIRLabClass#

class astroquery.noirlab.NOIRLabClass[source]#

Bases: BaseQuery

Search functionality for the NSF NOIRLab Astro Data Archive.

Attributes Summary

NAT_URL

TIMEOUT

api_version

Return version of REST API used by this module.

Methods Summary

get_file(fileid)

Simply fetch a file by MD5 ID.

get_token(email, password[, cache])

Get an access token to use with proprietary data.

list_fields(*[, aux, instrument, proctype, ...])

List the available fields for searches using query_metadata().

query_metadata([qspec, sort, limit, hdu, cache])

Query the archive database for details on available files.

query_region(coordinate, *[, radius, hdu, ...])

Query for NOIRLab observations by region of the sky.

sia_url([hdu])

Return the URL for SIA queries.

Attributes Documentation

NAT_URL = 'https://astroarchive.noirlab.edu'#
TIMEOUT = 30#
api_version#

Return version of REST API used by this module.

If the REST API changes such that the major version increases, a new version of this module will likely need to be used.

Methods Documentation

get_file(fileid)[source]#

Simply fetch a file by MD5 ID.

Parameters:
fileidstr

The MD5 ID of the file.

Returns:
HDUList

The open FITS file. Call .close() on this object when done.

get_token(email, password, cache=True)[source]#

Get an access token to use with proprietary data.

Parameters:
emailstr

Email for account access.

passwordstr

Password associated with email. Please never hard-code your password anywhere.

cachebool, optional

If True cache the result locally.

Returns:
str

The access token as a string.

list_fields(*, aux=False, instrument=None, proctype=None, hdu=False, categorical=False, cache=True)[source]#

List the available fields for searches using query_metadata().

The default is to return core fields for file-based queries.

Parameters:
auxbool, optional

If True, return aux fields. instrument and proctype must also be specified.

instrumentstr, optional

The specific instrument, e.g. ‘90prime’ or ‘decam’.

proctypestr, optional

A description of the type of image, e.g. ‘raw’ or ‘instcal’.

hdubool, optional

If True return the fields for HDU-based queries.

categoricalbool, optional

If True return the categorical fields and their allowed values.

cachebool, optional

If True cache the result locally.

Returns:
list or dict

A list of field descriptions, each a dict. If categorical=True return a dict describing the allowed values of each categorical field.

Raises:
ValueError

If aux=True and instrument or proctype are not specified.

Notes

  • Core fields are faster to search than Aux fields.

  • The available fields depend on whether a File or a HDU query is requested.

  • Categorical fields can only take on one of a set of values.

query_metadata(qspec=None, sort=None, limit=1000, hdu=False, cache=True)[source]#

Query the archive database for details on available files.

qspec should minimally contain a list of output columns and a list of search parameters, which could be empty. For example:

qspec = {"outfields": ["md5sum", ], "search": []}

There are more details in the NOIRLab overview document.

Parameters:
qspecdict, optional

The query that will be passed to the API.

sortstr, optional

Sort the results on one of the columns in qspec.

limitint, optional

The number of results to return, default 1000.

hdubool, optional

If True return the URL for HDU-based queries.

cachebool, optional

If True cache the result locally.

Returns:
Table

A Table containing the results.

query_region(coordinate, *, radius=0.1, hdu=False, cache=True, async_=False)[source]#

Query for NOIRLab observations by region of the sky.

Given a sky coordinate and radius, returns a Table of NOIRLab observations.

Parameters:
coordinatestr or coordinates object

The target region which to search. It may be specified as a string or as the appropriate coordinates object.

radiusfloat or str or Quantity object, optional

Default 0.1 degrees. The string must be parsable by Angle. The appropriate Quantity object from units may also be used.

hdubool, optional

If True, perform the query on HDUs.

cachebool, optional

If True, cache the result locally.

async_bool, optional

If True, return the raw query response instead of a Table.

Returns:
Table

A table containing the results.

sia_url(hdu=False)[source]#

Return the URL for SIA queries.

Parameters:
hdubool, optional

If True return the URL for HDU-based queries.

Returns:
str

The query URL.

Notes

In other modules this is an attribute or property. However, NOIRLab has two separate SIA URLs for File-based and HDU-based queries, thus a method is needed here.