.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tutorial-quick/eg_03_quick_spectra.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_tutorial-quick_eg_03_quick_spectra.py: Getting spectra data ^^^^^^^^^^^^^^^^^^^^ It can often be useful to have a look at the spectral content of time data. The quick functions make it easy to get the spectra data of a single time series recording. Note that spectra data are calculated after decimation and spectra data objects include data for multiple decimation levels. The dataset in this example has been provided for use by the SAMTEX consortium. For more information, please refer to [Jones2009]_. Additional details about the dataset can be found at https://www.mtnet.info/data/kap03/kap03.html. .. GENERATED FROM PYTHON SOURCE LINES 16-21 .. code-block:: default from pathlib import Path import seedir as sd import plotly import resistics.letsgo as letsgo .. GENERATED FROM PYTHON SOURCE LINES 23-24 Define the data path. This is dependent on where the data is stored. .. GENERATED FROM PYTHON SOURCE LINES 24-27 .. code-block:: default time_data_path = Path("..", "..", "data", "time", "quick", "kap123") sd.seedir(str(time_data_path), style="emoji") .. rst-class:: sphx-glr-script-out Out: .. code-block:: none 📁 kap123/ ├─📄 data.npy └─📄 metadata.json .. GENERATED FROM PYTHON SOURCE LINES 28-29 Get the spectra data. .. GENERATED FROM PYTHON SOURCE LINES 29-31 .. code-block:: default spec_data = letsgo.quick_spectra(time_data_path) .. GENERATED FROM PYTHON SOURCE LINES 32-35 Once the spectra data has been calculated, it can be plotted in a variety of ways. The default plotting function plots the spectral data for multiple decimation levels. .. GENERATED FROM PYTHON SOURCE LINES 35-39 .. code-block:: default fig = spec_data.plot() fig.update_layout(height=900) plotly.io.show(fig) .. raw:: html :file: images/sphx_glr_eg_03_quick_spectra_001.html .. GENERATED FROM PYTHON SOURCE LINES 40-43 It is also possible to plot spectra data for a particular decimation level. In the below example, an optional grouping is being used to stack spectra data for the decimation level into certain time groups .. GENERATED FROM PYTHON SOURCE LINES 43-48 .. code-block:: default fig = spec_data.plot_level_stack(level=0, grouping="3D") fig.update_layout(height=900) plotly.io.show(fig) .. raw:: html :file: images/sphx_glr_eg_03_quick_spectra_002.html .. GENERATED FROM PYTHON SOURCE LINES 49-51 It is also possible to plot spectra heatmaps for a decimation level. Here, the sphinx_gallery_defer_figures .. GENERATED FROM PYTHON SOURCE LINES 51-54 .. code-block:: default fig = spec_data.plot_level_section(level=0, grouping="6H") fig.update_layout(height=900) plotly.io.show(fig) .. raw:: html :file: images/sphx_glr_eg_03_quick_spectra_003.html .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 3.709 seconds) .. _sphx_glr_download_tutorial-quick_eg_03_quick_spectra.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: eg_03_quick_spectra.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: eg_03_quick_spectra.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_