dlsmicro.backend.analysis_tools

Module for processing DLS correlation data into rheological properties

dlsmicro.backend.analysis_tools.calc_g1(t, corr, ergodic, g0=None, Ip=None, Ie=None, eps=None)[source]

Compute the intermediate scattering function from the correlation function.

This function transforms the correlation functio to the intermediate scattering function, which is necessary for computing the particle MSD. The function enables corrections for broken-ergodicty and estimation of the zero-time intercept of the correlation function.

Parameters:
  • t (1d-array) – Vector of time-lags at which the correlation function is computed
  • corr (1d-array) – Correlation coefficient (which spans possible from 0.0 to 1.0). Note that this is equal to g2 - 1, where g2 is the intensity autocorrelation function.
  • ergodic (boolean) – If False, corrections are made for non-ergodic systems based on Ip and Ie
  • Ip (float) – Scattering intensity at the position where correlation function is collected. (Only used if ergodic=False)
  • Ie (1d-array) – Vector of scattering intensities at different positions in the cuvette (Only used if ergodic=False)
  • g0 (float, optional) – Estimate of the intercept of g2 - 1 at time 0. If not provided, the intercept will be estimated automatically based on a stretched exponential fit.
Returns:

g1 – The intermediate scattering function corresponding to the time-lags t

Return type:

1d-array

Notes

The correlation function exported by the Zetasizer software is equal to g2 - 1

dlsmicro.backend.analysis_tools.calc_msd_raw(t, g1, q, replace_neg=True)[source]

Calculate the MSD from the intermediate scattering function.

Parameters:
  • t (1d-array) – Vector of time-lags
  • g1 (1d-array) – Vector containing the intermediate scattering function at time-lags t
  • q (float) – Scattering vector in units of 1/nm
  • replace_neg (boolean, optional) – If True, replace negative values of the MSD by linear interpolation
Returns:

msd – Vector of mean-squared-displacements at time-lags t (in units of nm^2)

Return type:

1d-array

dlsmicro.backend.analysis_tools.calc_q(n, theta, lam)[source]

Calculate the scattering wave-vector.

This function returns the scattering wave-vector for a DLS experiment based on the scattering geometry and the wave-length of the laser.

Parameters:
  • n (float) – Index of refraction of the material (1.333 for water)
  • theta (float) – Scattering angle in radians
  • lam (float) – wave-length of laser (units used here determine the units of q)
Returns:

q – Scattering wave-vector in inverse units of 1/lam

Return type:

float

dlsmicro.backend.analysis_tools.find_g0(t, corr, func=<function stretched_exp>, t0=2.0, tmaxs=array([ 40., 50., 60., 70., 80., 90., 100., 110., 120.]), p0=None)[source]

Estimate the intercept of the correlation function at t = 0

Parameters:
  • t (1d-array) – Vector of time-lags at which the correlation coefficient is computed
  • corr (1d-array) – Correlation coefficient (which spans possible from 0.0 to 1.0). Note that this is equal to g2 - 1, where g2 is the intensity autocorrelation function.
  • func (callable function) – Model to fit the correlation against. Must be of the form f(t, p1, p2, …, pM) where t is the independent variable and p1, p2, …, pM is a set of M parameters to fit.
  • t0 (float, optional) – Minimum time-lag to use in the fit of the correlation coefficient for estimating the intercept.
  • tmaxs (1-d array or list of floats, optional) – Vector of possible maximum time-lags to use in the fitting interval of the correlation coefficient. The optimal tmax will be selected based on minimization of the cross-validation error of the fit.
  • p0 (1-d array, optional) – Initial guesses for the parameters to func for fitting
Returns:

  • g0 (float) – Estimate of the intercept of corr at t=0
  • twindow_min (List of floats) – Optimized interval in time over which the fit to corr was performed to obtain g0. This is a list of the form [t0, tmax].
  • pmin (1d-array) – Optimal values for the fitting parameters to func used to estimate g0

dlsmicro.backend.analysis_tools.full_dlsur_analysis(t, corr, ergodic, r, T, q, Ip, Ie, calc_g1_kws={}, pwr_law_kws={})[source]

Perform a full microrheology analysis from the correlation function.

