PyDeconv is an open-source Python package for empowering neuroimaging with ERP deconvolution for EEG and MEG data. It includes modules for creating linear models based on experimental features, allowing for the inclusion of interactions and non-linear contributions modeled via B-Splines. Additionally, PyDeconv provides tools to estimate collinearity between features using the VIF module.
Find detailed tutorials and examples in the documentation.
Follow the installation guide in the documentation to get started with PyDeconv.
The minimum required dependencies to run PyDeconv examples are:
The main class PyDeconv
takes three arguments:
config.py
, pandas.DataFrame
with columns labeled for event types and predictors, mne
raw object.To use PyDeconv, ensure that the configuration file and data are properly set up as shown below.
example_script.py
The example_script.py
demonstrates basic functionalities of PyDeconv. It applies a simple model to example data, It takes the configuration parameters from the config.py file , defines the model and fit it to the data, and then prints out the analysis results.
Additionally, you can use the provided example notebook to run a simple model on a sample dataset, illustrating the entire workflow.
Here are some example plots generated by running the example_script.py
:
rERPs activation plot
config.py
)The config.py
file defines the key parameters required to run PyDeconv. Formulas for the deconvolution models should follow Wilkinson notation, and the predictor variables must match the column labels in the feature DataFrame
. The solver can be any linear model compatible with scikit-learn, as described in the scikit-learn linear model documentation:
# Example config.py
events_of_interest = {
"first_intercept_event_type": "fixation",
"second_intercept_event_type": "saccade",
"second_delay": None
}
model = {
"model_name": "targMin",
"formula": "y ~ 1 + ontarget + scrank*mss",
"second_formula": "y ~ 1 + saccade_amplitude",
"tmin": -0.2,
"tmax": 0.6,
"use_splines": 5,
"solver": "ridge",
"scoring": "rms",
"second_delay": None ,
"eeg_chns": 64
}