OACClass

class astroquery.oac.OACClass[source]

Bases: BaseQuery

OAC class.

Attributes Summary

FORMAT

HEADERS

TIMEOUT

URL

Methods Summary

get_photometry(*args, **kwargs)

Queries the service and returns a table object.

get_photometry_async(event, *[, argument, cache])

Retrieve all photometry for specified event(s).

get_single_spectrum(*args, **kwargs)

Queries the service and returns a table object.

get_single_spectrum_async(event, time, *[, ...])

Retrieve a single spectrum at a specified time for given event.

get_spectra(*args, **kwargs)

Queries the service and returns a table object.

get_spectra_async(event, *[, cache])

Retrieve all spectra for a specified event.

query_object(*args, **kwargs)

Queries the service and returns a table object.

query_object_async(event, *[, quantity, ...])

Retrieve object(s) asynchronously.

query_region(*args, **kwargs)

Queries the service and returns a table object.

query_region_async(coordinates, *[, radius, ...])

Query a region asynchronously.

Attributes Documentation

FORMAT = None
HEADERS = {'Accept': 'text/plain', 'Content-type': 'application/json'}
TIMEOUT = 60
URL = 'https://api.astrocats.space/'

Methods Documentation

get_photometry(*args, **kwargs)

Queries the service and returns a table object.

Retrieve all photometry for specified event(s).

This is a version of the query_object method that is set up to quickly return the complete set of light curve(s) for the given event(s).

The light curves are returned by default as an Astropy Table.

Additional arguments can be specified but more complicated queries should make use of the base query_object method instead of get_photometry.

Parameters:
eventstr or list, required

Name of the event to query. Can be a list of event names.

argumentstr or list, optional

These are special conditional arguments that can be applied to a query to refine. Examples include: ‘band=i’ returns only i-band photometry, ‘first’ returns the first result, ‘sortby=attribute’ returns a table sorted by the given attribute, and ‘complete’ returns only those table rows with all of the requested attributes. A complete list of commands and their usage can be found at: https://github.com/astrocatalogs/OACAPI. The default is None.

cachebool

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

Returns:
tableA Table object.
get_photometry_async(event, *, argument=None, cache=True)[source]

Retrieve all photometry for specified event(s).

This is a version of the query_object method that is set up to quickly return the complete set of light curve(s) for the given event(s).

The light curves are returned by default as an Astropy Table.

Additional arguments can be specified but more complicated queries should make use of the base query_object method instead of get_photometry.

Parameters:
eventstr or list, required

Name of the event to query. Can be a list of event names.

argumentstr or list, optional

These are special conditional arguments that can be applied to a query to refine. Examples include: ‘band=i’ returns only i-band photometry, ‘first’ returns the first result, ‘sortby=attribute’ returns a table sorted by the given attribute, and ‘complete’ returns only those table rows with all of the requested attributes. A complete list of commands and their usage can be found at: https://github.com/astrocatalogs/OACAPI. The default is None.

cachebool

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

Returns:
resultTable

The default result is an Table object. The user can also request a JSON dictionary.

get_single_spectrum(*args, **kwargs)

Queries the service and returns a table object.

Retrieve a single spectrum at a specified time for given event.

This is a version of the query_object method that is set up to quickly return a single spectrum at a user-specified time. The time does not have to be precise as the method uses the closest option by default.

The spectrum is returned as an astropy table.

More complicated queries, or queries requesting multiple spectra, should make use of the base query_object or get_spectra methods.

Parameters:
eventstr, required

Name of the event to query. Must be a single event.

timefloat, required

A single MJD time to query. This time does not need to be exact. The closest spectrum will be returned.

cachebool

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

Returns:
tableA Table object.
get_single_spectrum_async(event, time, *, cache=True)[source]

Retrieve a single spectrum at a specified time for given event.

This is a version of the query_object method that is set up to quickly return a single spectrum at a user-specified time. The time does not have to be precise as the method uses the closest option by default.

The spectrum is returned as an astropy table.

More complicated queries, or queries requesting multiple spectra, should make use of the base query_object or get_spectra methods.

Parameters:
eventstr, required

Name of the event to query. Must be a single event.

timefloat, required

A single MJD time to query. This time does not need to be exact. The closest spectrum will be returned.

cachebool

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

Returns:
resultTable

