.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_tutorials/spectra/spectral_analysis.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_tutorials_spectra_spectral_analysis.py: ################# Analysing Spectra ################# Velocity Spectra ================ :class:`~ATK.Models.DataSet` objects support one **data method**, :meth:`~ATK.Models.Spectrum.vspec`, which converts wavelength into velocity relative to a given reference wavelength, ``wav_ref``: .. GENERATED FROM PYTHON SOURCE LINES 10-17 .. code-block:: Python 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() .. raw:: html
Bokeh Figure


.. GENERATED FROM PYTHON SOURCE LINES 33-51 | | Fitting Spectral Features ========================= :class:`~ATK.Models.Spectrum` objects also support two further plotting options for performing spectral analysis. | **Spectral features can be detected and fitted** by passing ``fit=True`` to :meth:`~ATK.Models.DataSet.plot`. To aid in detecting features while reducing false positives, the following additional arguments are also supported when using ``fit=True``: - ``prominence`` sets the minimum **prominence** of spectral features (see :func:`here ` for details, default = ``2.0``) - ``smooth`` sets the level to which the spectrum is **smoothed** before searching for peaks (default = ``3.0``) - ``snr`` sets the minimum **signal-to-noise ratio** of spectral features (default = ``3.0``) | .. GENERATED FROM PYTHON SOURCE LINES 51-55 .. code-block:: Python sdss_query.plot(fit=True, smooth=5.0) sdss_query.open() .. raw:: html
Bokeh Figure


.. GENERATED FROM PYTHON SOURCE LINES 64-70 | | Detecting Radial Velocities =========================== :class:`~ATK.Models.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``: .. GENERATED FROM PYTHON SOURCE LINES 70-74 .. code-block:: Python sdss_query.plot(rv_fit=True, smooth=5.0) sdss_query.open() .. raw:: html
Bokeh Figure


.. GENERATED FROM PYTHON SOURCE LINES 83-88 | | | .. rubric:: Download this Tutorial .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 25.077 seconds) .. _sphx_glr_download_auto_tutorials_spectra_spectral_analysis.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: spectral_analysis.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: spectral_analysis.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: spectral_analysis.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_