skultrafast.utils¶
Module with various utility functions. Was called dv in older Versions.
Classes¶
Linear regression result. |
Functions¶
|
Bins a 1D array to given bins using weights. |
|
Simulates |
|
Masks outliers by iteratively removing points outside given |
|
Returns the stepfunction (erf-style) for given arguments. |
|
Calculates the PFID contribution for pure bleaching. |
|
Calculates the PFID contribution for the shifted frequecy. |
|
|
|
Calculates the solution and error terms in a linear regression. |
|
|
|
|
|
|
|
Fit and subtract baseline from given data |
|
Returns index-array where a is between upper and lower |
Module Contents¶
- skultrafast.utils.weighted_binning(x, arr, bins, weights=None)[source]¶
Bins a 1D array to given bins using weights.
- skultrafast.utils.sigma_clip(data, sigma: float = 3, max_iter: int = 5, axis: int = -1, use_mad: bool = False, mean_func=np.ma.mean, full_return=False) numpy.ma.MaskedArray | tuple[numpy.ma.MaskedArray, numpy.ndarray, numpy.ndarray][source]¶
Masks outliers by iteratively removing points outside given standard deviations.
- Parameters:
data (np.ndarray) – The data array.
sigma (float) – All data outside +/- sigma*std will be masked in each iteration.
max_iter (int) – How many iterations are done. If a new iteration does not mask new values, the function will break the loop.
mean_func (callable) – Function to calculate the mean. Default is np.ma.mean, which is masked array aware.
- Returns:
Array with outliers being masked.
- Return type:
np.ma.MaskedArray
- skultrafast.utils.gauss_step(x, amp: float, center: float, sigma: float)[source]¶
Returns the stepfunction (erf-style) for given arguments.
- Parameters:
x (array) – Independent variable
amp (float) – Amplitude of the step
center (float) – Position of the step
sigma (float) – Width of the step
- Returns:
The step functions
- Return type:
array
- skultrafast.utils.pfid_r4(T, om, om_10, T_2)[source]¶
Calculates the PFID contribution for pure bleaching.
See the PFID tutorial for a longer explanation. The function does broadcasting, hence it is possible to calculate the PFID contributions of serveral bands at once. For that, om_10 and T_2 must have the same shape.
- Parameters:
T (1D-ndarry) – Delays between pump and probe. The formula assume a postive delays.
om (1D-ndarray) – Array of frequencies given in wavenumbers (cm-1).
om_10 (1D-ndarray or float) – Frequencies of the ground-state absorbtions
T_2 (1D_ndarray or float) – Decoherence time of the bands.
- Return type:
ndarry
- skultrafast.utils.pfid_r6(T, om, om_10, om_21, T_2)[source]¶
Calculates the PFID contribution for the shifted frequecy.
See the PFID tutorial for a longer explanation. The function does broadcasting, hence it is possible to calculate the PFID contributions of serveral bands at once. For that, om_10, om_21 and T_2 must have the same shape.
- Parameters:
T (1D-ndarry) – Delays between pump and probe. The formula assume a postive delays.
om (1D-ndarray) – Array of frequencies given in wavenumbers (cm-1).
om_10 (1D-ndarray or float) – Frequencies of the ground-state absorbtions
om_21 (1D-ndarray or float) – Frequencies of the shifted frequency
T_2 (1D_ndarray or float) – Decoherence time of the bands.
- Return type:
ndarry
- class skultrafast.utils.LinRegResult[source]¶
Linear regression result.
- skultrafast.utils.linreg_std_errors(A, y)[source]¶
Calculates the solution and error terms in a linear regression.
- skultrafast.utils.poly_bg_correction(wavelengths, data, left=30, right=30, deg=1)[source]¶
Fit and subtract baseline from given data
- Parameters:
wavelengths (np.ndarry) – Shared x-values
data (np.ndarray) – Dataarray
left (int, optional) – left points to use, by default 30
right (int, optional) – right points to use, by default 30
deg (int, optional) – Degree of the polynomial fit, by default 1 (linear)
- Returns:
[description]
- Return type:
[type]