Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@class_or_instance
def query_name_async(self, name):
"""
Query CADC metadata for a name and return the corresponding metadata in
the CAOM2 format (http://www.opencadc.org/caom2/).
Parameters
----------
name: str
name of object to query for
Returns
-------
response : `~astropy.table.Table`
Results of the query in a tabular format.
"""
@class_or_instance
def query_region(self, coordinates, radius=0.3*units.deg):
"""
search for Gemini observations by target on the sky.
Given a sky position and radius, returns a `~astropy.table.Table` of Gemini observations.
Parameters
----------
coordinates : str or `~astropy.coordinates` object
The target around which to search. It may be specified as a
string or as the appropriate `~astropy.coordinates` object.
radius : str or `~astropy.units.Quantity` object, optional
Default 0.3 degrees.
The string must be parsable by `~astropy.coordinates.Angle`. The
appropriate `~astropy.units.Quantity` object from
`~astropy.units` may also be used. Defaults to 0.3 deg.
@class_or_instance
def _args_to_payload(self, catalog):
"""
Sets the common parameters for all cgi -queries
Parameters
----------
catalog : str
The name of the catalog to query.
Returns
-------
request_payload : dict
"""
request_payload = dict(catalog=catalog,
outfmt=3,
outrows=Irsa.ROW_LIMIT())
@class_or_instance
def query_region(self, coordinates=None, catalog=None, spatial='Cone', radius=10 * u.arcsec,
width=None, polygon=None, get_query_payload=False, verbose=False):
"""
This function can be used to perform either cone, box, polygon or all-sky
search in the catalogs hosted by the NASA/IPAC Infrared Science Archive (IRSA).
Parameters
----------
coordinates : str, `astropy.coordinates` object
Gives the position of the center of the cone or box if
performing a cone or box search. The string can give coordinates
in various coordinate systems, or the name of a source that will
be resolved on the server (see `here
`_ for more
details). Required if spatial is 'Cone' or 'Box'. Optional if
spatial is 'Polygon'.
@class_or_instance
def service_request_async(self, service, params, pagesize=None, page=None, **kwargs):
"""
Given a Mashup service and parameters, builds and excecutes a Mashup query.
See documentation `here `__
for information about how to build a Mashup request.
Parameters
----------
service : str
The Mashup service to query.
params : dict
JSON object containing service parameters.
pagesize : int, optional
Default None.
Can be used to override the default pagesize (set in configs) for this query only.
E.g. when using a slow internet connection.
@class_or_instance
@prepend_docstr_noreturns("\n"+_parse_args.__doc__+_parse_result.__doc__)
#@copy_argspec(_parse_args)
def query_async(self, *args, **kwargs):
"""
Returns
-------
response : `requests.Response` object
The response of the HTTP request.
"""
data_payload = self._parse_args(*args, **kwargs)
if kwargs.get('get_query_payload'):
return data_payload
response = commons.send_request(
self.QUERY_URL,
data_payload,
@class_or_instance
def get_data_urls(self, query_result, include_auxiliaries=False):
"""
Function to map the results of a CADC query into URLs to
corresponding data that can be later downloaded.
The function uses the IVOA DataLink Service
(http://www.ivoa.net/documents/DataLink/) implemented at the CADC.
It works directly with the results produced by Cadc.query_region and
Cadc.query_name but in principle it can work with other query
results produced with the Cadc query as long as the results
contain the 'caomPublisherID' column. This column is part of the
caom2.Plane table.
Parameters
----------
query_result : result returned by Cadc.query_region() or
@class_or_instance
def get_besancon_model_file(self, filename, verbose=True, timeout=5.0):
"""
Download a Besancon model from the website
Parameters
----------
filename : string
The besancon filename, with format ##########.######.resu
verbose : bool
Print details about the download process
timeout : float
Amount of time to wait after pinging the server to see if a file is
present. Default 5s, which is probably reasonable.
"""
url = os.path.join(self.url_download,filename)
@class_or_instance
def query_region_async(self, coordinates, radius=0.016666666666667,
collection=None,
get_query_payload=False):
"""
Queries the CADC for a region around the specified coordinates.
Parameters
----------
coordinates : str or `astropy.coordinates`.
coordinates around which to query
radius : str or `astropy.units.Quantity`.
the radius of the cone search
collection: Name of the CADC collection to query, optional
get_query_payload : bool, optional
Just return the dict of HTTP request parameters.
@class_or_instance
def query_criteria(self, coordinates=None, radius=0.3*units.deg, pi_name=None, program_id=None, utc_date=None,
instrument=None, observation_class=None, observation_type=None, mode=None,
adaptive_optics=None, program_text=None, objectname=None, raw_reduced=None):
"""
search a variety of known parameters against the Gemini observations.
Given various criteria, search the Gemini archive for matching observations.
Parameters
----------
coordinates : str or `~astropy.coordinates` object
The target around which to search. It may be specified as a
string or as the appropriate `~astropy.coordinates` object.
radius : str or `~astropy.units.Quantity` object, optional
Default 0.3 degrees.
The string must be parsable by `~astropy.coordinates.Angle`. The