This mANT implementation consists of three code files, plus supporting materials:
utils.py
: a custom Python module that contains functions to draw experimental stimuli, display them with the appropriate timing, send 8-bit triggers to an EEG system, collect a subject's responses and save them to diskmaster_script.py
: callsutils.py
's functions in the right orderconfig.py
: critical variables and class instances, used bymaster_script.py
andutils.py
mant-conditions.csv
: a.csv
file containing task condition parameters (one row per condition). Required by PsychoPymant-conditions-training.csv
: a shorter version ofmant-conditions.csv
, to use for trainingtext-messages
: a folder that contains text messages displayed during the experiment (e.g., instructions) in the form of.txt
files
Running master_script.py
is enough to run the mANT. If you want to modify a critical variable (e.g., the number of experimental blocks) or class instance (e.g., monitor parameters), just change it in config.py
. If you want to change what happens at any step along the task (e.g., the events inside a trial), act on utils.py
.
The aim of having three separate files is to keep the code as neat and readable as possible, in the spirit of Van Vliet (2020). By reading master_script.py
, you should be able to understand what happens when the code is run, without wasting time on details. If you want to dig deeper into a given aspect of the task (e.g., response scoring) you can open utils.py
and inspect the appropriate function. As for critical variables and class instances, keeping them in config.py
should make them easy to find and to modify without unvoluntary side effects. Finally, writing instructions in external .txt
files keeps the code readable because it eliminates the need for excessively long Python strings. Reading the external .txt
s has no impact on code efficiency, as it's a quick operation that's carried out when trials are not being run (i.e., when timing is irrelevant).
Please, preserve the current directory structure to minimise the risk of code breaking.
The timeline of this experiment (i.e., the time intervals between experimental events) is currently optimised for fMRI behavioural pilots.
For questions or improvement suggestions, you can:
- Open an issue at - or send a pull request to - this repository
- Write
matteo [dot] dematola [at] unitn [dot] it
Matteo De Matola (UniTN | GitHub)
Last updated January 2025