ctrappy.diffusion
Calculate the diffusion coefficient from a track.
- ctrappy.diffusion.fit_diffusion(msd, frame_time, p_min, diff_estimate, sigma, p_maxed=False)
Fit the msd with a linear function; take p_min points into account.
- ctrappy.diffusion.fit_func(x, a, b)
Linear fitting function.
- ctrappy.diffusion.get_diffusion_coefficient(x_vals, diff_estimate, t_exposure, avg_photon_count, sigma_psf, frame_time, show=False)
Get diffusion coefficient using p_min values; find p_min using a convergence scheme. Based on https://doi.org/10.1103/PhysRevE.82.041914.
- Parameters:
x_vals (array of floats) – Positions of particle over time.
diff_estimate (float) – Diffusion coefficient estimate.
t_exposure (float) – Exposure time of spot.
avg_photon_count (float) – Average photon count for spot.
sigma_psf (float) – Sigma of psf.
frame_time (float) – Exposure time of frame.
show (bool (optional)) – Plot MSD if calculation does not converge. Default: False.
- Returns:
diff – Diffusion coefficient.
- Return type:
float
- ctrappy.diffusion.get_msd(x_vals)
Get mean square displacement from an array of values.
- ctrappy.diffusion.get_p_min(diff_estimate, t_exposure, avg_photon_count, sigma_psf, frame_time)
Calculate p_min from diffusion estimate, exposure time, average photon count, sigma of psf and frame time.