Usage

Python Environment

It is recommended that you work with Jupyter Notebook to go through the DDM analysis. The ‘walkthroughs’ and ‘tutorials’ here will be done in a Jupyter Notebook (these notebooks can be downloaded from the GitHub repository).

Setting the Analysis Parameters

Parameters such as the frame rate, pixel size, and file path to the data are all passed to the DDM functions using YAML. Image pre-processing can be done based off parameters such as binning and crop_to_roi. Calculation of the DDM matrix requires specification of how many lag times to calculate and over what range. Fitting the DDM matrix requires a specified model and initial guesses for all parameters. These details and more can be included in a single YAML file.

You can find an example YAML file for DDM analysis here.

More details on what goes into the YAML parameters file can be found here.

Analyzing your Data

Working through the ‘walkthroughs’ is the best way to get acquainted with the code and how to use it. Example data is provided in the GitHub repository which will allow you to follow along with the walkthrough and play around with it.

But for a quick introduction, the analysis begins with importing the PyDDM code, initializing the PyDDM.ddm_analysis_and_fitting.DDM_Analysis class to load the data and metadata, and running the PyDDM.ddm_analysis_and_fitting.DDM_Analysis.calculate_DDM_matrix() method. Moving on to fitting of the DDM matrix, one then initializes the PyDDM.ddm_analysis_and_fitting.DDM_Fit class and runs the PyDDM.ddm_analysis_and_fitting.DDM_Fit.fit() method.

import ddm_analysis_and_fitting as ddm
ddm_calc = ddm.DDM_Analysis("my_ddm_parameters.yml")
ddm_calc.calculate_DDM_matrix()
ddm_fit = ddm.DDM_Fit(ddm_calc.data_yaml)
fit01 = ddm_fit.fit()