Note
Go to the end to download the full example code.
Analysing Spectra#
Velocity Spectra#
DataSet objects support one data method, vspec(), which converts wavelength into velocity relative to a given reference wavelength, wav_ref:
from ATK import query
sdss_query = query("spectrum", targets=587316166180416640, survey="sdss", path="example_spectrum.fits.gz")
sdss_query.apply("vspec", wav_ref = 6562.7097, inplace=False)
sdss_query.open()
Fitting Spectral Features#
Spectrum objects also support two further plotting options for performing spectral analysis.
Spectral features can be detected and fitted by passing fit=True to plot(). To aid in detecting features while reducing false positives, the following additional arguments are also supported when using fit=True:
prominencesets the minimum prominence of spectral features (seeherefor details, default =2.0)smoothsets the level to which the spectrum is smoothed before searching for peaks (default =3.0)snrsets the minimum signal-to-noise ratio of spectral features (default =3.0)
sdss_query.plot(fit=True, smooth=5.0)
sdss_query.open()
Detecting Radial Velocities#
Spectrum plotting also supports multi-component radial velocity fitting by passing rv_fit=True. As peaks must first be detected, the same additional parameters are accepted as when using fit=True:
sdss_query.plot(rv_fit=True, smooth=5.0)
sdss_query.open()
Download this Tutorial
Total running time of the script: (0 minutes 25.077 seconds)