Note
Go to the end to download the full example code.
Working with Spectra#
Performing a Spectrum Query#
To perform a spectrum query to SDSS and plot the result:
from ATK import query
sdss_query = query("spectrum", targets=587316166180416640, survey="sdss", path="example_spectrum.fits.gz")
sdss_query.show(show_types=True)
sdss_query.open()
<Spectrum DataSet>
.kind (str): Spectrum
.targets (list): 587316166180416640 | 141.185° 8.031° (icrs, 2016-01-01T00:00:00.000, 3.0″)
.exception (bool): False
.data (list):
<sdss Spectrum>
survey (str): sdss
correction (str): full
search_pos (astropy.SkyCoord): 141.185° 8.031° (icrs, 2017-01-01T00:00:00.000)
separation (astropy.Quantity): 0.387″
exposure (astropy.Quantity): 10505.0 s
wavelength (astropy.Quantity): [3803.64501953125, 3804.52197265625, ..., 9210.853515625, 9212.978515625] Å
flux (astropy.Quantity): [20.667999267578125, 18.420000076293945, ..., 9.447999954223633, 10.515999794006348] 1×10⁻¹⁷ erg Å⁻¹ s⁻¹ cm⁻²
<sdss Spectrum>
survey (str): sdss
correction (str): full
search_pos (astropy.SkyCoord): 141.185° 8.031° (icrs, 2017-01-01T00:00:00.000)
separation (astropy.Quantity): 0.422″
exposure (astropy.Quantity): 2300.3 s
wavelength (astropy.Quantity): [3801.89306640625, 3802.77001953125, ..., 9212.978515625, 9215.09765625] Å
flux (astropy.Quantity): [19.785999298095703, 16.702999114990234, ..., 11.475000381469727, 8.510000228881836] 1×10⁻¹⁷ erg Å⁻¹ s⁻¹ cm⁻²
Available Methods: .add(), .apply(), .from_target(), .merge(), .open(), .plot(), .save(), .show(), .split(), .store()
The returned DataSet’s data attribute is a list of Spectrum objects (one or multiple per target, subject to data availability). If multiple Spectrum objects are returned for a single target, these will be arranged in order of decreasing exposure.
Note
ATK supports queries to the following spectra surveys:
SDSS -
sdssDESI -
desi
For a refresher on query() fundamentals, see here. For a refresher on plotting fundamentals, see here.
If the desired survey is not listed above, see here for a tutorial on utilising external data.
Download this Tutorial
Total running time of the script: (0 minutes 0.691 seconds)