.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/tutorial_fit_pfid.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_examples_tutorial_fit_pfid.py: Fitting the perturbed free induction decay ========================================== Sometimes it is useful to fit the perturbed free induction (see explanation in the PFID tutorial), maybe certain excited state features are not yet visible or a more exact determination of the center frequency is required. WORK IN PROGRESS .. GENERATED FROM PYTHON SOURCE LINES 13-19 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt import skultrafast.plot_helpers as ph import skultrafast.unit_conversions as uc from skultrafast.utils import pfid_r4, pfid_r6 from skultrafast import messpy, data_io, dataset .. GENERATED FROM PYTHON SOURCE LINES 20-34 .. code-block:: Python fname = data_io.get_example_path('messpy') print("Tutorial MessPy-file located at %s" % fname) mpf = messpy.MessPyFile( fname, invert_data=True, # Changes the sign of the data is_pol_resolved=True, # If the data was recored polarization resolved. pol_first_scan='perp', # Polarisation of the first scan valid_channel=1, # Which channel to use, recent IR data always uses 1 # Recent visible data uses 0 ) mpf.recalculate_wavelengths(8.8) .. rst-class:: sphx-glr-script-out .. code-block:: none Tutorial MessPy-file located at /home/docs/checkouts/readthedocs.org/user_builds/skultrafast/envs/latest/lib/python3.11/site-packages/skultrafast/examples/data/messpyv1_data.npz /home/docs/checkouts/readthedocs.org/user_builds/skultrafast/envs/latest/lib/python3.11/site-packages/skultrafast/messpy.py:174: RuntimeWarning: overflow encountered in cast self.wavenumbers = 1e7 / self.wl .. GENERATED FROM PYTHON SOURCE LINES 35-43 .. code-block:: Python para, perp, iso = mpf.avg_and_concat() pol_ds = dataset.PolTRSpec(para, perp) pol_ds.subtract_background() merged_ds = pol_ds.merge_nearby_channels(8) merged_ds.plot.spec(-.5, n_average=3); .. rst-class:: sphx-glr-script-out .. code-block:: pytb Traceback (most recent call last): File "/home/docs/checkouts/readthedocs.org/user_builds/skultrafast/checkouts/latest/skultrafast/examples/tutorial_fit_pfid.py", line 41, in merged_ds.plot.spec(-.5, n_average=3); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/docs/checkouts/readthedocs.org/user_builds/skultrafast/envs/latest/lib/python3.11/site-packages/skultrafast/dataset.py", line 1887, in spec l1 = pa.plot.spec(*times, ^^^^^^^^^^^^^^^^^^^^ File "/home/docs/checkouts/readthedocs.org/user_builds/skultrafast/envs/latest/lib/python3.11/site-packages/skultrafast/dataset.py", line 1415, in spec dat = filter.uniform_filter(ds, (2*n_average + 1, 1)).data[idx, :] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/docs/checkouts/readthedocs.org/user_builds/skultrafast/envs/latest/lib/python3.11/site-packages/skultrafast/filter.py", line 39, in uniform_filter f = nd.uniform_filter(d, size=sigma, mode="nearest") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/docs/checkouts/readthedocs.org/user_builds/skultrafast/envs/latest/lib/python3.11/site-packages/scipy/ndimage/_filters.py", line 1613, in uniform_filter uniform_filter1d(input, int(size), axis, output, mode, File "/home/docs/checkouts/readthedocs.org/user_builds/skultrafast/envs/latest/lib/python3.11/site-packages/scipy/ndimage/_filters.py", line 1539, in uniform_filter1d _nd_image.uniform_filter1d(input, size, axis, output, mode, cval, RuntimeError: array type dtype('float16') not supported .. GENERATED FROM PYTHON SOURCE LINES 44-48 .. code-block:: Python merged_ds.plot.spec(-1.5, n_average=1); .. GENERATED FROM PYTHON SOURCE LINES 49-51 .. code-block:: Python merged_ds.t .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.150 seconds) .. _sphx_glr_download_auto_examples_tutorial_fit_pfid.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: tutorial_fit_pfid.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: tutorial_fit_pfid.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: tutorial_fit_pfid.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_