PyDDM.fit_parameters_dictionaries#

This module contains a dictionary for each of the different models for fitting the DDM matrix or the ISF. It also contains functions for setting the initial guesses and bounds for the fitting parameters for these models.

ddm_matrix_single_exponential#
Type:

dict

Single exponential model for the DDM matrix. This model fits the DDM matrix to \(D(q,\Delta t) = A(q) [1 - \exp(-(\Delta t/\tau (q))^{s(q)})] + B(q)\). The parameter \(s(q)\) is the stretching exponent. This parameter can be fixed to 1 if a simple exponential function is desired.

For this dictionary, the model_function key is set to PyDDM.ISF_and_DDMmatrix_theoretical_models.dTheorySingleExp_DDM(). This dictionary also contains the key data_to_use which is equal to ‘DDM Matrix’. The key parameter_info is set to a list of dictionaries. This is a 4 element list corresponding to the parameters \(A\), \(\tau\), \(B\), and \(s\). These are given the parameter names, respectively: ‘Amplitude’, ‘Tau’, ‘Background’ and ‘StretchingExp’.

Note: To use this model, set the model parameter in your yaml file to ‘DDM Matrix - Single Exponential’. Or, once you have initialized PyDDM.ddm_analysis_and_fitting.DDM_Fit, you can switch to this model with:

my_fit_class.reload_fit_model_by_name('DDM Matrix - Single Exponential')
ddm_matrix_single_exponential_nonerg#
Type:

dict

Single exponential model for the DDM matrix with a non-ergodicity parameter, \(C(q)\). This model fits the DDM matrix to \(D(q,\Delta t) = A(q) [1 - f(q, \Delta t)] + B(q)\) where the ISF is equal to \(f(q,\Delta t) = [1 - C(q)] \exp(-(\Delta t/\tau (q))^{s(q)}) + C(q)\).

For this dictionary, the model_function key is set to PyDDM.ISF_and_DDMmatrix_theoretical_models.dTheorySingleExp_Nonerg_DDM(). This dictionary also contains the key data_to_use which is equal to ‘DDM Matrix’. The key parameter_info is set to a list of dictionaries. This is a 5 element list corresponding to the parameters \(A\), \(\tau\), \(B\), \(s\), and \(C\). These are given the parameter names, respectively: ‘Amplitude’, ‘Tau’, ‘Background’, ‘StretchingExp’, and ‘NonErgodic’.

Note: To use this model, set the model parameter in your yaml file to ‘DDM Matrix - Single Exponential - NonErgodic’. Or, once you have initialized PyDDM.ddm_analysis_and_fitting.DDM_Fit, you can switch to this model with:

my_fit_class.reload_fit_model_by_name('DDM Matrix - Single Exponential - NonErgodic')
ddm_matrix_double_exponential#
Type:

dict

Double exponential model for the DDM matrix. This model fits the DDM matrix to \(D(q,\Delta t) = A(q) [1 - f(q, \Delta t)] + B(q)\) where the ISF is equal to \(f(q,\Delta t) = a(q) \exp(-(\Delta t/\tau_1 (q))^{s_1(q)}) + (1-a(q)) \exp(-(\Delta t/\tau_2 (q))^{s_2(q)})\). Here, \(a(q)\) is the fraction of the dynamics described with the first decay time, \(\tau_1(q)\).

For this dictionary, the model_function key is set to PyDDM.ISF_and_DDMmatrix_theoretical_models.dTheoryDoubleExp_DDM(). This dictionary also contains the key data_to_use which is equal to ‘DDM Matrix’. The key parameter_info is set to a list of dictionaries. This is a 7 element list corresponding to the parameters \(A\), \(B\), \(a\), \(\tau_1\), \(s_1\), \(\tau_2\), and \(s_2\). These are given the parameter names, respectively: ‘Amplitude’, ‘Background’, ‘Fraction1’, ‘Tau’, ‘StretchingExp’, ‘Tau2’, and ‘StretchingExp2’.

Note: To use this model, set the model parameter in your yaml file to ‘DDM Matrix - Double Exponential’. Or, once you have initialized PyDDM.ddm_analysis_and_fitting.DDM_Fit, you can switch to this model with:

my_fit_class.reload_fit_model_by_name('DDM Matrix - Double Exponential')
ddm_matrix_exponential_ballistic#
Type:

dict

DDM matrix is modeled with an exponential term and a term to describe ballistic motion that has a distribution of velocities modeled with a Shulz distribution. The DDM matrix is \(D(q,\Delta t) = A(q) [1 - f(q, \Delta t)] + B(q)\) where the ISF is equal to \(f(q,\Delta t) = \exp(-(\Delta t/\tau_1 (q))^{s_1(q)}) \times [(1-a) + a V(q, \Delta t)]\). Here, \(V = \frac{\tau_2 \times (Z+1)}{Z \times \Delta t} \frac{Z \times \tan^{-1}(\theta)}{(1+\theta^2)^{Z/2}}\) and \(\theta = \frac{\Delta t}{\tau_2 \times (Z+1)}\). The parameter \(Z(q)\) is referred to as the Schulz number and characterizes the distribution of velocities.

