Note
Go to the end to download the full example code.
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
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
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)
Tutorial MessPy-file located at /home/docs/checkouts/readthedocs.org/user_builds/skultrafast/envs/latest/lib/python3.9/site-packages/skultrafast/examples/data/messpyv1_data.npz
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);
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 <module>
merged_ds.plot.spec(-.5, n_average=3);
File "/home/docs/checkouts/readthedocs.org/user_builds/skultrafast/envs/latest/lib/python3.9/site-packages/skultrafast/dataset.py", line 1886, in spec
l1 = pa.plot.spec(*times,
File "/home/docs/checkouts/readthedocs.org/user_builds/skultrafast/envs/latest/lib/python3.9/site-packages/skultrafast/dataset.py", line 1414, 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.9/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.9/site-packages/scipy/ndimage/_filters.py", line 1092, in uniform_filter
uniform_filter1d(input, int(size), axis, output, mode,
File "/home/docs/checkouts/readthedocs.org/user_builds/skultrafast/envs/latest/lib/python3.9/site-packages/scipy/ndimage/_filters.py", line 1020, in uniform_filter1d
_nd_image.uniform_filter1d(input, size, axis, output, mode, cval,
RuntimeError: array type dtype('float16') not supported
merged_ds.plot.spec(-1.5, n_average=1);
merged_ds.t
Total running time of the script: (0 minutes 0.419 seconds)