Experiment example (PsychoPy): Masked Priming English
Authors: Crystal Jemy, Roberto Petrosino (projects), Hadi Zaatiti (MEG implementation)
Description
A typical masked priming experiment consists of four main parts:
Introduction screen: explanation of the task (lexical decision)
Practice: a short practice to ensure that the participant is familiar with the task (usually 10-20 trials)
Experiment: the actual experiment
Break screen: a break from the experiment every n trials
In parts B and C, a typical trial of a masked priming lexical decision experiment consists of the following:
a series of hashes (mask): 500 ms (not coded in the stimulus files but directly in the script, since it does not change across conditions). The default is ten hashes (
##########); the experimenter can type another mask for a run.a prime stimulus (in our case, a lower-case word): variable duration, typically between 33 and 50 ms. Prime Lexicality Project: 50 ms. Stem Priming Project: 33 ms. This may change from experiment to experiment, and is settable at the beginning of each run.
a TARGET stimulus (in our case, an all-caps word): 2500 ms (or until participant’s response). The participant is asked to decide whether the TARGET is a word or not as fast as possible by pressing two buttons on the response box. An answer given after the 2500 ms is not counted: the trial is saved without a response (
n/a). In the original script, a keyboard was used, so the j and f keys were used for word and non-word decision, respectively; these keys are still the ones of a run without the button box.
The loop of ######-prime-TARGET triplets is fed from a CSV file containing all the pairs to be presented in a single recording (the prime and target words, as well as other variables such as the condition(s) and the correct response). Typically, an experiment has at least two different stimulus lists (there may be more), and each participant is assigned one at the beginning of the recording, to guarantee proper counterbalancing across participants. The list is chosen at the beginning of each run of the experiment.
Participants are given breaks during the experiment. By default there is a break every 20 trials (3 breaks for a list of 80 trials, 25 for a list of 512); the experimenter can set another number of trials between breaks at the beginning of each run.
Words are shown in yellow on a black background, in a monospaced font (Courier New). The lights of the MSR are off during the whole recording.
Trigger setup
The online trigger events use 3 different pulse channels: one for the prime words, one for the TARGET words, and one for the response. Additional information (e.g., the properties of the stimuli and the conditions) is added offline, by merging the results files (beh.tsv / events.tsv) by trial index. Trigger codes are sent in coordination with the photodiode to guarantee timing precision and accuracy.
As implemented (mp_config.EVENT_LINES):
Event |
KIT channel |
MNE channel |
When |
|---|---|---|---|
|
224 |
|
First frame of the prime |
|
225 |
|
First frame of the TARGET |
|
226 |
|
First flip after a word / non-word button press (the delay to the press, 0 to about 11 ms, is saved as |
Pulses are one frame long (8.3 ms at 120 Hz), sent through the DataPixx digital output right after the vertical blank; two pulses are never on adjacent frames. Practice trials send no pulses.
The photodiode patch (top-right corner) follows the triggers exactly: it is white on the frames a pulse is high (one frame at the prime onset, one at the TARGET onset, one with the response pulse) and black on every other frame.
One line per event is the single_channel trigger mode of the lab’s KIT general pipeline; every events.json written by the experiment says so and names the three lines.
Projects
Prime Lexicality Project (PLP), led by Crystal Jemy. Lists projects/plp/plp_list1..6.csv (80 trials each), conditions identity, decomposition_w, decomposition_pw and control; prime 50 ms.
Stem Priming Project (SPP), led by Roberto Petrosino. Lists projects/spp/spp_list1..2.csv (512 trials each), conditions identity, transparent, opaque, orthographic, ortho_syll, ortho_nsyll, semantic, ww_fillers and nw_fillers crossed with prime type (related / unrelated); prime 33 ms.
Both use the right ResponsePixx box: RED = word, YELLOW = non-word.
The lists of a project are the files found in its folder: adding a list is adding a CSV file. A list is checked and approved with python validate_lists.py; the launcher warns before an official run with a list that was not approved or was changed since.
Eyetracking
Eye tracking with the EyeLink is part of the experiment and is on by default. The camera set-up, calibration and validation are done from the experiment before the task, and again at any instruction or break screen with the C key. The recording (EDF) is copied from the Host PC when the run ends and saved with the run, under sourcedata/sub-<ID>/ses-<SS>/eyetrack/. The same events as the triggers are written into it as messages (mask, prime and TARGET onsets, response), together with the trial number and the variables of each trial.
Running the experiment
python main.py opens the launcher.
Step 1: the project, four checkboxes (eye tracker, ResponsePixx button box, MEG triggers, debug mode) and an action. As it opens, the launcher is set for an official run with a participant. Unticking the button box gives a keyboard run, unticking the triggers a run without pulses, and debug mode a window instead of full screen.
Step 2: participant, session and stimulus list. The settings that rarely change (prime duration, mask, breaks, number of trials, screen, seed) are folded under “Advanced settings”.
An official run (button box, triggers, full screen, a person answering) is saved under data/<project>/; every other run is a test and is saved under data_test/<project>/.
The action “Trigger test with the MEG recording” runs the whole experiment without a participant: the answers are simulated and nothing has to be pressed. Recorded in the MEG, it gives a .con file to count the triggers with.
After an acquisition, the triggers of the recording are checked with the sanity check of the KIT general pipeline (1-kit_count_sanity_check_single_channel.py), not with a script of the experiment. The pipeline has one starting configuration per project and one for trigger tests: maskedpriming_plp_config.yml, maskedpriming_spp_config.yml and maskedpriming_triggertest_config.yml.
The delay between a trigger pulse and the light of the screen is measured in every recording from the photodiode (KIT 232, MISC 009) with 4-kit_photodiode_timing.py of the same pipeline, run after the events stage. It reports the mean delay and its spread for the dataset and writes event files in which the prime and TARGET events (the visual ones) are moved by the median delay of their recording; the response events are not moved. Every events.json written by the experiment declares the photodiode (Photodiode) and says, per trigger line, what the event is (Modality) and that the patch flashes with it (PhotodiodePatch).
The project README has the details of all of the above.
Additional technical issues (in order of importance)
Response Hardware Selection. The lab provides both multi-button and two-button response boxes. The implementation uses the multi-button ResponsePixx (right box, two colours) and reads it through the DataPixx digital inputs.
Experimental Breaks. Participants are given periodic rest breaks during testing; the number of trials between breaks is set in the launcher for each run (default: every 20 trials for both projects).
Data Collection Interface. A lightweight startup dialog in two steps (see “Running the experiment”): the experimenter picks the project and the run options, then enters the participant ID and selects the stimulus list; the prime duration, the mask and the break schedule can be changed for the run. The hardware can be checked from the same dialog (response box, trigger lines, screens), and a run without the eye tracker, the button box or the triggers serves as a rehearsal on any computer.
Automated Script Generator (GUI/Tool). Longer-term, it would be helpful to develop a standalone utility script that allows students to input custom experimental parameters (e.g., prime duration, break frequency, stimulus file naming) and automatically generate a pre-configured masked priming script. The current script already takes these as settings of
mp_config.PROJECTS.
Code Access
Masked priming experiment (start with main.py)
Project README: running, trigger protocol, trigger test, output files, after an acquisition