For this dictionary, the model_function key is set to PyDDM.ISF_and_DDMmatrix_theoretical_models.dTheoryExpAndBallistic_DDM(). This dictionary also contains the key data_to_use which is equal to ‘DDM Matrix’. The key parameter_info is set to a list of dictionaries. This is a 7 element list corresponding to the parameters \(A\), \(B\), \(\tau_1\), \(s\), \(\tau_2\), \(a\), and \(Z\). These are given the parameter names, respectively: ‘Amplitude’, ‘Background’, ‘Tau’, ‘StretchingExp’, ‘Tau2’, ‘FractionBallistic’, and ‘SchulzNum’.

Note: To use this model, set the model parameter in your yaml file to ‘DDM Matrix - Exponential and Ballistic’. Or, once you have initialized PyDDM.ddm_analysis_and_fitting.DDM_Fit, you can switch to this model with:

my_fit_class.reload_fit_model_by_name('DDM Matrix - Exponential and Ballistic')
ddm_matrix_ballistic#
Type:

dict

DDM matrix is modeled with a term to describe ballistic motion that has a distribution of velocities modeled with a Shulz distribution. The DDM matrix is \(D(q,\Delta t) = A(q) [1 - f(q, \Delta t)] + B(q)\) where the ISF is equal to \(f(q,\Delta t) = V(q, \Delta t)]\). Here, \(V = \frac{\tau \times (Z+1)}{Z \times \Delta t} \frac{Z \times \tan^{-1}(\theta)}{(1+\theta^2)^{Z/2}}\) and \(\theta = \frac{\Delta t}{\tau \times (Z+1)}\). The parameter \(Z(q)\) is referred to as the Schulz number and characterizes the distribution of velocities.

For this dictionary, the model_function key is set to PyDDM.ISF_and_DDMmatrix_theoretical_models.dTheoryBallistic_DDM(). This dictionary also contains the key data_to_use which is equal to ‘DDM Matrix’. The key parameter_info is set to a list of dictionaries. This is a 4 element list corresponding to the parameters \(A\), \(B\), \(\tau\), and \(Z\). These are given the parameter names, respectively: ‘Amplitude’, ‘Background’, ‘Tau’, and ‘SchulzNum’.

Note: To use this model, set the model parameter in your yaml file to ‘DDM Matrix - Ballistic’. Or, once you have initialized PyDDM.ddm_analysis_and_fitting.DDM_Fit, you can switch to this model with:

my_fit_class.reload_fit_model_by_name('DDM Matrix - Ballistic')
isf_single_exponential#
Type:

dict

Single exponential model for the intermediate scattering function (ISF). This model fits the ISF to to \(f(q,\Delta t) = \exp(-(\Delta t/\tau (q))^{s(q)})\). The parameter \(s(q)\) is the stretching exponent. This parameter can be fixed to 1 if a simple exponential function is desired.

For this dictionary, the model_function key is set to PyDDM.ISF_and_DDMmatrix_theoretical_models.dTheorySingleExp_ISF(). This dictionary also contains the key data_to_use which is equal to ‘ISF’. The key parameter_info is set to a list of dictionaries. This is a 2 element list corresponding to the parameters \(\tau\) and \(s\). These are given the parameter names, respectively: ‘Tau’ and ‘StretchingExp’.

Note: To use this model, set the model parameter in your yaml file to ‘ISF - Single Exponential’. Or, once you have initialized PyDDM.ddm_analysis_and_fitting.DDM_Fit, you can switch to this model with:

my_fit_class.reload_fit_model_by_name('ISF - Single Exponential')
isf_single_exponential_nonerg#
Type:

dict

Single exponential model for the intermediate scattering function (ISF) with a non-ergodicity parameter, \(C(q)\). This model fits the ISF to \(f(q,\Delta t) = [1 - C(q)] \exp(-(\Delta t/\tau (q))^{s(q)}) + C(q)\).

For this dictionary, the model_function key is set to PyDDM.ISF_and_DDMmatrix_theoretical_models.dTheorySingleExp_Nonerg_ISF(). This dictionary also contains the key data_to_use which is equal to ‘ISF’. The key parameter_info is set to a list of dictionaries. This is a 3 element list corresponding to the parameters \(\tau\), \(s\), and \(C\). These are given the parameter names, respectively: ‘Tau’, ‘StretchingExp’, and ‘NonErgodic’.

Note: To use this model, set the model parameter in your yaml file to ‘ISF - Single Exponential - NonErgodic’. Or, once you have initialized PyDDM.ddm_analysis_and_fitting.DDM_Fit, you can switch to this model with:

my_fit_class.reload_fit_model_by_name('ISF - Single Exponential - NonErgodic')
isf_double_exponential#
Type:

dict

Double exponential model for the intermediate scattering function (ISF). This model fits the ISF to \(f(q,\Delta t) = a(q) \exp(-(\Delta t/\tau_1 (q))^{s_1(q)}) + (1-a(q)) \exp(-(\Delta t/\tau_2 (q))^{s_2(q)})\). Here, \(a(q)\) is the fraction of the dynamics described with the first decay time, \(\tau_1(q)\).

