raman.strip_kinetics

raman.strip_kinetics(y, Nmax=5, verbose=False, tryIRF=True, NyI=5, NyS=20, smooth=True)

Automatically remove slow kinetics from a (single) TA trace. This function uses a minimal number of decaying / rising exponentials that may be convoluted with a Gaussian instrument response function to obtain the best fit to the slow kinetics. Paremeters are determined automatically by choosing the feature set with the minimal chi2. Currently this function uses simple least squares curve fitting with bounds. If y is a 2d array of TA traces, use every NyS-th row (and column) averaging over NyI rows to reconstruct a smooth TA. The result is subtracted from the original by cubic interpolation over the columns.

Parameters:
  • y (array) – The kinetics trace as function of time. May be a 2d array or list of traces with shape [time][wavelength] as, for example, returned by loadTA().
  • Nmax (int) – The maximum number of exponentials to be used (default = 5).
  • verbose (bool) – If True, print a list of fitting parameters used for fitting the kinetics trace (default = False).
  • tryIRF (bool) – If True, also try exponentials convoluted with Gaussian, set to False if there is no step function in your data (default = True).
  • NyI (int) – Number of rows to integrate for kinetics estimation. Used only for 2d TA traces (default = 5).
  • NyS (int) – Number of rows/columns to skip for kinetics estimates. Must be > NyI (default = 20).
  • smooth (bool) – If True, apply denoise to the data for estimation of the kinetics. The returned residuum is not smoothed. For some data, however, denoise will not work properly, in which case it should be set to False.
Returns:

Stripped trace or list of traces (with same shape as y), ystripped, kinetics trace or list of kinetics traces (same shape as y), ykinetic.

See also

See FSRStools.fitting.exponentials() and FSRStools.fitting.exp_gauss() for details on the fitting functions.

The following example uses strip_kinetics to obtain a 2d Fourier map relating impulsively excited Raman modes with their position in the TA. See, for example, Musser et al., Nat. Phys. 11, 352 (2015) for more details.:

import numpy as np
import FSRStools.raman as fs

# y is a 2d TA map as loaded with loadTA(), wl is the wavelength axis, t is the time axis
# first, strip the slow kinetics from the TA data
ystr, ykin = fs.strip_kinetics(y)

# next, do an |FFT|**2 along the time axis to get the impulsive Raman spectrum
Y = np.absolute(np.fft.rfft2(ystr, axes=(0,)))**2

# get the modes' frequencies in cm-1
wn = np.fft.rfftfreq(len(t), d=t[1] - t[0]) / (2.9979e8 * 1e-13)

# now make a 2d plot using plotTA() - adjust the value of vmax to get a good contrast on the impulsive modes
fs.plotTA(wn, wl, Y, vmax=0.01, showContour=False, xlabel="Wavenumber (cm-1)")