How the Python Task Class Works
At the core of AutoCleanEEG is the Task class. Every task is just a Python class that inherits fromautoclean.core.task.Task
and defines a sequence of steps in its run()
method.
For new users: think of it as a recipe. Each line in run()
is an instruction that takes the current EEG dataset, applies some transformation, and passes it along to the next step.
Under the Hood: MNE Objects
AutoCleanEEG builds on MNE-Python, which provides data objects for EEG/MEG:- Raw – continuous EEG recordings.
- Epochs – segmented trials or fixed-length windows.
- Evoked – averaged responses (like ERPs).
Why It’s Powerful
- Chainable – You can call one function after another (
resample → filter → ICA → epoch
) and the data flows through. - Customizable – You can add, skip, or branch steps as needed.
- Interoperable – Anything you can do in Python with an MNE object can be slotted into a Task step.
- Not Limited to Python – With proper wrappers, you can even call MATLAB functions (e.g., via
matlab.engine
or exporting files to EEGLAB) inside a step.
Example: Transform Flow
Raw
→ Epochs
) is transformed step by step. At any point, you could insert your own function (e.g., a MATLAB-based algorithm) as long as you return a valid MNE object.
Branching & Customization
You’re not locked into a fixed sequence. You can:- Skip steps (by disabling them in the config or removing from
run()
). - Branch (e.g., create epochs two different ways, then compare results).
- Insert custom steps (e.g., your own artifact detector).