HeasarcClass¶
- class astroquery.heasarc.HeasarcClass[source]¶
Bases:
BaseVOQuery,BaseQueryClass for accessing HEASARC data with VO protocol using the Xamin backend.
Initialize some basic useful variables
Attributes Summary
TAP service
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
Tableobject.query_tap(query, *[, maxrec, uploads])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=None, location='.')[source]¶
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.Tableorastropy.table.Row A table (or row) of data links, typically the result of locate_data.
- hoststr or None
The data host. The options are: None (default), heasarc, sciserver, aws. If None, the host is guessed based on the environment. If host == ‘sciserver’, data is copied from the local mounted data drive. If host == ‘aws’, data is downloaded from Amazon S3 Open Data Repository.
- locationstr
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.
- links
- enable_cloud(provider='aws', profile=None)[source]¶
Enable downloading public files from the cloud. Requires the boto3 library to function.
- Parameters:
- providerstr
Which cloud data provider to use. Currently, only ‘aws’ is supported.
- profilestr
Profile to use to identify yourself to the cloud provider (usually in ~/.aws/config).
- get_default_radius(catalog_name)[source]¶
Get a mission-appropriate default radius for a catalog
- Parameters:
- catalog_namestr
The name of catalog as a str
- Returns:
- The radius as
Quantity
- The radius as
- list_catalogs(*, master=False, keywords=None)[source]¶
Return a table of all available catalogs with two columns (name, description)
- Parameters:
- masterbool
Select only master catalogs. Default is False
- keywordsstr 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:
Tablewith columns: name, description
- list_columns(catalog_name, full=False)[source]¶
Return the columns available in catalog_name as a table
- Parameters:
- catalog_namestr
The name of catalog as a str
- fullbool
If True, return all columns, otherwise, return the standard list of columns
- Returns:
- result
Table A table with columns: name, description, unit
- result
- locate_data(query_result=None, catalog_name=None)[source]¶
Get links to data products Use vo/datalinks to query the data products for some query_results.
- Parameters:
- query_result
astropy.table.Tableorastropy.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_namestr
The catalog name for the which the query_result belongs to. If None, use the one from the most recent query_region call.
- query_result
- Returns:
- tableA
Tableobject.
- tableA
- query_mission_cols(mission, *, cache=True, get_query_payload=False, **kwargs)[source]¶
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_columnsinstead.- Parameters:
- missionstr
Mission catalog (short name) to search from
- fieldsstr, 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
- cachebool, 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)[source]¶
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_catalogsinstead.
- query_object(object_name, mission, *, cache=True, get_query_payload=False, **kwargs)[source]¶
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_namestr
Object to query around. To set search radius use the ‘radius’ parameter.
- missionstr
Mission catalog to search from
- cachebool
Defaults to True. If set overrides global caching behavior. See caching documentation.
- **kwargs
see
_args_to_payloadfor 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, column_filters=None, add_offset=False, get_query_payload=False, columns=None, cache=False, verbose=False, maxrec=None, **kwargs)[source]¶
Queries the HEASARC TAP server around a coordinate and returns a
Tableobject.- Parameters:
- positionstr,
astropy.coordinatesobject 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'.- catalogstr
The catalog to query. To list the available catalogs, use
list_catalogs().- spatialstr
Type of spatial query:
'cone','box','polygon', and'all-sky'. Defaults to'cone'.- radiusstr or
Quantityobject, [optional for spatial ==
'cone']. The string must be parsable byAngle. The appropriateQuantityobject fromastropy.unitsmay also be used. If None, a default value appropriate for the selected catalog is used. To see the default radius for the catalog, seeget_default_radius.- widthstr,
Quantityobject [Required for spatial ==
'box'.] The string must be parsable byAngle. The appropriateQuantityobject fromastropy.unitsmay also be used.- polygonlist, [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 ofastropy.coordinatesobject or strings that can be parsed byastropy.coordinates.ICRS.- column_filtersdict
A dictionary of column constraint filters to include in the query. Each key-value pair will be translated into an ADQL condition. - For a range query, use a tuple of two values (min, max). e.g.
{'flux': (1e-12, 1e-10)}translates toflux BETWEEN 1e-12 AND 1e-10. - For list values, use a list of values. e.g.{'object_type': ['QSO', 'GALAXY']}translates toobject_type IN ('QSO', 'GALAXY'). - For comparison queries, use a tuple of (operator, value), where operator is one of ‘=’, ‘!=’, ‘<’, ‘>’, ‘<=’, ‘>=’. e.g.{'magnitude': ('<', 15)}translates tomagnitude < 15. - For exact matches, use a single value (str, int, float). e.g.{'object_type': 'QSO'}translates toobject_type = 'QSO'. The keys should correspond to valid column names in the catalog. Uselist_columnsto see the available columns.- 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_payloadbool, optional
If
Truethen returns the generated ADQL query as str. Defaults toFalse.- columnsstr, 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.
- verbosebool, optional
If False, suppress vo warnings.
- maxrecint, optional
Maximum number of records
- positionstr,
- Returns:
- tableA
Tableobject.
- tableA
- query_tap(query, *, maxrec=None, uploads=None)[source]¶
Send query to HEASARC’s Xamin TAP using ADQL. Results in
TAPResultsformat. result.to_table givesTableformat.- Parameters:
- querystr
ADQL query to be executed
- maxrecint
maximum number of records to return
- uploadsdict
a mapping from table names used in the query to file like objects containing a votable (e.g. a file path or
Table).
- Returns:
- result
TAPResults TAP query result.
- result.to_table
Table TAP query result as
Table- result.to_qtable
QTable TAP query result as
QTable
- result