OS Win10:
PsychoPy version v2024.1.4
**Standard Standalone? Y
I want a set of trials which are part of the association phase whereby participants will see a series of 3 videos (each shown 15 times but in random order). However, which three videos are shown depends on which condition participants are in. There are three overall conditions: silent (no sound accompanies the action), sonified (a sound mapped to the action kinematics is played during the action) and sham (white noise is played during the action). Participants will need to be randomly allocated to each condition. Technically there are 6 conditions (which will be collapsed into the 3 overall conditions described above for the purposes of the analysis) to ensure that each action is matched to the sham, sonified and silent conditions an equal number of times across participants. So the conditions look like this:
C1 - down fist is linked with sham sound, up fist is linked with sonified sound and forward fist is linked with silence.
C2 - down fist is linked with sonified sound, up fist is linked with silence and forward fist is linked with sham sound.
C3 - down fist is linked with silence, up fist is linked with sham sound and forward fist is linked with sonified sound.
C4 - down fist is linked with sham sound, up fist is linked with silence and forward fist is linked with sonified sound.
C5 - down fist is linked with sonified sound, up fist is linked with sham sound and forward fist is linked with silence.
C6 - down fist is linked with silence, up fist is linked with sonified sound and forward fist is linked with sham sound.
I also need Psychopy to record which video is seen and which counterbalance is being shown, the key that is used to respond (the up arrow key is correct when seeing the up videos, the down arrow key is correct when seeing the down arrow keys and the left arrow key is correct when seeing the for videos and the RT.
I’ve set up the following headings in a .csv file:
DownVideo, UpVideo, ForVideo, Condition, Correct_Key_Down_Video, Correct_Key_Up_Video, Correct_Key_For_Video
DownVideo represents the different permutations when the fist is down(the names are the names of the videos), UpVideo does the same for UP and ForVideo does the same for forward fist. The way they are set up is the counterbalance. So row 1 is counterbalance 1, row 2 is counterbalance 2 etc.
Condition refers to which condition they are and then correct_key columns represent which is the correct key.
I have set up two routines (called trial and RandomiseVideos) within a loop (called trials). The loo[ is set to run 15 times and take from the aforementioned .csv file.
Trial is set up to have Video_1, Video_2 and Video_3 (each set up with $video1, $Video2, $video3 as the movie files). I have then got a bit of code called Random_Allocation with the following within begin experiment:
import random
condition = random.choice([‘C1’, ‘C2’, ‘C3’, ‘C4’, ‘C5’, ‘C6’])
Then s keyboard response set up with the left, up and down keys and infinite duration and to force end of routine. Within data I have store first key and store correct checked. I have correct answer blank.
Then I have another bit of code called set_correct_response with the following code within begin routine:
Determine the correct response based on the current video being shown
if video.file == ‘UpSham.mp4’:
response.corr = ‘up’
elif video.file == ‘DownSham.mp4’:
response.corr = ‘down’
elif video.file == ‘ForSham.mp4’:
response.corr = ‘left’
elif video.file == ‘UpSilent.mp4’:
response.corr = ‘up’
elif video.file == ‘DownSilent.mp4’:
response.corr = ‘down’
elif video.file == ‘ForSilent.mp4’:
response.corr = ‘left’
elif video.file == ‘UpSon.mp4’:
response.corr = ‘up’
elif video.file == ‘DownSon.mp4’:
response.corr = ‘down’
elif video.file == ‘ForSon.mp4’:
response.corr = ‘left’
else:
response.corr = None
The randomise videos routine had just three movie stimuli (Video1, 2 and 3) each set up with the movie file $Video1 (or 2 or 3).
I get the following error when I try to run it:
Alert 4210:
JavaScript Syntax Error in ‘Begin JS Experiment’ tab. See ‘Line 1: Unexpected token’ in the ‘Begin JS Experiment’ tab.
For further info see 4210: Probable syntax error detected in your JavaScript code — PsychoPy v2024.1.5
It also doesn’t seem to like my file name for the videos even though they are correct, which makes me think I am not linking correctly somehow?
Thanks,
Kim