PyDDM.ddm_calc.fit_ddm_all_qs

PyDDM.ddm_calc.fit_ddm_all_qs

fit_ddm_all_qs(dData, times, param_dictionary, amplitude_from_ims, first_use_leastsq=True, use_curvefit_method=False, sigma=None, update_tau_based_on_estimated_diffcoeff=False, estimated_diffcoeff=None, update_tau_based_on_estimated_velocity=False, estimated_velocity=None, update_tau2_based_on_estimated_diffcoeff=False, estimated_diffcoeff2=None, update_tau2_based_on_estimated_velocity=False, estimated_velocity2=None, update_limits_on_tau=False, updated_lims_on_tau_fraction=0.1, use_A_from_images_as_guess=False, update_limits_on_A=False, updated_lims_on_A_fraction=0.1, err=None, logfit=False, maxiter=600, factor=0.001, quiet=False, quiet_on_method=True, last_times=None, given_fit_method=None, update_initial_guess_each_q=False, debug=False)

Function to fit the DDM matrix or ISF for all wavevectors.

This function fits the data from DDM (either the DDM matrix or the intermediate scattering function (ISF, \(f(q,\Delta t)\))) to a specified model.

\[D(q,\Delta t) = A(q) [1 - f(q,\Delta t)] + B(q)\]
Parameters
  • dData (array) – Array containing the DDM data to fit for. This will be either the DDM matrix or the ISF. This should be a 2D array; the first dimension corresponds to the lag times, the second dimension corresponds to the wavevectors.

  • times (array_like) – 1D array of the lagtimes

  • param_dictionary (dict) – Dictionary corresponding to the model we will fit to. This dictionary contains the parameters, the initial guess for their values, their bounds, and the function of the model to fit to. See the module PyDDM.fit_parameters_dictionaries

  • amplitude_from_ims (array_like) – The DDM matrix is usually fit to something like DDM_matrix = A(1-f)+B where A is the amplitude. But this A parameter can also be determined by taking the Fourier transforms of the images (rather than differences between images). This parameter is the amplitude found from the Fourier transforms of the images. We have the option of using these values as the initial guesses when fitting the amplitude of the DDM matrix.

  • first_use_leastsq ({False}, optional) – If True, will use scipy.optimize.least_squares for fitting.

  • use_curvefit_method ({True}, optional) – If True, will use scipy.optimize.curve_fit for fitting.

  • sigma ({None}, optional) – If scipy.optimize.curve_fit is used, we can weight the data points by this array. If passed, it will need to be a 1D array of length equal to the number of lag times.

Returns

  • best_fit_params (dict) – Dictionary containing the best fit values

  • theory (array) – Model evaluated using the best fit values. Will be of the same size as the passed parameter dData.