This function returns a table reporting particle motion statistics and the material shear modulus, beginning with the correlation coefficient. It implicitly calculates the intercept of the correlation function and a power-law analysis of the MSD to perform an algebraic calculation of the shear modulus.

Parameters:
  • t (1d-array) – Vector of lag-times (in microseconds)
  • corr (1d-array) – Vector of values of the correlation coefficient, corresponding to the time-lags t.
  • ergodic (boolean) – If ergodic==False then corrections are applied to the calculation of g1, based on Ip and Ie
  • r (float) – Particle radius in nanometers
  • T (float) – Temperature in Kelvin
  • q (float) – Scattering vector in 1/nm
  • Ip (float, optional) – Scattering intensity at the meausurement position where corr is collected
  • Ie (1d-array) – Vector of scattering intensities at different measurement positions in the cuvette
  • calc_g1_kws (dictionary, optional) – Dictionary of keyword arguments to pass to analysis.tools.calc_g1() for computing the intermediate scattering function
  • pwr_law_kws (dictionary, optional) – Dictionary of keyword arguments to pass to analysis_tools.msd_local_pwr_law() for local power-law analysis of the msd
Returns:

dlsmicro_df – Dataframe containing table of results from DLS microrheology analysis

Return type:

DataFrame

dlsmicro.backend.analysis_tools.msd_local_pwr_law(t, g1, q, bw=0.1, replace_neg=True)[source]
Calculate the local power-law scaling of the MSD and the
smoothed MSD by locally-weighted logarithmic linear regression
Parameters:
  • t (1d-array) – Vector of time-lags
  • g1 (1d-array) – Vector containing the intermediate scattering function at time-lags given by t
  • q (float) – Scattering vector in units of 1/nm
  • bw (float, optional) – Bandwith smoothing parameter for locally-weighted regression. Reasonable values are typically between 0.05 and 0.1
Returns:

  • msd_smooth (1d-array) – Vector of smoothed MSD values from the local regression corresponding to the time lags in t (in units of nm^2).
  • alpha (1d-array) – Vector of local power-law scaling exponents of the MSD corresponding to the time lags in t.

dlsmicro.backend.analysis_tools.shear_modulus(t, msd, alpha, r, T)[source]

Calculate Frequency-dependent shear modulus by power-law analysis

Calculate the frequency-dependent complex shear modulus using results from a power-law analysis of the mean-squared-displacement.

Parameters:
  • t (1d-array) – Time-lags in units of microseconds
  • msd (1d-array) – Mean-squared displacements at the time-lags t in units of nm^2
  • alpha (1d-array of local power-law scaling exponents) –
  • r (float) – Radius of the probe particles in nanometers
  • T (float) – Temperature in Kelvin
Returns:

  • omega (1d-array) – Vector of angular frequencies in units of 1/s
  • G1 (1d-array) – Storage modulus at angular frequencies omega in units of Pa
  • G2 (1d-array) – Loss modulus at angular frequencies omega in units of Pa

Notes

This method produces more accurate results in the upper and lower frequency extremes than a direct numerical Laplace or Fourier transform.

dlsmicro.backend.analysis_tools.shear_modulus_laplace_transform(t, msd, r, T, bw=0.01)[source]

Calculate the shear modulus by direct laplace transform of the MSD

Parameters:
  • t (1d-array) – Time-lags in units of microseconds
  • msd (1d-array) – Mean-squared displacements at the time-lags t in units of nm^2
  • r (float) – Radius of the probe particles in nanometers
  • T (float) – Temperature in Kelvin
  • bw (float, optional) – Bandwith parameter for analytic continuation of the laplace transform into fourier space by locally weighted regression
Returns:

  • omega (1d-array) – Vector of angular frequencies in units of 1/s
  • G1 (1d-array) – Storage modulus at angular frequencies omega in units of Pa
  • G2 (1d-array) – Loss modulus at angular frequencies omega in units of Pa

Notes

This function returns the shear modulus in the Fourier (omega) domain by first transforming to the Laplace (s) domain and then performing analytic continuation onto the imaginary axis in the complex plane.

This method produces erroneous results in the upper and lower frequency extremes (roughly the first and last decade of frequencies).