Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- API: 2
- OpenSesame: 3.0.7b1
- Platform: posix
- ---
- set width 1024
- set uniform_coordinates yes
- set title "New experiment"
- set subject_parity even
- set subject_nr 0
- set start experiment
- set height 768
- set foreground white
- set experiment_path "/media/leapadmin/SERAPHINA/Tamil Eng Exp"
- set description "Default description"
- set coordinates uniform
- set compensation 0
- set canvas_backend xpyriment
- set background black
- define inline_script click_paradigm
- set description "Executes Python code"
- set _run ""
- ___prepare__
- current_idx = var.get('count_nonword_sequence')
- if current_idx in click_indices:
- print("Indices: {} - current_idx: {}".format(click_indices, current_idx))
- click_sound.play()
- __end__
- define inline_script define_nonwords
- set description "Executes Python code"
- set _run ""
- ___prepare__
- import random
- # This to expose variables to other Python inline block
- global placeholders, nonwords, wordmap
- placeholders = ['a0', 'a1', 'a2', 'a3', 'b0', 'b1', 'b2', 'b3']
- nonwords = ['machant', 'knovy', 'gonper', 'rafic', 'bockel', 'howest', 'pelly', 'sovate']
- random.shuffle(nonwords)
- # To create a map between placeholders and nonwords
- wordmap = {x: y for x, y in zip(placeholders, nonwords)}
- __end__
- define sequence experiment
- set flush_keyboard yes
- set description "Runs a number of items in sequence"
- run new_sketchpad always
- run define_nonwords always
- run setup_random_clicks always
- run nonword_loop always
- define inline_script keyboard_resp_script
- set description "Executes Python code"
- set _run ""
- ___prepare__
- my_keyboard = keyboard(keylist=['SPACE'], timeout=450)
- start_time = clock.time()
- current_idx = var.get('count_nonword_sequence')
- #if current_idx in click_indices:
- var.set('my_subj_should_click', current_idx in click_indices)
- key, end_time = my_keyboard.get_key()
- if key is not None:
- var.set('my_subj_click_rt', end_time - start_time)
- else:
- var.set('my_subj_click_rt', 0)
- __end__
- define logger logger
- set description "Logs experimental data"
- set auto_log yes
- define loop new_loop
- set skip 0
- set repeat 1
- set order random
- set offset no
- set item ""
- set description "Repeatedly runs another item"
- set cycles 1
- set column_order timeout
- set break_if never
- setcycle 0 timeout "=900 + randint(0,600)"
- run
- define sketchpad new_sketchpad
- set duration keypress
- set description "Displays stimuli"
- draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text=Aloha x=0 y=0 z_index=0
- define sketchpad nonword
- set duration 240
- set description "Displays stimuli"
- draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=31 html=yes show_if=always text="[nonword]" x=0 y=0 z_index=0
- define loop nonword_loop
- set skip 0
- set repeat 1
- set order sequential
- set offset no
- set item nonword_sequence
- set description "Repeatedly runs another item"
- set cycles 40
- set column_order wordorder
- set break_if never
- setcycle 0 wordorder "a0"
- setcycle 1 wordorder "a1"
- setcycle 2 wordorder "b0"
- setcycle 3 wordorder "b1"
- setcycle 4 wordorder "a0"
- setcycle 5 wordorder "a2"
- setcycle 6 wordorder "b0"
- setcycle 7 wordorder "b3"
- setcycle 8 wordorder "a0"
- setcycle 9 wordorder "a3"
- setcycle 10 wordorder "b0"
- setcycle 11 wordorder "b1"
- setcycle 12 wordorder "a0"
- setcycle 13 wordorder "a2"
- setcycle 14 wordorder "b0"
- setcycle 15 wordorder "b2"
- setcycle 16 wordorder "a0"
- setcycle 17 wordorder "a1"
- setcycle 18 wordorder "b0"
- setcycle 19 wordorder "b3"
- setcycle 20 wordorder "a0"
- setcycle 21 wordorder "a3"
- setcycle 22 wordorder "b0"
- setcycle 23 wordorder "b2"
- setcycle 24 wordorder "a0"
- setcycle 25 wordorder "a1"
- setcycle 26 wordorder "b0"
- setcycle 27 wordorder "b1"
- setcycle 28 wordorder "a0"
- setcycle 29 wordorder "a3"
- setcycle 30 wordorder "b0"
- setcycle 31 wordorder "b2"
- setcycle 32 wordorder "a0"
- setcycle 33 wordorder "a2"
- setcycle 34 wordorder "b0"
- setcycle 35 wordorder "b1"
- setcycle 36 wordorder "a0"
- setcycle 37 wordorder "a3"
- setcycle 38 wordorder "b0"
- setcycle 39 wordorder "b3"
- run nonword_sequence
- define inline_script nonword_mapping
- set description "Executes Python code"
- set _run ""
- ___prepare__
- var.set('nonword', wordmap[var.get('wordorder')])
- __end__
- define sequence nonword_sequence
- set flush_keyboard yes
- set description "Runs a number of items in sequence"
- run nonword_mapping always
- run nonword always
- run click_paradigm always
- run keyboard_resp_script always
- run logger always
- define inline_script setup_random_clicks
- set description "Executes Python code"
- set _run ""
- ___prepare__
- import random
- #setup sampler
- sound = pool['click.wav']
- click_sound = sampler(sound, duration=0, volume=1)
- #40 words in word loop
- population = list(range(40))
- #select 5 random positions
- click_indices = random.sample(population, k=5)
- __end__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement