CVE_Functions module

Created on Mon Sep 4 10:00:36 2023

@author: jbeckwith

class CVE_Functions.CVE

Bases: object

DSigma_CVE(coordinates, dT, R=0.16666666666666666, n_d=1, min_points=10)

Compute diffusion coefficient estimate, and estimate of the dynamic localisation error, using the CVE approach.

Parameters:
  • coordinates (np.ndarray) – coordinates over time.

  • dT (float) – Time step.

  • 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 optimisation iterations to make

  • maxfun (int) – maximum number of function evaluations to make

  • min_points (int) – minimum number of points for a diffusion estimate. Default is 10.

Returns:
  • D (float) – estimate of D value.

  • sigma (float) – estimate of dynamic localisation std.

DSigma_CVE_BootStrap(coordinates, dT, R=0.16666666666666666, n_d=1, min_points=10, n_samples=1000)

Compute errors on diffusion coefficient estimate, and estimate of the dynamic localisation error, using the CVE approach.

Parameters:
  • coordinates (np.ndarray) – coordinates over time.

  • dT (float) – Time step.

  • 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 optimisation iterations to make

  • maxfun (int) – maximum number of function evaluations to make

  • min_points (int) – minimum number of points for a diffusion estimate. Default is 10.

  • n_samples (int) – number of bootstrapped samples.

Returns:
  • D_error (float) – estimate of D error.

  • sigma_error (float) – estimate of error in dynamic localisation std.

Eq10(D, deltaT, sigma, k, N, R=0.16666666666666666)

Eq10 function calculates theoretical form of power spectrum from Vestergaard, C. L.; Blainey, P. C.; Flyvbjerg, H Phys. Rev. E 2014, 89 (2), 022726. https://doi.org/10.1103/PhysRevE.89.022726. to estimate if particle is undergoing diffusive motion or not

Parameters:
  • D (float) – diffusion coefficient

  • deltaT (float) – time difference between displacements

  • sigma (float) – precision

  • k (int) – modes of discrete sine transform

  • N (int)

  • R (float) – R parameter (see Equation 5 of paper)

Returns:

Pk (np.1darray) – theoretical form of the power spectrum

Eq14(x, dT, R=0.16666666666666666, min_points=10)

CVE_Eq14 function takes positions and uses equation 14 from Vestergaard, C. L.; Blainey, P. C.; Flyvbjerg, H Phys. Rev. E 2014, 89 (2), 022726. https://doi.org/10.1103/PhysRevE.89.022726. to estimate diffusion coefficient and localisation precision

Parameters:
  • x (np.1darray) – 1D positions

  • dT (np.1darray) – time step

  • R (float) – motion blur parameter (see Equation 5 of paper)

  • min_points (float) – minimum track length

Returns:
  • D (float) – diffusion coefficient estimate

  • varD (float) – variance of D

Eq16(x, sigma, dT, R=0.16666666666666666, min_points=10)

CVE_Eq16 function takes positions and uses equation 16 from Vestergaard, C. L.; Blainey, P. C.; Flyvbjerg, H Phys. Rev. E 2014, 89 (2), 022726. https://doi.org/10.1103/PhysRevE.89.022726. to estimate diffusion coefficient

Parameters:
  • x (np.1darray) – 1D positions

  • sigma (np.1darray) – precision of estimations of x

  • dT (np.1darray) – time step

  • R (float) – R parameter (see Equation 5 of paper)

  • min_points (float) – minimum track length

Returns:
  • D (float) – diffusion coefficient estimate

  • varD (float) – variance of D