Import environmental dependencies with anaconda:
$ conda env create -f environment.yml
In 'analysis' are data and scripts (in progress) to test for renewal. In 'collection' are scripts for data collection. Hardware supported for data collection are
- Eyetracker: Eyelink 1000
Display managed by psychopy via 'EyelinkCoreGraphicsPsychopy'
a pylink script developed by Zhiguo Wang (zhiguo@sr-research.com)
and 'tracker_functions' in this repository.
- Skin Conductance: BIOPAC MP150
Triggers for experimental onset and stimulus events handled by
pyserial, with the conversion from USB to parallel port via
Black Box (http://www.blackboxtoolkit.com/usbttl.html)
- Electrical stimulation: SD9 STIMULATOR
Triggered by pyserial via an arduino board
(https://store.arduino.cc/arduino-uno-rev3)
Given these are available and configured, test that they are experiment ready with
$ python test_hardware.py
to validate that each of the three are working correctly. Alternatively, to test each independently, you can append either 'SD9', 'biopak' or 'eyelink' to the command above, e.g. $ python test_hardware.py 'eyelink'.
Stimuli can be generated by recording a model undergoing first-person conditioning while running the following command in the collection/ folder
$ python model_stimuli.py
or choosing from the videos available online: https://tinyurl.com/ycwbs64a . With stimuli ready, include a path to the video in line 21 of 'tracker_functions.py'. The experiment can then be run in collection/ with
$ python day_one.py
For the first subject, outputs will be a file of the self reported behavioral date collected during the experiment in self_report_s01.py, a file containing the gaze data s_01.edf, and a file that must be names manually from the Acknowledge software with the skin conductance data. Subject IDs can also be added to the line above to name the resulting output files--e.g. $ python day_one 's_xy' will result in output files of the format self_report_s_xy.npy. Names must be less than 8 characters long, because of eyelink's constraints in saving gaze data. For the second day of data collection functions have the same form
$ python day_two.py
The script from both days import three modules, 'instructions', 'stimuli', and 'exit_questions' that perform each section of data collection. In addition to loading packages for stimulis presentation (psychopy), communicating with hardware (os) or command line operations (os), these scripts also call helper functions coordinate the hardware with the experiment. For each segment, these functions are
instructions:
- keyboard_input: Contains functions for collecting numeric and alphabetic
key presses, and handling user input to the hardware
- experiment_ports: Contains functions for finding, selecting, and then
communicating with hardware--in this case, the SD9 for administering
shock
stimuli:
- experiment_ports: In this case, opens the biopac and signals relevant
stimulus markers across the experiment
- tracker_functions: main interface for coordinating the eyelink hardware
for collecting gaze data, as well as toggling the experimental display
between the eyelink and experimental hard drives. configures monitor,
signals eyelink with relevant stimuli, aligns frames for later analysis,
performs drift correction across experiment, saves data, etc. etc. etc.
- design_parameters: Loads design parameters like stimulus length, design
structure, and the indices for marking events
exit_questions:
- keyboard_inputs: Collects subjects responses to questions from slides in
instruction_slides/, aggregates these responses with those from
'instructions' and saves self report data.
If you have any questions, contact me at tyler.ray.bonnen@gmail.com :)