MOCServerClass

class astroquery.mocserver.MOCServerClass[source]

Bases: BaseQuery

Query the CDS MOCServer.

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

Attributes Summary

DEFAULT_FIELDS

TIMEOUT

URL

Methods Summary

find_datasets(meta_data, *[, region, ...])

list_coordinate_systems()

Return the list of coordinate systems currently available in the MOC Server.

list_fields([keyword, cache])

List MOC Server fields.

query_async(*[, region, criteria, ...])

Return the HTTP response rather than the parsed result.

query_hips(*[, criteria, region, intersect, ...])

Query the MOCServer for HiPS surveys.

query_region([region, criteria, intersect, ...])

Query the MOC Server.

Attributes Documentation

DEFAULT_FIELDS = ['ID', 'obs_title', 'obs_description', 'nb_rows', 'obs_regime', 'bib_reference', 'dataproduct_type']
TIMEOUT = 30
URL = 'https://alasky.unistra.fr/MocServer/query'

Methods Documentation

find_datasets(meta_data, *, region=None, intersect='overlaps', return_moc=None, max_norder=None, fields=None, max_rec=None, casesensitive=False, coordinate_system=None, get_query_payload=False, verbose=False, cache=True)[source]

Deprecated since version v0.4.9: ‘find_datasets’ is replaced by ‘query_region’ which has a new parameter ‘criteria’ that accepts the expressions that ‘meta_data’ was accepting.

Query the MOC Server.

Parameters:
meta_datastr

Expression to select the datasets. Examples of expressions can be found on the mocserver’s examples page. Example: “ID=*HST*” will return datasets with HST in their ID column. The star means any character.

casesensitiveBool, optional

Whether the search should take the case into account. By default, False.

fields[str], optional

Specifies which columns to retrieve. Defaults to a pre-defined subset of fields. The complete list of fields can be obtained with list_fields.

coordinate_systemstr, optional

This is the space system on which the coordinates are expressed. Can take the values sky, mars, moon… The extended list can be printed with list_coordinate_systems. Default is None, meaning that the results will have mixed frames.

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

mocpy.TimeMOC, or mocpy.STMOC The region to query the MOCServer with. Note that this can also be a space-time region with the Time-MOCs and Space-Time-MOCs.

intersectstr, optional

This parameter can take three different values:

  • overlaps (default) select datasets overlapping the region

  • covers returned datasets are covering the region.

  • encloses returned datasets are enclosing the region.

max_recint, optional

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

return_mocbool, optional

Specifies whether the output should be a mocpy.MOC. The returned MOC is the union of the MOCs of all the matching datasets. By default it is False and this method returns a astropy.table.Table object.

max_norderint, optional

If return_moc is set to True, this fixes the maximum precision order of the returned MOC. For one dimensional MOCs (Space-MOCs and Time-MOCs), the order is given as an integer. For Space-Time MOCs, the order should be a string with the space and time orders. Example: ‘s3 t45’

get_query_payloadbool, optional

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

verbosebool, optional

Whether to show warnings. Defaults to False.

cache: bool, optional

Whether the response should be cached.

Returns:
responseastropy.table.Table, mocpy.MOC, mocpy.TimeMOC, or mocpy.STMOC

By default, returns a table with the datasets 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.

list_coordinate_systems()[source]

Return the list of coordinate systems currently available in the MOC Server.

This list may be enriched later, as new datasets are added into the MOC Server.

Returns:
list

The list of coordinate systems currently available in the MOC Server

list_fields(keyword=None, *, cache=True)[source]

List MOC Server fields.

In the MOC Server, the fields are free. This means that anyone publishing there can set a new field. This results in a long set of possible fields, that are more or less frequent in the database. This method allows to retrieve all fields currently existing, with their occurrences and an example.

Parameters:
keywordstr, optional

A keyword to filter the output for fields that have the keyword in their name. This is not case-sensitive. If you don’t give a keyword, you will retrieve all existing fields.

cache: bool, optional

Whether the response should be cached.

Returns:
Table

A table containing the field names, heir occurrence (expressed in number of records), and an example for each field.

Examples

>>> from astroquery.mocserver import MOCServer
>>> MOCServer.list_fields("publisher")
<Table length=3>
  field_name   occurrence          example
    str27        int64              str70
-------------- ---------- -------------------------
  publisher_id      32987                 ivo://CDS
 publisher_did       2871 ivo://nasa.heasarc/warps2
hips_publisher         14                       CDS
query_async(*, region=None, criteria=None, return_moc=None, max_norder=None, fields=None, max_rec=None, intersect='overlaps', coordinate_system=None, casesensitive=False, get_query_payload=False, cache=True)[source]

Return the HTTP response rather than the parsed result.

Parameters:
criteriastr

Expression to select the datasets. Examples of expressions can be found on the mocserver’s examples page. Example: “ID=*HST*” will return datasets with HST in their ID column. The star means any character.

casesensitiveBool, optional

Whether the search should take the case into account. By default, False.

fields[str], optional

Specifies which columns to retrieve. Defaults to a pre-defined subset of fields. The complete list of fields can be obtained with list_fields.

coordinate_systemstr, optional

This is the space system on which the coordinates are expressed. Can take the values sky, mars, moon… The extended list can be printed with list_coordinate_systems. Default is None, meaning that the results will have mixed frames.

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

