Spectroscopy#

dace_query.spectroscopy.spectroscopy.Spectroscopy: SpectroscopyClass = <dace_query.spectroscopy.spectroscopy.SpectroscopyClass object>#

This is a singleton instance of the SpectroscopyClass class.

To use it, simply import it :

from dace_query.spectroscopy import Spectroscopy
class dace_query.spectroscopy.spectroscopy.SpectroscopyClass(dace_instance=None)#

Bases: object

The spectroscopy class. Use to retrieve data from the spectroscopy module.

Tip

A spectroscopy instance is already provided, to use it:

from dace_query.spectroscopy import Spectroscopy
download(file_type, filters=None, output_directory=None, output_filename=None)#

Download Spectroscopy products (S1D, S2D, …) and save it locally depending on the specified arguments.

Available file types
  • 's1d'

  • 's2d'

  • 'ccf'

  • 'bis'

  • 'guidance'

  • 'all'

Filters can be applied to the query via named arguments (see Filtering and sorting).

Parameters:
  • file_type (str) – The type of files to download

  • filters (Optional[dict]) – Filters to apply to the query

  • output_directory (Optional[str]) – The directory where files will be saved

  • output_filename (Optional[str]) – The filename for the download

Downloading spectroscopy products
from dace_query.spectroscopy import Spectroscopy
filters_to_use = {'file_rootpath': {'contains':['HARPS.2010-04-04T03:38:51.386.fits']}}
Spectroscopy.download('s1d', filters=filters_to_use, output_filename='files.tar.gz')
download_files(files, file_type='all', output_directory=None, output_filename=None)#

Download reduction products specified in argument for the list of raw files specified and save it locally.

Available file types
  • 's1d'

  • 's2d'

  • 'ccf'

  • 'bis'

  • 'guidance'

  • 'all'

Parameters:
  • files (list[str]) – The raw files

  • file_type (Optional[str]) – The type of files to download

  • output_directory (Optional[str]) – The directory where files will be saved

  • output_filename (Optional[str]) – The filename for the download

Returns:

None

Downloading reduction products for a list of raw files
from dace_query.spectroscopy import Spectroscopy
files_to_download = ['harps/DRS-3.5/reduced/2019-07-05/HARPS.2019-07-06T04:00:00.323.fits']
Spectroscopy.download_files(files=files_to_download, file_type='all')
get_timeseries(target, sorted_by_instrument=True, output_format=None)#

Retrieve the spectroscopy time series data for a specified target in the chosen format.

All available formats are defined in this section (see Output formats).

Parameters:
  • target (str) – The target to retrieve data from.

  • sorted_by_instrument (Optional[bool]) – Application of the instrument sorting

  • output_format (Optional[str]) – Type of data returns

Returns:

The desired data in the chosen output format

Return type:

dict[str, ndarray] or DataFrame or Table or dict

Getting spectroscopy timeseries for a target
from dace_query.spectroscopy import Spectroscopy
target_to_search = "C15-0734"
values = Spectroscopy.get_timeseries(target=target_to_search)
query_database(limit=10000, filters=None, sort=None, output_format=None)#

Query the spectroscopy database to retrieve data in the chosen format.

Filters and sorting order can be applied to the query via named arguments (see Filtering and sorting).

All available formats are defined in this section (see Output formats).

Parameters:
  • limit (Optional[int]) – Maximum number of rows to return

  • filters (Optional[dict]) – Filters to apply to the query

  • sort (Optional[dict]) – Sort order to apply to the query

  • output_format (Optional[str]) – Type of data returns

Returns:

The desired data in the chosen output format

Return type:

dict[str, ndarray] or DataFrame or Table or dict

Getting all spectroscopy data
from dace_query.spectroscopy import Spectroscopy
values = Spectroscopy.query_database()
query_region(sky_coord, angle, limit=10000, filters=None, output_format=None)#

Query a region, based on SkyCoord and Angle objects, in the spectroscopy database and retrieve data in the chosen format.

Filters can be applied to the query via named arguments (see Filtering and sorting).

All available formats are defined in this section (see Output formats).

Parameters:
  • sky_coord (SkyCoord) – Sky coordinates object from the astropy module

  • angle (Angle) – Angle object from the astropy module

  • limit (Optional[int]) – Maximum number of rows to return

  • filters (Optional[dict]) – Filters to apply to the query

  • output_format (Optional[str]) – Type of data returns

Returns:

The desired data in the chosen output format

Return type:

dict[str, ndarray] or DataFrame or Table or dict

Searching for spectroscopy data using a cone search
from dace_query.spectroscopy import Spectroscopy
from astropy.coordinates import SkyCoord, Angle
sky_coord, angle = SkyCoord("23h13m16s", "+57d10m06s", frame='icrs'), Angle('0.045d')
values = Spectroscopy.query_region(sky_coord=sky_coord, angle=angle)