dace_query.spectroscopy package

Submodules

dace_query.spectroscopy.spectroscopy module

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

Spectroscopy instance

class dace_query.spectroscopy.spectroscopy.SpectroscopyClass(dace_instance: DaceClass | None = None)

Bases: object

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

A spectroscopy instance is already provided, to use it:

>>> from dace_query.spectroscopy import Spectroscopy
ACCEPTED_FILE_TYPES = ['s1d', 's2d', 'ccf', 'bis', 'all']
download(file_type: str, filters: dict | None = None, output_directory: str | None = None, output_filename: str | None = None)

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

File type available are [ ‘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

>>> 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: list, file_type: str | None = 'all', output_directory: str | None = None, output_filename: str | None = None)

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

File type available are [‘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

>>> 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: str, sorted_by_instrument: bool | None = True, output_format: str | None = None) dict[str, ndarray] | DataFrame | Table | dict

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

>>> from dace_query.spectroscopy import Spectroscopy
>>> target_to_search = "C15-0734"
>>> values = Spectroscopy.get_timeseries(target=target_to_search)
query_database(limit: int | None = 10000, filters: dict | None = None, sort: dict | None = None, output_format: str | None = None) dict[str, ndarray] | DataFrame | Table | dict

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

>>> from dace_query.spectroscopy import Spectroscopy
>>> values = Spectroscopy.query_database()
query_region(sky_coord: SkyCoord, angle: Angle, limit: int | None = 10000, filters: dict | None = None, output_format: str | None = None) dict[str, ndarray] | DataFrame | Table | dict

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

>>> 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)

Module contents