AlmaClass¶
-
class
astroquery.alma.
AlmaClass
[source]¶ Bases:
astroquery.query.QueryWithLogin
Attributes Summary
Return a table of Cycle 0 Project IDs and associated UIDs.
Methods Summary
download_and_extract_files
(urls[, delete, …])Given a list of tarball URLs:
download_files
(files[, savedir, cache, …])Given a list of file URLs, download them
List the file contents of a UID from Cycle 0.
get_files_from_tarballs
(downloaded_files[, …])Given a list of successfully downloaded tarballs, extract files with names matching a specified regular expression.
get_project_metadata
(projectid[, cache])Get the metadata - specifically, the project abstract - for a given project ID.
help
([cache])Return the valid query parameters
help_tap
()is_proprietary
(uid)Given an ALMA UID, query the servers to determine whether it is proprietary or not.
login
([username, store_password, …])Login to the ALMA Science Portal.
query
(*args, **kwargs)Queries the service and returns a table object.
query_async
(payload[, cache, public, …])Perform a generic query with user-specified payload
query_object
(*args, **kwargs)Queries the service and returns a table object.
query_object_async
(object_name[, cache, …])Query the archive for a source name.
query_region
(*args, **kwargs)Queries the service and returns a table object.
query_region_async
(coordinate, radius[, …])Query the ALMA archive with a source name and radius
query_sia
([pos, band, time, pol, …])Use standard SIA2 attributes to query the ALMA SIA service.
query_tap
(query, **kwargs)Send query to the ALMA TAP.
retrieve_data_from_uid
(uids[, cache])Stage & Download ALMA data.
stage_data
(uids[, expand_tarfiles, return_json])Obtain table of ALMA files
Attributes Documentation
-
TIMEOUT
= 60¶
-
USERNAME
= ''¶
-
archive_url
= 'http://almascience.org'¶
-
cycle0_table
¶ Return a table of Cycle 0 Project IDs and associated UIDs.
The table is distributed with astroquery and was provided by Felix Stoehr.
-
sia
¶
-
tap
¶
Methods Documentation
-
download_and_extract_files
(urls, delete=True, regex='.*\\.fits$', include_asdm=False, path='cache_path', verbose=True)[source]¶ Given a list of tarball URLs:
Download the tarball
Extract all FITS files (or whatever matches the regex)
Delete the downloaded tarball
See
Alma.get_files_from_tarballs
for details- Parameters
- urlsstr or list
A single URL or a list of URLs
- include_asdmbool
Only affects cycle 1+ data. If set, the ASDM files will be downloaded in addition to the script and log files. By default, though, this file will be downloaded and deleted without extracting any information: you must change the regex if you want to extract data from an ASDM tarball
-
download_files
(files, savedir=None, cache=True, continuation=True, skip_unauthorized=True)[source]¶ Given a list of file URLs, download them
Note: Given a list with repeated URLs, each will only be downloaded once, so the return may have a different length than the input list
- Parameters
- fileslist
List of URLs to download
- savedirNone or str
The directory to save to. Default is the cache location.
- cachebool
Cache the download?
- continuationbool
Attempt to continue where the download left off (if it was broken)
- skip_unauthorizedbool
If you receive “unauthorized” responses for some of the download requests, skip over them. If this is False, an exception will be raised.
-
get_cycle0_uid_contents
(uid)[source]¶ List the file contents of a UID from Cycle 0. Will raise an error if the UID is from cycle 1+, since those data have been released in a different and more consistent format. See http://almascience.org/documents-and-tools/cycle-2/ALMAQA2Productsv1.01.pdf for details.
-
get_files_from_tarballs
(downloaded_files, regex='.*\\.fits$', path='cache_path', verbose=True)[source]¶ Given a list of successfully downloaded tarballs, extract files with names matching a specified regular expression. The default is to extract all FITS files
- Parameters
- downloaded_fileslist
A list of downloaded files. These should be paths on your local machine.
- regexstr
A valid regular expression
- path‘cache_path’ or str
If ‘cache_path’, will use the astroquery.Alma cache directory (
Alma.cache_location
), otherwise will use the specified path. Note that the subdirectory structure of the tarball will be maintained.
- Returns
- filelistlist
A list of the extracted file locations on disk
-
get_project_metadata
(projectid, cache=True)[source]¶ Get the metadata - specifically, the project abstract - for a given project ID.
-
is_proprietary
(uid)[source]¶ Given an ALMA UID, query the servers to determine whether it is proprietary or not. This will never be cached, since proprietarity is time-sensitive.
-
login
(username=None, store_password=False, reenter_password=False, auth_urls=['asa.alma.cl', 'rh-cas.alma.cl'])¶ Login to the ALMA Science Portal.
- Parameters
- usernamestr, optional
Username to the ALMA Science Portal. If not given, it should be specified in the config file.
- store_passwordbool, optional
Stores the password securely in your keyring. Default is False.
- reenter_passwordbool, optional
Asks for the password even if it is already stored in the keyring. This is the way to overwrite an already stored passwork on the keyring. Default is False.
-
query
(*args, **kwargs)¶ Queries the service and returns a table object.
Perform a generic query with user-specified payload
- Parameters
- payloaddictionary
Please consult the
help
method- cachedeprecated
- publicbool
Return only publicly available datasets?
- sciencebool
Return only data marked as “science” in the archive?
- legacy_columnsbool
True to return the columns from the obsolete ALMA advanced query, otherwise return the current columns based on ObsCore model.
- Table with results. Columns are those in the ALMA ObsCore model
- (see ``help_tap``) unless ``legacy_columns`` argument is set to True.
- Returns
- tableA
Table
object.
- tableA
-
query_async
(payload, cache=None, public=True, science=True, legacy_columns=False, max_retries=None, get_html_version=None, get_query_payload=None, **kwargs)[source]¶ Perform a generic query with user-specified payload
- Parameters
- payloaddictionary
Please consult the
help
method- cachedeprecated
- publicbool
Return only publicly available datasets?
- sciencebool
Return only data marked as “science” in the archive?
- legacy_columnsbool
True to return the columns from the obsolete ALMA advanced query, otherwise return the current columns based on ObsCore model.
- Returns
- Table with results. Columns are those in the ALMA ObsCore model
- (see
help_tap
) unlesslegacy_columns
argument is set to True.
-
query_object
(*args, **kwargs)¶ Queries the service and returns a table object.
Query the archive for a source name.
- Parameters
- object_namestr
The object name. Will be resolved by astropy.coord.SkyCoord
- cachedeprecated
- publicbool
Return only publicly available datasets?
- sciencebool
Return only data marked as “science” in the archive?
- payloaddict
Dictionary of additional keywords. See
help
.
- Returns
- tableA
Table
object.
- tableA
-
query_object_async
(object_name, cache=None, public=True, science=True, payload=None, **kwargs)[source]¶ Query the archive for a source name.
- Parameters
- object_namestr
The object name. Will be resolved by astropy.coord.SkyCoord
- cachedeprecated
- publicbool
Return only publicly available datasets?
- sciencebool
Return only data marked as “science” in the archive?
- payloaddict
Dictionary of additional keywords. See
help
.
-
query_region
(*args, **kwargs)¶ Queries the service and returns a table object.
Query the ALMA archive with a source name and radius
- Parameters
- coordinatesstr /
astropy.coordinates
the identifier or coordinates around which to query.
- radiusstr /
Quantity
, optional the radius of the region
- cacheDeprecated
Cache the query?
- publicbool
Return only publicly available datasets?
- sciencebool
Return only data marked as “science” in the archive?
- payloaddict
Dictionary of additional keywords. See
help
.
- coordinatesstr /
- Returns
- tableA
Table
object.
- tableA
-
query_region_async
(coordinate, radius, cache=None, public=True, science=True, payload=None, **kwargs)[source]¶ Query the ALMA archive with a source name and radius
- Parameters
- coordinatesstr /
astropy.coordinates
the identifier or coordinates around which to query.
- radiusstr /
Quantity
, optional the radius of the region
- cacheDeprecated
Cache the query?
- publicbool
Return only publicly available datasets?
- sciencebool
Return only data marked as “science” in the archive?
- payloaddict
Dictionary of additional keywords. See
help
.
- coordinatesstr /
-
query_sia
(pos=None, band=None, time=None, pol=None, field_of_view=None, spatial_resolution=None, spectral_resolving_power=None, exptime=None, timeres=None, publisher_did=None, facility=None, collection=None, instrument=None, data_type=None, calib_level=None, target_name=None, res_format=None, maxrec=None, **kwargs)[source]¶ Use standard SIA2 attributes to query the ALMA SIA service.
- Returns
- Results in
pyvo.dal.SIAResults
format. - result.table in Astropy table format
- Results in
-
query_tap
(query, **kwargs)[source]¶ Send query to the ALMA TAP. Results in pyvo.dal.TapResult format. result.table in Astropy table format
-
retrieve_data_from_uid
(uids, cache=True)[source]¶ Stage & Download ALMA data. Will print out the expected file size before attempting the download.
- Parameters
- uidslist or str
A list of valid UIDs or a single UID. UIDs should have the form: ‘uid://A002/X391d0b/X7b’
- cachebool
Whether to cache the downloads.
- Returns
- downloaded_fileslist
A list of the downloaded file paths
-
stage_data
(uids, expand_tarfiles=False, return_json=False)[source]¶ Obtain table of ALMA files
- Parameters
- uidslist or str
A list of valid UIDs or a single UID. UIDs should have the form: ‘uid://A002/X391d0b/X7b’
- expand_tarfilesbool
Expand the tarfiles to obtain lists of all contained files. If this is specified, the parent tarfile will not be included
- return_jsonbool
Return a list of the JSON data sets returned from the query. This is primarily intended as a debug routine, but may be useful if there are unusual scheduling block layouts.
- Returns
- data_file_tableTable
A table containing 3 columns: the UID, the file URL (for future downloading), and the file size
-