mocpy.TimeMOC, or mocpy.STMOC The region to query the MOCServer with. Note that this can also be a space-time region with the Time-MOCs and Space-Time-MOCs.

intersectstr, optional

This parameter can take three different values:

  • overlaps (default) select datasets overlapping the region

  • covers returned datasets are covering the region.

  • encloses returned datasets are enclosing the region.

max_recint, optional

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

return_mocbool, optional

Specifies whether the output should be a mocpy.MOC. The returned MOC is the union of the MOCs of all the matching datasets. By default it is False and this method returns a astropy.table.Table object.

max_norderint, optional

If return_moc is set to True, this fixes the maximum precision order of the returned MOC. For one dimensional MOCs (Space-MOCs and Time-MOCs), the order is given as an integer. For Space-Time MOCs, the order should be a string with the space and time orders. Example: ‘s3 t45’

get_query_payloadbool, optional

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

verbosebool, optional
cache: bool, optional

Whether the response should be cached.

Returns:
responseResponse:

The HTTP response from the CDS MOCServer.

query_hips(*, criteria=None, region=None, intersect='overlaps', return_moc=None, max_norder=None, fields=None, max_rec=None, casesensitive=False, coordinate_system=None, get_query_payload=False, verbose=False, cache=True)[source]

Query the MOCServer for HiPS surveys.

Parameters:
criteriastr

Expression to select the datasets. Examples of expressions can be found on the mocserver’s examples page. Example: “ID=*HST*” will return datasets with HST in their ID column. The star means any character.

casesensitiveBool, optional

Wheter the search should take the case into account. By default, False.

fields[str], optional

Specifies which columns to retrieve. Defaults to a pre-defined subset of fields. The complete list of fields can be obtained with list_fields.

coordinate_systemstr, optional

This is the space system on which the coordinates are expressed. Can take the values sky, mars, moon… The extended list can be printed with list_coordinate_systems. Default is None, meaning that the results will have mixed frames.

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

mocpy.TimeMOC, or mocpy.STMOC The region to query the MOCServer with. Note that this can also be a space-time region with the Time-MOCs and Space-Time-MOCs.

intersectstr, optional

This parameter can take three different values:

  • overlaps (default) select datasets overlapping the region

  • covers returned datasets are covering the region.

  • encloses returned datasets are enclosing the region.

max_recint, optional

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

return_mocbool, optional

Specifies whether the output should be a mocpy.MOC. The returned MOC is the union of the MOCs of all the matching datasets. By default it is False and this method returns a astropy.table.Table object.

max_norderint, optional

If return_moc is set to True, this fixes the maximum precision order of the returned MOC. For one dimensional MOCs (Space-MOCs and Time-MOCs), the order is given as an integer. For Space-Time MOCs, the order should be a string with the space and time orders. Example: ‘s3 t45’

get_query_payloadbool, optional

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

verbosebool, optional

Whether to show warnings. Defaults to False.

cache: bool, optional

Whether the response should be cached.

Returns:
responseastropy.table.Table, mocpy.MOC, mocpy.TimeMOC, or mocpy.STMOC

By default, returns a table with the datasets 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, *, criteria=None, intersect='overlaps', return_moc=None, max_norder=None, fields=None, max_rec=None, casesensitive=False, coordinate_system=None, get_query_payload=False, verbose=False, cache=True)[source]

Query the MOC Server.

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

mocpy.TimeMOC, or mocpy.STMOC The region to query the MOCServer with. Note that this can also be a space-time region with the Time-MOCs and Space-Time-MOCs. Defaults to None, which means that the search will be on the whole sky.

criteriastr

Expression to select the datasets. Examples of expressions can be found on the mocserver’s examples page. Example: “ID=*HST*” will return datasets with HST in their ID column. The star means any character.

casesensitiveBool, optional

Whether the search should take the case into account. By default, False.

fields[str], optional

Specifies which columns to retrieve. Defaults to a pre-defined subset of fields. The complete list of fields can be obtained with list_fields.

coordinate_systemstr, optional

This is the space system on which the coordinates are expressed. Can take the values sky, mars, moon… The extended list can be printed with list_coordinate_systems. Default is None, meaning that the results will have mixed frames.

intersectstr, optional

This parameter can take three different values:

  • overlaps (default) select datasets overlapping the region

  • covers returned datasets are covering the region.

  • encloses returned datasets are enclosing the region.

max_recint, optional

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

return_mocbool, optional

Specifies whether the output should be a mocpy.MOC. The returned MOC is the union of the MOCs of all the matching datasets. By default it is False and this method returns a astropy.table.Table object.

max_norderint, optional

If return_moc is set to True, this fixes the maximum precision order of the returned MOC. For one dimensional MOCs (Space-MOCs and Time-MOCs), the order is given as an integer. For Space-Time MOCs, the order should be a string with the space and time orders. Example: ‘s3 t45’

get_query_payloadbool, optional

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

verbosebool, optional

Whether to show warnings. Defaults to False.

cache: bool, optional

Whether the response should be cached.

Returns:
responseastropy.table.Table, mocpy.MOC, mocpy.TimeMOC, or mocpy.STMOC

By default, returns a table with the datasets 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.