Spectroscopy#
- dace_query.spectroscopy.spectroscopy.Spectroscopy: SpectroscopyClass = <dace_query.spectroscopy.spectroscopy.SpectroscopyClass object>#
This is a singleton instance of the
SpectroscopyClassclass.To use it, simply import it :
from dace_query.spectroscopy import Spectroscopy
- class dace_query.spectroscopy.spectroscopy.SpectroscopyClass(dace_instance=None)#
Bases:
objectThe 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
- browse_products(filters, file_type=None, drs_version=None, output_format=None)#
List the filenames of all available data products for observations (raw frames) matching the specified filters.
This method mirrors the signature of
download(), making it ideal for previewing available data products before performing any actual downloads. Use it to examine what files would be retrieved based on yourfilters,file_type, anddrs_versionYou must specify filtering criteria (such as target name, file key, or other parameters) to limit the scope of the operation. This requirement helps avoid unintentionally requesting large amounts of data from the spectroscopy database.
Filters can be applied to the query via the
filtersargument (see Filtering and sorting). You can filter on any field available for a raw frame inquery_database()(e.g.target_name,spectrum_id,date_night,file_rootname, …).Available fields for
filtersargumentVariable name
Description
spectrum_idUsed internally by DACE, The unique identifier associated with an observation (a raw frame)
target_nameName of the observed target (Uses the SIMBAD common name if the target has been resolved. Else it uses the name extracted from the
.fitsfile). Case sensitive. Filtering on this field (ex:target_name : { equals : ["HD 10700"]}) will use a target resolver to find the associated target. Meaning you may use any of the target’s identifiers as long as the target has been resolved by DACE, else you will have to use the name from the raw frame’s.fitsfile.posThe coordinates in the format :
'<ra (deg)> / <dec (signed deg)>'instrument_nameThe name of the instrument used for the observation. Some instruments are split into versions (e.g.
ESPRESSO18,ESPRESSO19) to account for hardware changes capable of introducing offsets. Separating them simplifies the creation of normalized timeseries.program_nameThe name of the program associated with this observation.
dpr_catgDetermines the category of observation. Can be either
SCIENCE(actual observation of a target) orCALIB(calibration frames).dpr_typeDetermines the type of observation. Varies on the instrument but contains most of the time what each fiber was observing and the spectral type. Some examples : (
OBJECT,FP,FLAT,OFF,LAMP,STAR,SKYorSTAR,SKY,G9).obs_start_mjdThe start time of the observation in Modified Julian Date (MJD).
file_rootnameThe name of the raw frame in the file system, for example
ESPRE.2018-07-08T10:55:25.173.fits.date_nightThe date of the night of the observation in the format
YYYY-MM-DD.program_codeThe code of the program associated with this observation. Extracted from the
.fitsheader without any modification, for example60.A-9036(A).parallaxThe parallax of the target in milliarcseconds (mas). It can be empty or
0if the parallax was not provided in the.fitsheader.target_catnameThe name of the target extracted from the
.fitsheader without any modification.sp_typeThe spectral type of the target. It can be empty if the spectral type was not provided in the
.fitsheader.mag_vThe V magnitude of the target. Depending on the instrument, it can be empty if the V magnitude was not provided in the
.fitsheader or if it is outside of the range of the instrument.mag_iThe I magnitude of the target. Depending on the instrument, it can be empty if the I magnitude was not provided in the
.fitsheader or if it is outside of the range of the instrument.pm_aThe proper motion in right ascension of the target in milliarcseconds per year (mas/yr). It can be empty or
0if the proper motion was not provided in the.fitsheader.pm_dThe total proper motion of the target in milliarcseconds per year (mas/yr). It can be empty or
0if the proper motion was not provided in the.fitsheader.ra_degThe right ascension of the target in degrees (ICRS frame, J2000 epoch).
dec_degThe declination of the target in degrees (ICRS frame, J2000 epoch).
has_products_to_displayUsed internally by DACE to determine if the raw frame has products to display in the web interface. It is
Trueif there are products to display andFalseotherwise.has_rvUsed internally by DACE to determine if the raw frame has been reduced and has associated radial velocities. It is
Trueif there is atleast one associated radial velocity andFalseotherwise.has_guiding_frameUsed internally by DACE to determine if the raw frame has an associated guiding frame. It is
Trueif there is an associated guiding frame andFalseotherwise.Filtering by DRS version
You can restrict which products are returned by specifying the
drs_versionargument.Value
Description
NoneDo not filter by DRS version (default)
'latest'Select the latest available DRS version
'DRS-<major>.<minor>.<patch>'Select a specific DRS version (e.g.
'DRS-3.3.10'or'3.3.10'or'DRS-3.3.10-CCF')Example:
from dace_query.spectroscopy import Spectroscopy filters = {'target_name': {'equal': ['TOI178']}} # List CCF files for the latest DRS version available products = Spectroscopy.browse_products(filters=filters, file_type='ccf', drs_version='latest') # List S1D files for a specific DRS version (e.g. DRS-3.3.10) products = Spectroscopy.browse_products(filters=filters, file_type='s1d', drs_version='DRS-3.3.10') # List S2D files products for a specific DRS version with a specifiic extraction method (e.g. DRS-3.3.10-CCF or DRS-3.3.10-SBART) products = Spectroscopy.browse_products(filters=filters, file_type='s2d', drs_version='DRS-3.3.10-CCF')
Filtering file types
You can specify the type of files to list using the
file_typeargument.Available values:
Value
Corresponding file types
's1d'S1D_A,S1D_B's2d'S2D_A,S2D_B'ccf'CCF_A,CCF_B'all'orNoneAll file types (default)
You can also pass exact file types (e.g.
'S1D_A'or'CCF_B')or a list of exact file types (e.g.
['S1D_A', 'S1D_B', 'CCF_B']) to download specific products.- Parameters:
filters (dict) – Filters to apply to the query
file_type (str) – The type of files to download (see “Filtering file types”)
drs_version (Optional[Union[str, list[str]]]) – The DRS version of the products to browse (e.g.
'latest'or specific version in the format'DRS-<major>.<minor>.<patch>-<rv_extraction_method>')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
Listing all available products for a given target name
from dace_query.spectroscopy import Spectroscopy target_name = 'TOI178' values = Spectroscopy.browse_products(filters={'target_name':{'equal': [target_name]}})
Listing all available products using a list of raw frames
from dace_query.spectroscopy import Spectroscopy # Let's say we want to get a list of all observations (raw frames) for 'HR3259' on '2018-11-03' raw_frame_filters = dict(target_name=dict(equal=['HR3259']), date_night=dict(equal=['2018-11-03'])) raw_frames = Spectroscopy.query_database(filters=raw_frame_filters, output_format='dict') # Get the unique ids of those raw frames spectrum_ids = raw_frames.get('spectrum_id') # Pass the list of ids to browse_products to get the list of available products for those spectra if spectrum_ids: products = Spectroscopy.browse_products(filters={'spectrum_id':{'equal':spectrum_ids}}, output_format='dict')
Listing all available
CCF_Afor a given target namefrom dace_query.spectroscopy import Spectroscopy target_name = 'TOI178' filters = {'target_name':{'equal': [target_name]}} values = Spectroscopy.browse_products(filters=filters, file_type='CCF_A')
Listing all
ccffiles for a given target name and the latest DRS version availablefrom dace_query.spectroscopy import Spectroscopy target_name = 'TOI178' filters = {'target_name':{'equal': [target_name]}} Spectroscopy.browse_products(filters=filters, file_type='ccf', drs_version='latest')
Listing all
s1dfiles for a given target name and a specific DRS version (e.g.DRS-3.3.10)from dace_query.spectroscopy import Spectroscopy target_name = 'TOI178' filters = {'target_name':{'equal': [target_name]}} Spectroscopy.browse_products(filters=filters, file_type='s1d', drs_version='DRS-3.3.10')
- download(filters, file_type=None, drs_version=None, compressed=False, output_directory=None, output_filename=None)#
Download reduced products (
CCF,S1D,S2D, etc.) for observations (raw frames) matching the specified filters.Before downloading: you can use
browse_products()with identical parameters to preview what files would be downloaded. This is particularly useful for large data sets.You must specify filtering criteria (such as target name, file key, or other parameters) to limit the scope of the operation. This requirement helps avoid unintentionally requesting large amounts of data from the spectroscopy database.
Filters can be applied to the query via the
filtersargument (see Filtering and sorting). You can filter on any field available for a raw frame inquery_database()(e.g.target_name,spectrum_id,date_night,file_rootname, …).Available fields for
filtersargumentVariable name
Description
spectrum_idUsed internally by DACE, The unique identifier associated with an observation (a raw frame)
target_nameName of the observed target (Uses the SIMBAD common name if the target has been resolved. Else it uses the name extracted from the
.fitsfile). Case sensitive. Filtering on this field (ex:target_name : { equals : ["HD 10700"]}) will use a target resolver to find the associated target. Meaning you may use any of the target’s identifiers as long as the target has been resolved by DACE, else you will have to use the name from the raw frame’s.fitsfile.posThe coordinates in the format :
'<ra (deg)> / <dec (signed deg)>'instrument_nameThe name of the instrument used for the observation. Some instruments are split into versions (e.g.
ESPRESSO18,ESPRESSO19) to account for hardware changes capable of introducing offsets. Separating them simplifies the creation of normalized timeseries.program_nameThe name of the program associated with this observation.
dpr_catgDetermines the category of observation. Can be either
SCIENCE(actual observation of a target) orCALIB(calibration frames).dpr_typeDetermines the type of observation. Varies on the instrument but contains most of the time what each fiber was observing and the spectral type. Some examples : (
OBJECT,FP,FLAT,OFF,LAMP,STAR,SKYorSTAR,SKY,G9).obs_start_mjdThe start time of the observation in Modified Julian Date (MJD).
file_rootnameThe name of the raw frame in the file system, for example
ESPRE.2018-07-08T10:55:25.173.fits.date_nightThe date of the night of the observation in the format
YYYY-MM-DD.program_codeThe code of the program associated with this observation. Extracted from the
.fitsheader without any modification, for example60.A-9036(A).parallaxThe parallax of the target in milliarcseconds (mas). It can be empty or
0if the parallax was not provided in the.fitsheader.target_catnameThe name of the target extracted from the
.fitsheader without any modification.sp_typeThe spectral type of the target. It can be empty if the spectral type was not provided in the
.fitsheader.mag_vThe V magnitude of the target. Depending on the instrument, it can be empty if the V magnitude was not provided in the
.fitsheader or if it is outside of the range of the instrument.mag_iThe I magnitude of the target. Depending on the instrument, it can be empty if the I magnitude was not provided in the
.fitsheader or if it is outside of the range of the instrument.pm_aThe proper motion in right ascension of the target in milliarcseconds per year (mas/yr). It can be empty or
0if the proper motion was not provided in the.fitsheader.pm_dThe total proper motion of the target in milliarcseconds per year (mas/yr). It can be empty or
0if the proper motion was not provided in the.fitsheader.ra_degThe right ascension of the target in degrees (ICRS frame, J2000 epoch).
dec_degThe declination of the target in degrees (ICRS frame, J2000 epoch).
has_products_to_displayUsed internally by DACE to determine if the raw frame has products to display in the web interface. It is
Trueif there are products to display andFalseotherwise.has_rvUsed internally by DACE to determine if the raw frame has been reduced and has associated radial velocities. It is
Trueif there is atleast one associated radial velocity andFalseotherwise.has_guiding_frameUsed internally by DACE to determine if the raw frame has an associated guiding frame. It is
Trueif there is an associated guiding frame andFalseotherwise.Filtering by DRS version
You can restrict which products are returned by specifying the
drs_versionargument.Value
Description
NoneDo not filter by DRS version (default)
'latest'Select the latest available DRS version
'DRS-<major>.<minor>.<patch>'Select a specific DRS version (e.g.
'DRS-3.3.10'or'3.3.10'or'DRS-3.3.10-CCF')Example:
from dace_query.spectroscopy import Spectroscopy filters = {'target_name': {'equal': ['TOI178']}} # Download CCFs for the latest DRS version available Spectroscopy.download(filters=filters, file_type='ccf', drs_version='latest') # Download S1D products for a specific DRS version (e.g. DRS-3.3.10) Spectroscopy.download(filters=filters, file_type='s1d', drs_version='DRS-3.3.10') # Download S2D products for a specific DRS version with a specifiic extraction method (e.g. DRS-3.3.10-CCF or DRS-3.3.10-SBART) Spectroscopy.download(filters=filters, file_type='s2d', drs_version='DRS-3.3.10-CCF')
Filtering file types
You can specify the type of files to download using the
file_typeargument.Available values:
Value
Corresponding file types
's1d'S1D_A,S1D_B's2d'S2D_A,S2D_B'ccf'CCF_A,CCF_B'all'orNoneAll file types (default)
You can also pass exact file types (e.g.
'S1D_A'or'CCF_B')or a list of exact file types (e.g.
['S1D_A', 'S1D_B', 'CCF_B']) to download specific products.To check which file types are available for your filters, you may use
browse_products().Files are sent in different formats based on the number of files to download:
Single file: native format (e.g.
.fits)Multiple files: archive (
.taror.tar.gz)
Specifying compression behavior
You can control the compression behavior of multi-file downloads using the
compressedparameter.compressed=Trueproduces a.tar.gzarchivecompressed=Falseproduces a.tararchive
When downloading large datasets, disabling compression (
compressed=False) may reduce CPU usage and speed up the download at the cost of larger files.- Parameters:
filters (dict) – Filters to apply to the query
file_type (Optional[str]) – The type of files to download (see “Filtering file types”)
drs_version (Optional[Union[str, list[str]]]) – The DRS version of the products to browse (e.g.
'latest'or specific version in the format'DRS-<major>.<minor>.<patch>-<rv_extraction_method>')compressed (Optional[bool]) – Whether to return a compressed archive when multiple files are downloaded
output_directory (Optional[str]) – The directory where files will be saved (defaults to the current working directory)
output_filename (Optional[str]) – The filename for the download (defaults to the server-provided filename)
- Returns:
None
- Return type:
None
Downloading all available products for a specific observation (raw frame)
from dace_query.spectroscopy import Spectroscopy filters_to_use = {'file_rootname': {'contains':['HARPS.2010-04-04T03:38:51.386']}} Spectroscopy.download(filters=filters_to_use)
Downloading products using a list of raw frames
from dace_query.spectroscopy import Spectroscopy # Let's say we want to get a list of all observations (raw frames) for 'HR3259' on '2018-11-03' raw_frame_filters = dict(target_name=dict(equal=['HR3259']), date_night=dict(equal=['2018-11-03'])) raw_frames = Spectroscopy.query_database(filters=raw_frame_filters, output_format='dict') # Get the unique ids of those raw frames spectrum_ids = raw_frames.get('spectrum_id') # Pass the list of ids to download() to get all products for those spectra if spectrum_ids: Spectroscopy.download(filters={'spectrum_id':{'equal':spectrum_ids}})
Downloading all
CCF_Afiles for a given target namefrom dace_query.spectroscopy import Spectroscopy target_name = 'TOI178' filters = {'target_name':{'equal': [target_name]}} Spectroscopy.download(file_type='CCF_A', filters=filters)
Downloading all
ccffiles for a given target name and the latest DRS version availablefrom dace_query.spectroscopy import Spectroscopy target_name = 'TOI178' filters = {'target_name':{'equal': [target_name]}} Spectroscopy.download(file_type='ccf', filters=filters, drs_version='latest')
Downloading all
s1dfiles for a given target name and a specific DRS version (e.g.DRS-3.3.10)from dace_query.spectroscopy import Spectroscopy target_name = 'TOI178' filters = {'target_name':{'equal': [target_name]}} Spectroscopy.download(file_type='s1d', filters=filters, drs_version='DRS-3.3.10')
- download_files(files, file_type='all', output_directory=None, output_filename=None)#
Deprecated since version 3.0.0: This method is no longer supported and will be removed in a future version. Use
download()instead.Download reduction products specified in argument for the list of raw files specified and save it locally.
Available file types
's1d''s2d''ccf''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_guiding_frame(spectrum_id)#
Retrieve the guiding frame associated with a given raw frame (using the raw frame’s unique identifier
spectrum_idto find it).The guiding frame frame is returned as an
astropy.io.fits.HDUListobject, which can be manipulated using the astropy library. As such, actual frame data and headers are provided by the API, just like when opening a fits file using astropy’sfits.open()method.You can for example access the data of the guiding frame using
guiding_frame[0].dataand its header usingguiding_frame[0].header.- Parameters:
spectrum_id (int) – The unique id of a raw frame to retrieve the guiding frame for
- Returns:
The guiding frame as an astropy.io.fits.HDUList object, or None if no guiding frame is available
- Return type:
fits.HDUList or None
Getting the guiding frame for a specific spectrum ID
from dace_query.spectroscopy import Spectroscopy spectrum_id_to_search = 6 # This is equivalent to opening the fits file of the guiding frame directly # and reading its data using fits.open() from astropy.io guiding_frame = Spectroscopy.get_guiding_frame(spectrum_id=spectrum_id_to_search)
Getting searching for an observation using
query_databaseand getting its guiding framefrom matplotlib import pyplot as plt from dace_query.spectroscopy import Spectroscopy # Set the raw frame filters and fetch the raw frame using query_database file_rootname = 'ESPRE.2018-07-08T08:02:09.755.fits' raw_frame = Spectroscopy.query_database(filters={"file_rootname":{"equals":[file_rootname]}}) # Extract the spectrum_id of the first raw frame matching the filters # (there should only be one in this case since we filtered by file name) spectrum_id = raw_frame.get('spectrum_id')[0] # This is equivalent to opening the fits file of the guiding frame directly # and reading its data using fits.open() from astropy.io guiding_frame = Spectroscopy.get_guiding_frame(spectrum_id)
Displaying the guiding frame using matplotlib
from matplotlib import pyplot as plt from dace_query.spectroscopy import Spectroscopy # This is equivalent to opening the fits file of the guiding frame directly # and reading its data using fits.open() from astropy.io guiding_frame = Spectroscopy.get_guiding_frame(spectrum_id=6) # Only plot data if a guiding frame was successfully retrieved if guiding_frame is not None: # Extract the data from the first HDU (Header Data Unit) of the fits file data = guiding_frame[0].data # Display the image using matplotlib plt.imshow(data, origin='lower', cmap='viridis') plt.colorbar() plt.show()
Displaying the guiding frame of a perticular point from
get_timeseriesusing matplotlibfrom matplotlib import pyplot as plt from dace_query.spectroscopy import Spectroscopy # Get the spectroscopy timeseries for a target target = 'HR3259' # Build the filters to only include points from a specific instrument group (e.g. ESPRESSO) instrument_group_filters = { "instrument_group" : { "equals" : ["ESPRESSO"] } } # Get the timeseries for that target with the instrument group filters applied timeseries = Spectroscopy.get_timeseries(target=target, filters=instrument_group_filters, sorted_by_instrument=True) # Extract the spectrum_id of a particular point in the timeseries (for example the first point of the first instrument/DRS/mode available) first_instrument = next(iter(timeseries)) first_drs = next(iter(timeseries[first_instrument])) first_ins_mode = next(iter(timeseries[first_instrument][first_drs])) # For this example, we simply get the spectrum_id of the first point in the timeseries, # but you can of course select any point you want based on the available metadata (e.g. rjd, rv, etc.) # and get its spectrum_id to retrieve the corresponding guiding frame spectrum_id = timeseries[first_instrument][first_drs][first_ins_mode]['spectrum_id'][0] # This is equivalent to opening the fits file of the guiding frame directly # and reading its data using fits.open() from astropy.io guiding_frame = Spectroscopy.get_guiding_frame(spectrum_id=spectrum_id) # Only plot data if a guiding frame was successfully retrieved if guiding_frame is not None: # Extract the data from the first HDU (Header Data Unit) of the fits file data = guiding_frame[0].data # Display the image using matplotlib plt.imshow(data, origin='lower', cmap='viridis') plt.colorbar() plt.show()
- get_timeseries(target, limit=10000, filters=None, sort=None, rv_sources=[Source.STANDARD_PROCESSING, Source.PUBLICATION], drs_version=None, sorted_by_instrument=True, output_format=None)#
Retrieve the spectroscopy time series data for a specified target in the chosen format.
Filters can be applied to the query via named arguments (see Filtering and sorting).
Available fields for
filtersargumentName
Description
Unit
Data Type
rv_idUnique identifier for RV measurement
-strrjdBarycentric Reduced Julian Date of the observation
dayfloattexpExposure time
secondfloatcal_bervBarycentric Earth Radial Velocity (BERV)
m/sfloatcal_drift_noiseDrift Noise
m/sfloatcal_drift_rvDrift Used
m/sfloatcal_therrorTh Error
m/sfloatcal_thfileFilename of the ThAr calibration file used
-strccf_asymAsymetry of the CCF
-floatccf_bispanBisector Span of the CCF
m/sfloatccf_bispan_errUncertainty on the Bisector Span
m/sfloatccf_contrastContrast of the CCF
-floatccf_contrast_errUncertainty on the CCF Contrast
-floatccf_maskMask used for CCF computation
-strccf_fwhmFull Width at Half Maximum (FWHM) of the CCF
m/sfloatccf_fwhm_errUncertainty on the CCF FWHM
m/sfloatccf_noiseNoise in the CCF
-floatrvRadial Velocity
m/sfloatrv_errUncertainty on the Radial Velocity
m/sfloatins_modeMode of the instrument during observation
-strdrs_qcWhether the DRS quality check was passed (
Truemeans a point passed the DRS QC, andFalsemeans it failed.) the DACE webapp filters outdrs_qc=Falsepoints by default but this is not the case for the API. It is recommended to filterdrs_qc=Truewhen using the API.-boolcal_thar_lamp_offset_arThAr Lamp Offset
m/sfloatcal_thar_lamp_offset_ar1ThAr Lamp Offset 1
m/sfloatcal_thar_lamp_offset_ar2ThAr Lamp Offset 2
m/sfloatspectro_sn10Signal to Noise ratio at order 10
-floatspectro_sn20Signal to Noise ratio at order 20
-floatspectro_sn30Signal to Noise ratio at order 30
-floatspectro_sn40Signal to Noise ratio at order 40
-floatspectro_sn50Signal to Noise ratio at order 50
-floatspectro_sn60Signal to Noise ratio at order 60
-floatspectro_halphaH Alpha activity index
-floatspectro_halpha_errUncertainty on H Alpha activity index
-floatspectro_halpha_flx_hH Alpha flux in the H window
-floatspectro_halpha_flx_h_errUncertainty on H Alpha flux in the H window
-floatspectro_halpha_flx_r1H Alpha flux in the R1 window
-floatspectro_halpha_flx_r1_errUncertainty on H Alpha flux in the R1 window
-floatspectro_halpha_flx_r2H Alpha flux in the R2 window
-floatspectro_halpha_flx_r2_errUncertainty on H Alpha flux in the R2 window
-floatspectro_naSodium activity index
-floatspectro_na_errUncertainty on Sodium activity index
-floatspectro_na_flx_d1Sodium flux in the D1 window
-floatspectro_na_flx_d1_errUncertainty on Sodium flux in the D1 window
-floatspectro_na_flx_d2Sodium flux in the D2 window
-floatspectro_na_flx_d2_errUncertainty on Sodium flux in the D2 window
-floatspectro_na_flx_r1Sodium flux in the R1 window
-floatspectro_na_flx_r1_errUncertainty on Sodium flux in the R1 window
-floatspectro_na_flx_r2Sodium flux in the R2 window
-floatspectro_na_flx_r2_errUncertainty on Sodium flux in the R2 window
-floatspectro_caCalcium activity index
-floatspectro_ca_errUncertainty on Calcium activity index
-floatspectro_ca_flx_kCalcium flux in the K window
-floatspectro_ca_flx_k_errUncertainty on Calcium flux in the K window
-floatspectro_ca_flx_hCalcium flux in the H window
-floatspectro_ca_flx_h_errUncertainty on Calcium flux in the H window
-floatspectro_ca_flx_r1Calcium flux in the R1 window
-floatspectro_ca_flx_r1_errUncertainty on Calcium flux in the R1 window
-floatspectro_ca_flx_r2Calcium flux in the R2 window
-floatspectro_ca_flx_r2_errUncertainty on Calcium flux in the R2 window
-floatspectro_smwMount Wilson S activity index
-floatspectro_smw_errUncertainty on Mount Wilson S activity index
-floatspectro_rhkLog(R’/HK) activity index
-floatspectro_rhk_errUncertainty on Log(R’/HK) activity index
-floatspectrum_idUsed internally by DACE, The unique identifier associated with an observation (a raw frame)
-intinstrument_groupIntrument group of the instrument used for the observation (e.g.
ESPRESSOforESPRESSO18)-strinstrument_idUnique identifier for the instrument used for the observation (see
instrument_name-intinstrument_nameThe name of the instrument used for the observation. Some instruments are split into versions (e.g.
ESPRESSO18,ESPRESSO19) to account for hardware changes capable of introducing offsets. Separating them simplifies the creation of normalized timeseries.-strtarget_idUsed internally by DACE, unique identifier for target
-inttarget_catnameName of the observed target (Uses the SIMBAD common name if the target has been resolved. Else it uses the name extracted from
.fits). Case sensitive.-strra_degRight Ascension in decimal degrees
degfloatdec_degDeclination in signed decimal degrees
degfloatposThe coordinates in the format :
"<ra_deg> / <dec_signed_deg>"degfloatdate_nightThe date of the night of the observation in the format
YYYY-MM-DD.-strdpr_catgDetermines the category of observation. Can be either
SCIENCE(actual observation of a target) orCALIB(calibration frames).-strdpr_typeDetermines the type of observation. Varies on the instrument but contains most of the time what each fiber was observing and the spectral type. Some examples : (
OBJECT,FP,FLAT,OFF,LAMP,STAR,SKYorSTAR,SKY,G9).-strprogram_idUsed internally by DACE, Unique identifier for the observing program
-intprogram_codeThe code of the program associated with this observation.
-strpub_refPublication Reference, can be empty if the point does not come from a publication
-strpub_bibcodePublication Bibcode/DOI, can be empty if the point does not come from a publication
-strfile_rootnameThe name of the raw frame in the file system, for example
ESPRE.2018-07-08T10:55:25.173.fits.-strstatus_publicWhether the data is publicly available (If
Truethe data is public, ifFalsethe data is still private on DACE and not accessible to all users)-booldrs_idUsed internally by DACE, Unique identifier of a given DRS version
-intrv_extraction_methodMethod used by the DRS for radial velocity extraction (for example
CCFfor standard DRS or the name of a post-processing e.g.SBART-strversion_majorMajor version of the DRS software used to obtain this point
-intversion_minorMinor version of the DRS software used to obtain this point
-intversion_patchPatch version of the DRS software used to obtain this point
-intsource_product_idID of the file from which the RV was extracted
-intsource_product_file_extFile extension of the file from which the RV was extracted (e.g.
POSTDRS_A,POSTDRS_SKYSUB_A,SBARTetc.). To filter on this field, it is recommended to use theSourceenum instead.-strsource_product_file_rootnameFile path to the file from which the RV was extracted
-stris_latest_drsWhether the DRS used to get this radial velocity is the latest for this instrument (HARPS, ESPRESSO, etc.) and rv extraction method (CCF, SBART, ANTARESS, etc.)
-boolAll available formats are defined in this section (see Output formats).
Using
sorted_by_instrument=Truewill sort the results byinstrument → DRS version → instrument modeand return a nested dictionary structure as shown in the sample output below.Note : when using
sorted_by_instrument=True, theoutput_formatargument is ignored.Sample output with
sorted_by_instrument=True{ 'HARPS15': { 'DRS-3.3.6-CCF': { 'EGGS': { 'rjd': [...], 'rv': [...],, ... }, 'HARPS': { 'rjd': [...],, 'rv': [...],, ... } }, 'DRS-3.3.10-CCF': { ... } 'DRS-3.3.10-SBART': { ... } }, 'ESPRESSO19': { ... } }
Selecting radial velocity sources
The
rv_sourcesargument allows to filter the radial velocity data based on their provenance (e.g. standard DRS processing, specific post-processing, or publications). See theSourceenum for available options and usage examples.By default, this method returns RVs from
Source.STANDARD_PROCESSING(standard DRS / CCF) andSource.PUBLICATION.Some DRS or postprocesses may be marked as
Privateif they are not publicly available. To access private data, ensure you have the necessary permissions and authentication.Tips for working with the output when
sorted_by_instrument=TrueWhen
sorted_by_instrument=True, the output is a nested dictionary grouped by:instrument → DRS version → instrument mode.If you request multiple RV sources that come from the same DRS (same instrument/DRS/mode), they are returned together in the same series.
For example, if you include both
Source.STANDARD_PROCESSINGandSource.TELLURIC_CORRECTION, you will get two RV points per observation in the same series (one telluric-corrected and one not), under the same instrument/DRS/mode key.This might not be desirable if you want to keep telluric-corrected and non-telluric-corrected RVs separate, in which case you can either:
Make two separate calls to
get_timeseries(), one for each source, to get separate series for each source while keeping the grouping by instrument/DRS/mode.Set
sorted_by_instrument=Falseto get a flat structure where each row corresponds to a single point (which can be further filtered using pandas)
Filtering by DRS version
You can further restrict which series are returned by specifying the
drs_versionargument.Value
Description
NoneDo not filter by DRS version (default)
'latest'Select the latest available DRS version
'DRS-<major>.<minor>.<patch>'Select a specific DRS version (e.g.
'DRS-3.3.10'or'3.3.10'or'DRS-3.3.10-CCF')Example:
from dace_query.spectroscopy import Spectroscopy # Get timeseries for the latest DRS version available per instrument timeseries = Spectroscopy.get_timeseries(target='HD69830', drs_version='latest') # Ge timeseries for a specific DRS version (e.g. DRS-3.3.10) timeseries = Spectroscopy.get_timeseries(target='HD69830', drs_version='DRS-3.3.10') # Get timeseries for a specific DRS version with a specifiic extraction method (e.g. DRS-3.3.10-CCF or DRS-3.3.10-SBART) # Make sure to specify the source (by default we only include standard processing and publications) timeseries = Spectroscopy.get_timeseries(target='HD69830', rv_sources=[Source.SBART], drs_version='DRS-3.3.10-SBART')
If you set both
rv_sourcesanddrs_version, we apply both filters. This means you only get radial-velocity time series that match the selected sources and belong to the selected DRS version.If that DRS version does not exist for the selected source(s) (for example because it corresponds to a different extraction method / pipeline), then there is no overlap and you will get no results.
Pick a DRS version that matches the RV sources you selected, for example:
from dace_query.spectroscopy import Spectroscopy, Source # Yields no results as SBART is not selected in rv_sources by default timeseries = Spectroscopy.get_timeseries( target='HR3259', drs_version='DRS-3.3.10-SBART' ) timeseries = Spectroscopy.get_timeseries( target='HR3259', rv_sources=[Source.SBART, Source.STANDARD_PROCESSING], # Get both standard and SBART radial velocities drs_version='DRS-3.3.10-SBART' # Returns only SBART series from DRS-3.3.10 ) timeseries = Spectroscopy.get_timeseries( target='HR3259', rv_sources=[Source.SBART, Source.STANDARD_PROCESSING], # Get both standard and SBART radial velocities drs_version='DRS-3.3.10' # Returns SBART + standard series from DRS-3.3.10 (if available) )
- Parameters:
target (str) – The target to retrieve data from.
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
rv_sources (Optional[list[Source]]) – List of Source enum values to filter the radial velocity data by their source
drs_version (Optional[Union[str, list[str]]]) – The DRS version to filter the data (e.g.
'latest'or specific version in the format'DRS-<major>.<minor>.<patch>-<rv_extraction_method>')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" timeseries = Spectroscopy.get_timeseries(target=target_to_search)
Getting spectroscopy timeseries for a target with filters applied
from dace_query.spectroscopy import Spectroscopy target_to_search = "HR3259" filters_to_use = dict( instrument_name=dict(contains=['HARPS']), rjd=dict(min=58000, max=59000) ) timeseries = Spectroscopy.get_timeseries(target=target_to_search, filters=filters_to_use)
Getting spectroscopy timeseries with points that pass the DRS quality check (
drs_qc = True)from dace_query.spectroscopy import Spectroscopy target_to_search = "HR3259" filters_to_use = dict( drs_qc=dict(is=True) ) timeseries = Spectroscopy.get_timeseries(target=target_to_search, filters=filters_to_use)
Getting spectroscopy timeseries for a target with results sorted by
<instrument>→<drs>→<instrument_mode>from dace_query.spectroscopy import Spectroscopy target_to_search = "C15-0734" timeseries = Spectroscopy.get_timeseries(target=target_to_search, sorted_by_instrument=True)
Getting timeseries with from a specific radial velocity source (ex: only telluric corrected data)
from dace_query.spectroscopy import Spectroscopy timeseries = Spectroscopy.get_timeseries('HR3259', rv_sources=[Spectroscopy.Source.TELLURIC_CORRECTION])
Filtering spectroscopy timeseries by multiple radial velocity sources (ex: SKYSUB and TELLURIC_CORRECTION)
from dace_query.spectroscopy import Spectroscopy timeseries = Spectroscopy.get_timeseries('HR3259', rv_sources=[Spectroscopy.Source.SKYSUB, Spectroscopy.Source.TELLURIC_CORRECTION])
- query_database(limit=10000, filters=None, sort=None, output_format=None)#
Query the spectroscopy database to retrieve data in the chosen format. The spectroscopy database contains metadata of raw frames. Use this method to search for observations matching specific criteria (e.g. target name, date, instrument, program id, etc.)
Filters and sorting order can be applied to the query via named arguments (see Filtering and sorting).
Available fields for
filtersargumentVariable name
Description
spectrum_idUsed internally by DACE, The unique identifier associated with an observation (a raw frame)
target_nameName of the observed target (Uses the SIMBAD common name if the target has been resolved. Else it uses the name extracted from the
.fitsfile). Case sensitive. Filtering on this field (ex:target_name : { equals : ["HD 10700"]}) will use a target resolver to find the associated target. Meaning you may use any of the target’s identifiers as long as the target has been resolved by DACE, else you will have to use the name from the raw frame’s.fitsfile.posThe coordinates in the format :
'<ra (deg)> / <dec (signed deg)>'instrument_nameThe name of the instrument used for the observation. Some instruments are split into versions (e.g.
ESPRESSO18,ESPRESSO19) to account for hardware changes capable of introducing offsets. Separating them simplifies the creation of normalized timeseries.program_nameThe name of the program associated with this observation.
dpr_catgDetermines the category of observation. Can be either
SCIENCE(actual observation of a target) orCALIB(calibration frames).dpr_typeDetermines the type of observation. Varies on the instrument but contains most of the time what each fiber was observing and the spectral type. Some examples : (
OBJECT,FP,FLAT,OFF,LAMP,STAR,SKYorSTAR,SKY,G9).obs_start_mjdThe start time of the observation in Modified Julian Date (MJD).
file_rootnameThe name of the raw frame in the file system, for example
ESPRE.2018-07-08T10:55:25.173.fits.date_nightThe date of the night of the observation in the format
YYYY-MM-DD.program_codeThe code of the program associated with this observation. Extracted from the
.fitsheader without any modification, for example60.A-9036(A).parallaxThe parallax of the target in milliarcseconds (mas). It can be empty or
0if the parallax was not provided in the.fitsheader.target_catnameThe name of the target extracted from the
.fitsheader without any modification.sp_typeThe spectral type of the target. It can be empty if the spectral type was not provided in the
.fitsheader.mag_vThe V magnitude of the target. Depending on the instrument, it can be empty if the V magnitude was not provided in the
.fitsheader or if it is outside of the range of the instrument.mag_iThe I magnitude of the target. Depending on the instrument, it can be empty if the I magnitude was not provided in the
.fitsheader or if it is outside of the range of the instrument.pm_aThe proper motion in right ascension of the target in milliarcseconds per year (mas/yr). It can be empty or
0if the proper motion was not provided in the.fitsheader.pm_dThe total proper motion of the target in milliarcseconds per year (mas/yr). It can be empty or
0if the proper motion was not provided in the.fitsheader.ra_degThe right ascension of the target in degrees (ICRS frame, J2000 epoch).
dec_degThe declination of the target in degrees (ICRS frame, J2000 epoch).
has_products_to_displayUsed internally by DACE to determine if the raw frame has products to display in the web interface. It is
Trueif there are products to display andFalseotherwise.has_rvUsed internally by DACE to determine if the raw frame has been reduced and has associated radial velocities. It is
Trueif there is atleast one associated radial velocity andFalseotherwise.has_guiding_frameUsed internally by DACE to determine if the raw frame has an associated guiding frame. It is
Trueif there is an associated guiding frame andFalseotherwise.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).
Available fields for
filtersargumentVariable name
Description
spectrum_idUsed internally by DACE, The unique identifier associated with an observation (a raw frame)
target_nameName of the observed target (Uses the SIMBAD common name if the target has been resolved. Else it uses the name extracted from the
.fitsfile). Case sensitive. Filtering on this field (ex:target_name : { equals : ["HD 10700"]}) will use a target resolver to find the associated target. Meaning you may use any of the target’s identifiers as long as the target has been resolved by DACE, else you will have to use the name from the raw frame’s.fitsfile.posThe coordinates in the format :
'<ra (deg)> / <dec (signed deg)>'instrument_nameThe name of the instrument used for the observation. Some instruments are split into versions (e.g.
ESPRESSO18,ESPRESSO19) to account for hardware changes capable of introducing offsets. Separating them simplifies the creation of normalized timeseries.program_nameThe name of the program associated with this observation.
dpr_catgDetermines the category of observation. Can be either
SCIENCE(actual observation of a target) orCALIB(calibration frames).dpr_typeDetermines the type of observation. Varies on the instrument but contains most of the time what each fiber was observing and the spectral type. Some examples : (
OBJECT,FP,FLAT,OFF,LAMP,STAR,SKYorSTAR,SKY,G9).obs_start_mjdThe start time of the observation in Modified Julian Date (MJD).
file_rootnameThe name of the raw frame in the file system, for example
ESPRE.2018-07-08T10:55:25.173.fits.date_nightThe date of the night of the observation in the format
YYYY-MM-DD.program_codeThe code of the program associated with this observation. Extracted from the
.fitsheader without any modification, for example60.A-9036(A).parallaxThe parallax of the target in milliarcseconds (mas). It can be empty or
0if the parallax was not provided in the.fitsheader.target_catnameThe name of the target extracted from the
.fitsheader without any modification.sp_typeThe spectral type of the target. It can be empty if the spectral type was not provided in the
.fitsheader.mag_vThe V magnitude of the target. Depending on the instrument, it can be empty if the V magnitude was not provided in the
.fitsheader or if it is outside of the range of the instrument.mag_iThe I magnitude of the target. Depending on the instrument, it can be empty if the I magnitude was not provided in the
.fitsheader or if it is outside of the range of the instrument.pm_aThe proper motion in right ascension of the target in milliarcseconds per year (mas/yr). It can be empty or
0if the proper motion was not provided in the.fitsheader.pm_dThe total proper motion of the target in milliarcseconds per year (mas/yr). It can be empty or
0if the proper motion was not provided in the.fitsheader.ra_degThe right ascension of the target in degrees (ICRS frame, J2000 epoch).
dec_degThe declination of the target in degrees (ICRS frame, J2000 epoch).
has_products_to_displayUsed internally by DACE to determine if the raw frame has products to display in the web interface. It is
Trueif there are products to display andFalseotherwise.has_rvUsed internally by DACE to determine if the raw frame has been reduced and has associated radial velocities. It is
Trueif there is atleast one associated radial velocity andFalseotherwise.has_guiding_frameUsed internally by DACE to determine if the raw frame has an associated guiding frame. It is
Trueif there is an associated guiding frame andFalseotherwise.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)
- class dace_query.spectroscopy.spectroscopy.Source(value)#
Bases:
EnumEnumeration of the different sources of radial velocity (RV) data. Used to filter RV time series data based on their provenance and/or extraction pipeline.
A source is a label describing how an RV time series was produced (or ingested).
For RVs produced by a cross-correlation function (CCF) based DRS pipeline, multiple RV series may exist for the same observations depending on the processing variant (for example
standard,telluric-corrected, orsky-subtractedCCF products).Other sources may correspond to alternative RV extraction pipelines, RVs resulting from a specific post-processing (i.e. SBART), or to RVs imported from an alternative source such as a publication.
By default,
SpectroscopyClass.get_timeseries()returns RVs from theSTANDARD_PROCESSINGandPUBLICATIONsources, but you can specify which sources to include or exclude using therv_sourcesargument.See
SpectroscopyClass.get_timeseries()for usage examples.Available radial velocity sources
Some DRS or postprocesses may be marked as
Privateif they are not publicly available. To access private data, ensure you have the necessary permissions and authentication.Name
Value
Description
Public/Private
STANDARD_PROCESSING"POSTDRS_A"Standard DRS pipeline processing, RVs extracted from CCF. (default)
PublicTELLURIC_CORRECTION"POSTDRS_TELL_CORR_A"Standard DRS pipeline processing, RVs extracted from CCF with telluric correction applied.
PublicSKYSUB"POSTDRS_SKYSUB_A"Standard DRS pipeline processing, RVs extracted from CCF with sky subtraction applied.
PublicPUBLICATION"PUB"RVs imported from publications. (default)
PublicSBART"SBART"RVs extracted using the sBART method.
PrivateLBL"LBL_A"RVs extracted using the LBL method.
PrivateFiltering radial velocity time series data by source
Getting only telluric corrected radial velocity data:
from dace_query.spectroscopy import Spectroscopy, Source timeseries = Spectroscopy.get_timeseries('HR3259', rv_sources=[Source.TELLURIC_CORRECTION])
Getting standard and publication radial velocity data:
from dace_query.spectroscopy import Spectroscopy, Source timeseries = Spectroscopy.get_timeseries('HR3259', rv_sources=[Source.STANDARD_PROCESSING, Source.PUBLICATION])