To run the practice and ten runs of experiment use .\RUN_PFCG.bat on CLI with partoipant name followed by it :
.\RUN_PFCG.bat participant_name
after each runs you can continue with pressing space key
Brief overview of the structure
Folders:
data: where the data for the experiment is stored. within the main 'data' directory, you can find a sub-directory for each participant.
data can be participant data/results, but also includes conditions files for each participant as generated by PFCG_generate_trials.py ** important - be sure to manually create a subfolder in this directory with each participant name/code, before trying to run any scripts to generate their trials and before trying to collect any data (otherwise you will get a 'FileNotFound' error.
pfcg_generate_stimuli: contains the script for stimuli generation. Viewing distance, visual angle and parameters of this calibre can be adjusted here. Best if file structures names kept consistent for running of code. If changed, be sure to update in the appropriate scripts.
pfcg_utils: directory concerned with the defining of functions and classes used elsewhere in the experiment.
triggers.csv: sheet explaining the trigger codes. if they are changed here, be sure to update in utils_stimuli and vice versa.
utils_stimuli.py:
functions:
sec_to_fr: conversion of temporal scale from seconds to frames (determined by monitor refresh rate)
classes:
StimulusPresenter: manages stimulus presentation timing and trigger codes for the experiment
functions within StimulusPresenter:
present_stimulus: draw a stimulus, flips the window, sends trigger code, presents for a defined duraction
present_RS: presents the resting state fixation (60s duration, sends trigger code 7)
present_fixation: presents the fixation at jittered intervals between 1400-1600ms in increments of 10ms (1.4, 1.61, 0.01), sends trigger code 7
present_cue: presents the cue for a duration of 500ms. Trigger code of cue defined in get_cue_trigger_code (since it is not constant and updates each trial)
target_type: returns the target type to be presented (right cong, left cong, right incg, left incg). trialid defined in utils_trials
target_response: draws the appropriate target for 500ms and begins the timer for RT at target onset. Draws the fixation while waiting for a response
get_cue_stimulus: returns the appropriate cue to display based on the cueid (defined in utils_trials)
get_cue_trigger_code: returns the appropriate trigger code for the cue
get_target_trigger_code: returns the appropriate trigger code for the target. Updates with each corresponding position post-cue
get_response_trigger_code: returns the appropriate trigger code for participant response
utils_trials.py: defines functions concerned with different trial types as defined in the participant conditions file.
functions:
get_block_trialtypes: calls the participant conditions file and returns the trial type
generate_trials_balanced: used to generate a randomised conditions file for each participant. Commented out since we decided to keep the block structure the same (master_trials.csv) but shuffle their order. If changed to have a separately randomised conditions file for each participant, uncomment and change to the relevant function in PFCG_generate_trials.py
shuffle_blocks: shuffles the blocks
utils_triggers.py: can be deleted? check on Tuesday
stimuli: contains the stimuli to be called and presented in the experiment
monitor_settings.py: can be deleted? check on Tuesday
PFC_cfg.py: defines the paths and a function for preloading stimuli for the experiment
functions:
preload_stimuli: loads and returns the following stimuli -
Image Stimuli
targets: right_target, left_target
cues: cue_cong, cue_incg, Fixation_Cue
Text Stimuli - change what you want to be shared accordingly
welcome text, resting state text, text for beginning the experiment
PFCG_generate_trials.py: generates the trials for each participant. At present, the shuffle_blocks function is used
** important - be sure to have a folder with the inside the 'data' directory that matches the participant_id defined here
PFCG_paradigm.py: code for experimental paradigm and participant data collection. See comments throughout the code for increased clarity.
Things which you may wish to change here:
group_size: number of targets to be shown (currently 5)
if this is changed, the script in utils_trials will also need to be updated
jitter (currently set at a random float between 1400-1600ms in 10ms increments
Monitor name and settings defined here
** important - be sure to have a folder with the inside the 'data' directory that matches the participant_id defined here
** at the moment, the paradigm has coded the key 'escape' for piloting and debugging purposes. When running the experiment, be sure to comment this out.
testmonitor.py: can be deleted? check on Tuesday
key differences between _EEG and _home Coding of triggers updated in _EEG, not updated in _home (unnecessary) Monitor names and settings are different EEG monitor = 'Sudring' key_pressed is different (home = left/right, EEG = num_7/num_9)
File structure is important, otherwise the code may not run. If you change anything, be sure to update the corresponding working directory (wd) in the code