CdsClass

class astroquery.cds.CdsClass[source]

Bases: astroquery.query.BaseQuery

Query the CDS MOCServer

The CDS MOCServer allows the user to retrieve all the data sets (with their meta-datas) having sources in a specific region. This region can be a regions.CircleSkyRegion, a regions.PolygonSkyRegion or a mocpy.MOC object.

This package implements two methods:

  • query_region() retrieving data-sets (their associated MOCs and meta-datas) having sources in a given region.

  • find_datasets() retrieving data-sets (their associated MOCs and meta-datas) based on the values of their meta-datas.

Attributes Summary

TIMEOUT

URL

Methods Summary

find_datasets(meta_data[, ...])

Query the CDS MOCServer to retrieve the data-sets based on their meta data values.

query_region([region, get_query_payload, ...])

Query the CDS MOCServer with a region.

query_region_async([get_query_payload])

Serves the same purpose as query_region() but only returns the HTTP response rather than the parsed result.

Attributes Documentation

TIMEOUT = 30
URL = 'http://alasky.unistra.fr/MocServer/query'

Methods Documentation

find_datasets(meta_data, get_query_payload=False, verbose=False, **kwargs)[source]

Query the CDS MOCServer to retrieve the data-sets based on their meta data values. This method does not need any region argument but it requires an expression on the meta datas.

Parameters
meta_datastr

Algebraic expression on meta-datas for filtering the data-sets at the server side. Examples of meta data expressions:

  • Retrieve all the Hubble surveys: “ID=*HST*”

  • Provides the records of HiPS distributed simultaneously by saada and alasky http server: “(hips_service_url*=http://saada*)&&(hips_service_url*=http://alasky.*)”

More example of expressions can be found following this link (especially see the urls).

fields[str], optional

Has sense only if return_moc is set to False. Specifies which meta datas to retrieve. The returned astropy.table.Table table will only contain the column names given in fields.

Specifying the fields we want to retrieve allows the request to be faster because of the reduced chunk of data moving from the MOCServer to the client.

Some meta-datas such as obs_collection or data_ucd do not keep a constant type throughout all the MOCServer’s data-sets and this lead to problems because astropy.table.Table supposes values in a column to have an unique type. This case is not common: it is mainly linked to a typing error in the text files describing the meta-datas of the data-sets. When we encounter this for a specific meta-data, we link the generic type object to the column. Therefore, keep in mind that object typed columns can contain values of different types (e.g. lists and singletons or string and floats).

max_recint, optional

Maximum number of data-sets to return. By default, there is no upper limit.

return_mocbool, optional

Specifies if we want a mocpy.MOC object in return. This MOC corresponds to the union of the MOCs of all the matching data-sets. By default it is set to False and query_region() returns an astropy.table.Table object.

max_norderint, optional

Has sense only if return_moc is set to True. Specifies the maximum precision order of the returned MOC.

get_query_payloadbool, optional

If True, returns a dictionary of the query payload instead of the parsed response.

verbosebool, optional
Returns
responseastropy.table.Table or mocpy.MOC

By default an astropy table of the data-sets matching the query. If return_moc is set to True, it gives a MOC object corresponding to the union of the MOCs from all the retrieved data-sets.

query_region(region=None, get_query_payload=False, verbose=False, **kwargs)[source]

Query the CDS MOCServer with a region.

Can be a regions.CircleSkyRegion, regions.PolygonSkyRegion or mocpy.MOC object. Returns the data-sets having at least one source in the region.

Parameters
regionregions.CircleSkyRegion, regions.PolygonSkyRegion or mocpy.MOC

The region to query the MOCServer with. Can be one of the following types:

  • regions.CircleSkyRegion : defines an astropy cone region.

  • regions.PolygonSkyRegion : defines an astropy polygon region.

  • mocpy.moc.MOC : defines a MOC from the MOCPy library. See the MOCPy’s documentation for how to instantiate a MOC object.

intersectstr, optional

This parameter can take only three different values:

  • overlaps (default). Returned data-sets are those overlapping the MOC region.

  • covers. Returned data-sets are those covering the MOC region.

  • encloses. Returned data-sets are those enclosing the MOC region.

max_recint, optional

Maximum number of data-sets to return. By default, there is no upper limit.

return_mocbool, optional

Specifies if we want a mocpy.MOC object in return. This MOC corresponds to the union of the MOCs of all the matching data-sets. By default it is set to False and query_region() returns an astropy.table.Table object.

max_norderint, optional

Has sense only if return_moc is set to True. Specifies the maximum precision order of the returned MOC.

fields[str], optional

Has sense only if return_moc is set to False. Specifies which meta datas to retrieve. The returned astropy.table.Table table will only contain the column names given in fields.

Specifying the fields we want to retrieve allows the request to be faster because of the reduced chunk of data moving from the MOCServer to the client.

Some meta-datas as obs_collection or data_ucd do not keep a constant type throughout all the MOCServer’s data-sets and this lead to problems because astropy.table.Table supposes values in a column to have an unique type. When we encounter this problem for a specific meta-data, we remove its corresponding column from the returned astropy table.

meta_datastr, optional

Algebraic expression on meta-datas for filtering the data-sets at the server side. Examples of meta data expressions:

  • Retrieve all the Hubble surveys: “ID=*HST*”

  • Provides the records of HiPS distributed simultaneously by saada and alasky http server: “(hips_service_url*=http://saada*)&&(hips_service_url*=http://alasky.*)”

More example of expressions can be found following this link (especially see the urls).

get_query_payloadbool, optional

If True, returns a dictionary of the query payload instead of the parsed response.

verbosebool, optional
Returns
responseastropy.table.Table or mocpy.MOC

By default an astropy table of the data-sets matching the query. If return_moc is set to True, it gives a MOC object corresponding to the union of the MOCs from all the retrieved data-sets.

query_region_async(get_query_payload=False, **kwargs)[source]

Serves the same purpose as query_region() but only returns the HTTP response rather than the parsed result.

Parameters
get_query_payloadbool

If True, returns a dictionary of the query payload instead of the parsed response.

**kwargs

Arbitrary keyword arguments.

Returns
responseResponse:

The HTTP response from the CDS MOCServer.