astro query:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- astroquery v0.4.11 »
- HEASARC Queries (`astroquery.heasarc`) »
- HeasarcClass

# HeasarcClass

class astroquery.heasarc.HeasarcClass

  Bases: `BaseVOQuery`, `BaseQuery`

  Class for accessing HEASARC data with VO protocol using the Xamin backend.

  Initialize some basic useful variables

  Attributes Summary

  `S3_BUCKET` |
  `TAR_URL` |
  `VO_URL` |
  `tap` | TAP service
  `timeout` |

  Methods Summary

  `download_data`(links[, host, location]) | Download data products in links with a choice of getting the data from either the heasarc server, sciserver, or the cloud in AWS.
  `enable_cloud`([provider, profile]) | Enable downloading public files from the cloud.
  `get_default_radius`(catalog_name) | Get a mission-appropriate default radius for a catalog
  `list_catalogs`(*[, master, keywords]) | Return a table of all available catalogs with two columns (name, description)
  `list_columns`(catalog_name[, full]) | Return the columns available in catalog_name as a table
  `locate_data`([query_result, catalog_name]) | Get links to data products Use vo/datalinks to query the data products for some query_results.
  `query_mission_cols`(mission, *[, cache, ...]) |
  `query_mission_list`(*[, cache, get_query_payload]) |
  `query_object`(object_name, mission, *[, ...]) |
  `query_region`([position, catalog, radius, ...]) | Queries the HEASARC TAP server around a coordinate and returns a `Table` object.
  `query_tap`(query, *[, maxrec]) | Send query to HEASARC's Xamin TAP using ADQL.

  Attributes Documentation

  S3_BUCKET = 'nasa-heasarc'
  TAR_URL = 'https://heasarc.gsfc.nasa.gov/xamin/TarServlet'
  VO_URL = 'https://heasarc.gsfc.nasa.gov/xamin/vo'
  tap

    TAP service

  timeout = 30

  Methods Documentation

  download_data(links, host='heasarc', location='.')

    Download data products in links with a choice of getting the data from either the heasarc server, sciserver, or the cloud in AWS.

    Parameters:
      links `astropy.table.Table` or `astropy.table.Row`

        The result from locate_data

      host str

        The data host. The options are: heasarc (default), sciserver, aws. If host == ‘sciserver’, data is copied from the local mounted data drive. If host == ‘aws’, data is downloaded from Amazon S3 Open Data Repository.

      location str

        local folder where the downloaded file will be saved. Default is current working directory

      Note that ff you are downloading large datasets (more 10 10GB),
      from the main heasarc server, it is recommended that you split
      it up, so that if the downloaded is interrupted, you do not need
      to start again.
  enable_cloud(provider='aws', profile=None)

    Enable downloading public files from the cloud. Requires the boto3 library to function.

    Parameters:
      provider str

        Which cloud data provider to use. Currently, only ‘aws’ is supported.

      profile str

        Profile to use to identify yourself to the cloud provider (usually in ~/.aws/config).

  get_default_radius(catalog_name)

    Get a mission-appropriate default radius for a catalog

    Parameters:
      catalog_name str

        The name of catalog as a str

    Returns:
      The radius as `Quantity`
  list_catalogs(*, master=False, keywords=None)

    Return a table of all available catalogs with two columns (name, description)

    Parameters:
      master bool

        Select only master catalogs. Default is False

      keywords str or list

        a str or a list of str of keywords used as search terms for catalogs. Words with a str separated by a space are AND’ed, while words in a list are OR’ed

    Returns:
      `Table` with columns: name, description
  list_columns(catalog_name, full=False)

    Return the columns available in catalog_name as a table

    Parameters:
      catalog_name str

        The name of catalog as a str

      full bool

        If True, return all columns, otherwise, return the standard list of columns

    Returns:
      result `Table`

        A table with columns: name, description, unit

  locate_data(query_result=None, catalog_name=None)

    Get links to data products Use vo/datalinks to query the data products for some query_results.

    Parameters:
      query_result `astropy.table.Table` or `astropy.table.Row`, optional

        A table that contain the search results. Typically as returned by query_region. If None, use the table from the most recent query_region call.

      catalog_name str

        The catalog name for the which the query_result belongs to. If None, use the one from the most recent query_region call.

    Returns:
      table A `Table` object.
  query_mission_cols(mission, *, cache=True, get_query_payload=False, **kwargs)

    Deprecated since version 0.4.8: The query_mission_cols function is deprecated and may be removed in a future version. Use list_columns instead.

    Query around a specific object within a given mission catalog

    NOTE: This method is deprecated, and is included only for limited backward compatibility with the old astroquery.Heasarc that uses the Browse interface. Please use `list_columns` instead.

    Parameters:
      mission str

        Mission catalog (short name) to search from

      fields str, optional

        Return format for columns from the server available options: * Standard : Return default catalog columns * All (default) : Return all catalog columns * <custom> : User defined csv list of columns to be returned

      cache bool, optional

        Defaults to True. If set overrides global caching behavior. See caching documentation.

      All other parameters have no effect
  query_mission_list(*, cache=True, get_query_payload=False)

    Deprecated since version 0.4.8: The query_mission_list function is deprecated and may be removed in a future version. Use list_catalogs instead.

    Returns a list of all available mission catalogs with descriptions.

    This method is deprecated, and is included only for limited backward compatibility with the old astroquery.Heasarc that uses the Browse interface. Please use `list_catalogs` instead.

  query_object(object_name, mission, *, cache=True, get_query_payload=False, **kwargs)

    Deprecated since version 0.4.8: The query_object function is deprecated and may be removed in a future version. Use query_region instead.

    Query around a specific object within a given mission catalog

    Parameters:
      object_name str

        Object to query around. To set search radius use the ‘radius’ parameter.

      mission str

        Mission catalog to search from

      cache bool

        Defaults to True. If set overrides global caching behavior. See caching documentation.

      **kwargs

        see `_args_to_payload` for list of additional parameters that can be used to refine search query.

  query_region(position=None, catalog=None, radius=None, *, spatial='cone', width=None, polygon=None, add_offset=False, get_query_payload=False, columns=None, cache=False, verbose=False, maxrec=None, **kwargs)

    Queries the HEASARC TAP server around a coordinate and returns a `Table` object.

    Parameters:
      position str, `astropy.coordinates` object

        Gives the position of the center of the cone or box if performing a cone or box search. Required if spatial is `'cone'` or `'box'`. Ignored if spatial is `'polygon'` or `'all-sky'`.

      catalog str

        The catalog to query. To list the available catalogs, use `list_catalogs()`.

      spatial str

        Type of spatial query: `'cone'`, `'box'`, `'polygon'`, and `'all-sky'`. Defaults to `'cone'`.

      radius str or `Quantity` object, [optional for

        spatial == `'cone'`]. The string must be parsable by `Angle`. The appropriate `Quantity` object from `astropy.units` may also be used. If None, a default value appropriate for the selected catalog is used. To see the default radius for the catalog, see `get_default_radius`.

      width str, `Quantity` object [Required for

        spatial == `'box'`.] The string must be parsable by `Angle`. The appropriate `Quantity` object from `astropy.units` may also be used.

      polygon list, [Required for spatial is `'polygon'`]

        A list of `(ra, dec)` pairs (as tuples), in decimal degrees, outlining the polygon to search in. It can also be a list of `astropy.coordinates` object or strings that can be parsed by `astropy.coordinates.ICRS`.

      add_offset: bool

        If True and spatial==’cone’, add a search_offset column that indicates the separation (in arcmin) between the requested coordinate and the entry coordinates in the catalog. Default is False.

      get_query_payload bool, optional

        If `True` then returns the generated ADQL query as str. Defaults to `False`.

      columns str, optional

        Target column list with value separated by a comma(,). Use * for all the columns. The default is to return a subset of the columns that are generally the most useful.

      verbose bool, optional

        If False, suppress vo warnings.

      maxrec int, optional

        Maximum number of records

    Returns:
      table A `Table` object.
  query_tap(query, *, maxrec=None)

    Send query to HEASARC’s Xamin TAP using ADQL. Results in `TAPResults` format. result.to_table gives `Table` format.

    Parameters:
      query str

        ADQL query to be executed

      maxrec int

        maximum number of records to return

    Returns:
      result `TAPResults`

        TAP query result.

      result.to_table `Table`

        TAP query result as `Table`

      result.to_qtable `QTable`

        TAP query result as `QTable`