The default result is an Table object. The user can also request a JSON dictionary.

get_spectra(*args, **kwargs)

Queries the service and returns a table object.

Retrieve all spectra for a specified event.

This is a version of the query_object method that is set up to quickly return all available spectra for a single event.

The spectra must be returned as a JSON-compliant dictionary. Multiple spectra can not be unwrapped into a csv/Table.

More complicated queries should make use of the base query_object methods.

Parameters:
eventstr, required

Name of the event to query. Can be a single event or a list of events.

cachebool

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

Returns:
tableA Table object.
get_spectra_async(event, *, cache=True)[source]

Retrieve all spectra for a specified event.

This is a version of the query_object method that is set up to quickly return all available spectra for a single event.

The spectra must be returned as a JSON-compliant dictionary. Multiple spectra can not be unwrapped into a csv/Table.

More complicated queries should make use of the base query_object methods.

Parameters:
eventstr, required

Name of the event to query. Can be a single event or a list of events.

cachebool

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

Returns:
resultdict

The default result is a JSON dictionary. An Table can not be returned.

query_object(*args, **kwargs)

Queries the service and returns a table object.

Retrieve object(s) asynchronously.

Query method to retrieve the desired quantities and attributes for an object specified by a transient name.

If no quantities or attributes are given then the query returns the top-level metadata about the event(s).

The complete list of available quantities and attributes can be found at https://github.com/astrocatalogs/schema.

Parameters:
eventstr or list, required

Name of the event to query. Can be a list of event names.

quantitystr or list, optional

Name of quantity to retrieve. Can be a list of quantities. The default is None.

attributestr or list, optional

Name of specific attributes to retrieve. Can be a list of attributes. The default is None.

argumentstr or list, optional

These are special conditional arguments that can be applied to a query to refine. Examples include: ‘band=i’ returns only i-band photometry, ‘first’ returns the first result, ‘sortby=attribute’ returns a table sorted by the given attribute, and ‘complete’ returns only those table rows with all of the requested attributes. A complete list of commands and their usage can be found at: https://github.com/astrocatalogs/OACAPI. The default is None.

data_format: str, optional

Specify the format for the returned data. The default is CSV for easy conversion to Astropy Tables. The user can also specify JSON which will return a JSON-compliant dictionary. Note: Not all queries can support CSV output.

get_query_payloadbool, optional

When set to True the method returns the HTTP request parameters as a dict. The actual HTTP request is not made. The default value is False.

cachebool

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

Returns:
tableA Table object.
query_object_async(event, *, quantity=None, attribute=None, argument=None, data_format='csv', get_query_payload=False, cache=True)[source]

Retrieve object(s) asynchronously.

Query method to retrieve the desired quantities and attributes for an object specified by a transient name.

If no quantities or attributes are given then the query returns the top-level metadata about the event(s).

The complete list of available quantities and attributes can be found at https://github.com/astrocatalogs/schema.

Parameters:
eventstr or list, required

Name of the event to query. Can be a list of event names.

quantitystr or list, optional

Name of quantity to retrieve. Can be a list of quantities. The default is None.

attributestr or list, optional

Name of specific attributes to retrieve. Can be a list of attributes. The default is None.

argumentstr or list, optional

These are special conditional arguments that can be applied to a query to refine. Examples include: ‘band=i’ returns only i-band photometry, ‘first’ returns the first result, ‘sortby=attribute’ returns a table sorted by the given attribute, and ‘complete’ returns only those table rows with all of the requested attributes. A complete list of commands and their usage can be found at: https://github.com/astrocatalogs/OACAPI. The default is None.

data_format: str, optional

Specify the format for the returned data. The default is CSV for easy conversion to Astropy Tables. The user can also specify JSON which will return a JSON-compliant dictionary. Note: Not all queries can support CSV output.

get_query_payloadbool, optional

When set to True the method returns the HTTP request parameters as a dict. The actual HTTP request is not made. The default value is False.

cachebool

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

Returns:
resultTable

The default result is an Table object. The user can also request a JSON dictionary.

query_region(*args, **kwargs)

Queries the service and returns a table object.

Query a region asynchronously.

Query method to retrieve the desired quantities and attributes for an object specified by a region on the sky. The search can be either a cone search (using the radius parameter) or a box search (using the width/height parameters).

