MSDFunctions module
Created on Tue Apr 23 14:30:10 2024
@author: jbeckwith
- class MSDFunctions.MSD
Bases:
object- DSigma2_OLSF(coordinates, dT, R=0.16666666666666666, n_d=1, maxiter=100, min_points=10, supress_warning=False)
Compute diffusion coefficient estimate, and estimate of the dynamic localisation error, using the OLSF MSD approach.
- Parameters:
coordinates (numpy.ndarray) – Input trajectory.
dT (float) – Time interval.
R (float) – Motion blur coefficient.
n_d (int) – number of dimensions. If above 1, coordinates second dimension should be same shape as this number
maxiter (int) – Maximum number of iterations. Defaults to 100.
min_points (int) – minimum number of points for a diffusion estimate. Default is 10.
- Returns:
D (float) – Diffusion coefficient estimate.
var (float) – var estimate.
- DSigma2_OLSF_BootStrap(coordinates, dT, R=0.16666666666666666, n_d=1, maxiter=100, min_points=10, n_samples=1000)
Compute diffusion coefficient error estimate, and estimate of the dynamic localisation variance, using bootstrapping of the OLSF MSD approach.
- Parameters:
coordinates (numpy.ndarray) – Input trajectory.
dT (float) – Time interval.
R (float) – Motion blur coefficient.
n_d (int) – number of dimensions. If above 1, coordinates second dimension should be same shape as this number
maxiter (int) – Maximum number of iterations. Defaults to 100.
min_points (int) – minimum number of points for a diffusion estimate. Default is 10.
n_samples (int) – number of bootstrapped samples. Default 1000.
- Returns:
D_error (float) – Diffusion coefficient error estimate.
var_error (float) – var error estimate.
- static PMin_XM(x, N)
Calculate optimal fit point from formulae in Michalet, X. Mean Square Displacement Analysis of Single-Particle Trajectories with Localization Error: Brownian Motion in an Isotropic Medium. Phys. Rev. E 2010, 82 (4), 041914. https://doi.org/10.1103/PhysRevE.82.041914.
- Parameters:
x (float) – Input value.
N (int) – Number of trajectory points.
- Returns:
pa (int) – Optimal fit point for parameter ‘a’.
pb (int) – Optimal fit point for parameter ‘b’.
- autocorrFFT(x)
Compute the autocorrelation of a 1D signal using the Fast Fourier Transform (FFT) method.
- Parameters:
x (numpy.ndarray) – Input signal.
- Returns:
res (numpy.ndarray) – Autocorrelation of the input signal.
- msd_fft(r)
Compute the mean squared displacement (MSD) using the Fast Fourier Transform (FFT) method.
- Parameters:
r (numpy.ndarray) – Trajectory data, where each row represents the
steps. (coordinates of a particle at different time)
- Returns:
S (numpy.ndarray) – MSD computed for each time step.