For this dictionary, the model_function key is set to PyDDM.ISF_and_DDMmatrix_theoretical_models.dTheoryDoubleExp_ISF(). This dictionary also contains the key data_to_use which is equal to ‘ISF’. The key parameter_info is set to a list of dictionaries. This is a 5 element list corresponding to the parameters \(a\), \(\tau_1\), \(s_1\), \(\tau_2\), and \(s_2\). These are given the parameter names, respectively: ‘Fraction1’, ‘Tau’, ‘StretchingExp’, ‘Tau2’, and ‘StretchingExp2’.

Note: To use this model, set the model parameter in your yaml file to ‘ISF - Double Exponential’. Or, once you have initialized PyDDM.ddm_analysis_and_fitting.DDM_Fit, you can switch to this model with:

my_fit_class.reload_fit_model_by_name('ISF - Double Exponential')
isf_exponential_ballistic#
Type:

dict

The intermediate scattering function (ISF) is modeled with an exponential term and a term to describe ballistic motion that has a distribution of velocities modeled with a Shulz distribution. The ISF is equal to \(f(q,\Delta t) = \exp(-(\Delta t/\tau_1 (q))^{s_1(q)}) \times [(1-a) + a V(q, \Delta t)]\). Here, \(V = \frac{\tau_2 \times (Z+1)}{Z \times \Delta t} \frac{Z \times \tan^{-1}(\theta)}{(1+\theta^2)^{Z/2}}\) and \(\theta = \frac{\Delta t}{\tau_2 \times (Z+1)}\). The parameter \(Z(q)\) is referred to as the Schulz number and characterizes the distribution of velocities.

For this dictionary, the model_function key is set to PyDDM.ISF_and_DDMmatrix_theoretical_models.dTheoryExpAndBallistic_ISF(). This dictionary also contains the key data_to_use which is equal to ‘ISF’. The key parameter_info is set to a list of dictionaries. This is a 5 element list corresponding to the parameters \(\tau_1\), \(s\), \(\tau_2\), \(a\), and \(Z\). These are given the parameter names, respectively: ‘Tau’, ‘StretchingExp’, ‘Tau2’, ‘FractionBallistic’, and ‘SchulzNum’.

Note: To use this model, set the model parameter in your yaml file to ‘ISF - Exponential and Ballistic’. Or, once you have initialized PyDDM.ddm_analysis_and_fitting.DDM_Fit, you can switch to this model with:

my_fit_class.reload_fit_model_by_name('ISF - Exponential and Ballistic')
isf_ballistic#
Type:

dict

The intermediate scattering function (ISF) is modeled with a term to describe ballistic motion that has a distribution of velocities modeled with a Shulz distribution. The ISF is \(f(q,\Delta t) = V(q, \Delta t)]\). Here, \(V = \frac{\tau \times (Z+1)}{Z \times \Delta t} \frac{Z \times \tan^{-1}(\theta)}{(1+\theta^2)^{Z/2}}\) and \(\theta = \frac{\Delta t}{\tau \times (Z+1)}\). The parameter \(Z(q)\) is referred to as the Schulz number and characterizes the distribution of velocities.

For this dictionary, the model_function key is set to PyDDM.ISF_and_DDMmatrix_theoretical_models.dTheoryBallistic_ISF(). This dictionary also contains the key data_to_use which is equal to ‘ISF’. The key parameter_info is set to a list of dictionaries. This is a 2 element list corresponding to the parameters \(\tau\) and \(Z\). These are given the parameter names, respectively: ‘Tau’, and ‘SchulzNum’.

Note: To use this model, set the model parameter in your yaml file to ‘ISF - Ballistic’. Or, once you have initialized PyDDM.ddm_analysis_and_fitting.DDM_Fit, you can switch to this model with:

my_fit_class.reload_fit_model_by_name('ISF - Ballistic')

Functions

extract_array_of_fixed_or_not

From a parameter dicionary, return an array specifying whether the parameters are fixed (True) or not (False)

extract_array_of_param_mins_maxes

From a parameter dictionary, return two arrays: first corresponds to the lower bounds; second to upper bounds.

extract_array_of_parameter_values

From a parameter dictionary, return array of the initial guesses for the parameters.

populate_intial_guesses

Set the initial guess for all parameters in a parameter dictionary.

populate_min_and_max_of_paramters

Set the initial guess for all parameters in a parameter dictionary.

return_parameter_names

Returns a list of the parameter names.

return_possible_fitting_models

Prints a list of the different fitting models available.

set_parameter_fixed

Sets a parameter to be fixed.

set_parameter_guess_and_limits

Sets the initial guess and bounds for a parameter when doing the fitting

set_parameter_initial_guess

Sets the initial guess for a parameter.

set_parameter_limits

Sets the initial guess and bounds for a parameter when doing the fitting

turn_parameters_into_dataframe_for_display

This function takes a list of dictionaries, one dictionary per parameter of a model for the ISF or DDM Matrix, and converts it to a Pandas dataframe.