IMPORTANT: The API can only query a single set of coordinates at a time.

The complete list of available quantities and attributes can be found at https://github.com/astrocatalogs/schema.

Parameters:
coordinatesstr or astropy.coordinates.

A single set of ra/dec coorindates to query. Can be either a list with [ra,dec] or an astropy coordinates object. Can be given in sexigesimal or decimal format. The API can not query multiple sets of coordinates.

radiusstr, float or astropy.units.Quantity, optional

The radius, in arcseconds, of the cone search centered on coordinates. Should be a single, float-convertable value or an astropy quantity. The default value is None.

widthstr, float or astropy.units.Quantity, optional

The width, in arcseconds, of the box search centered on coordinates. Should be a single, float-convertable value or an astropy quantity. The default value is None.

heightstr, float or astropy.units.Quantity, optional

The height, in arcseconds, of the box search centered on coordinates. Should be a single, float-convertable value or an astropy quantity. The default value is None.

quantity: str or list, optional

Name of quantity to retrieve. Can be a a list of quantities. The default is None.

attribute: str or list, optional

Name of specific attributes to retrieve. Can be a list of attributes. The default is None.

argumentstr or list, optional

These are special conditional arguments that can be applied to a query to refine. Examples include: ‘band=i’ returns only i-band photometry, ‘first’ returns the first result, ‘sortby=attribute’ returns a table sorted by the given attribute, and ‘complete’ returns only those table rows with all of the requested attributes. A complete list of commands and their usage can be found at: https://github.com/astrocatalogs/OACAPI. The default is None.

data_format: str, optional

Specify the format for the returned data. The default is CSV for easy conversion to Astropy Tables. The user can also specify JSON which will return a JSON-compliant dictionary. Note: Not all queries can support CSV output.

get_query_payloadbool, optional

When set to True the method returns the HTTP request parameters as a dict. The actual HTTP request is not made. The default value is False.

cachebool

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

Returns:
tableA Table object.
query_region_async(coordinates, *, radius=None, height=None, width=None, quantity=None, attribute=None, argument=None, data_format='csv', get_query_payload=False, cache=True)[source]

Query a region asynchronously.

Query method to retrieve the desired quantities and attributes for an object specified by a region on the sky. The search can be either a cone search (using the radius parameter) or a box search (using the width/height parameters).

IMPORTANT: The API can only query a single set of coordinates at a time.

The complete list of available quantities and attributes can be found at https://github.com/astrocatalogs/schema.

Parameters:
coordinatesstr or astropy.coordinates.

A single set of ra/dec coorindates to query. Can be either a list with [ra,dec] or an astropy coordinates object. Can be given in sexigesimal or decimal format. The API can not query multiple sets of coordinates.

radiusstr, float or astropy.units.Quantity, optional

The radius, in arcseconds, of the cone search centered on coordinates. Should be a single, float-convertable value or an astropy quantity. The default value is None.

widthstr, float or astropy.units.Quantity, optional

The width, in arcseconds, of the box search centered on coordinates. Should be a single, float-convertable value or an astropy quantity. The default value is None.

heightstr, float or astropy.units.Quantity, optional

The height, in arcseconds, of the box search centered on coordinates. Should be a single, float-convertable value or an astropy quantity. The default value is None.

quantity: str or list, optional

Name of quantity to retrieve. Can be a a list of quantities. The default is None.

attribute: str or list, optional

Name of specific attributes to retrieve. Can be a list of attributes. The default is None.

argumentstr or list, optional

These are special conditional arguments that can be applied to a query to refine. Examples include: ‘band=i’ returns only i-band photometry, ‘first’ returns the first result, ‘sortby=attribute’ returns a table sorted by the given attribute, and ‘complete’ returns only those table rows with all of the requested attributes. A complete list of commands and their usage can be found at: https://github.com/astrocatalogs/OACAPI. The default is None.

data_format: str, optional

Specify the format for the returned data. The default is CSV for easy conversion to Astropy Tables. The user can also specify JSON which will return a JSON-compliant dictionary. Note: Not all queries can support CSV output.

get_query_payloadbool, optional

When set to True the method returns the HTTP request parameters as a dict. The actual HTTP request is not made. The default value is False.

cachebool

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

Returns:
resultTable

The default result is an Table object. The user can also request a JSON dictionary.