Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- API: 2.1
- OpenSesame: 3.2.6
- Platform: nt
- ---
- set width 1024
- set uniform_coordinates yes
- set title "New experiment"
- set subject_parity even
- set subject_nr 0
- set start experiment
- set sound_sample_size -16
- set sound_freq 48000
- set sound_channels 2
- set sound_buf_size 1024
- set round_decimals 2
- set height 768
- set fullscreen no
- set form_clicks no
- set foreground white
- set font_underline no
- set font_size 18
- set font_italic no
- set font_family mono
- set font_bold no
- set experiment_path "F:\\Tamil Eng Exp"
- set disable_garbage_collection yes
- set description "Default description"
- set coordinates uniform
- set compensation 0
- set canvas_backend xpyriment
- set background black
- define keyboard_response click_keyb_resp
- set timeout 1000
- set flush yes
- set event_type keypress
- set duration keypress
- set description "Collects subjects' keyboard responses to clicks"
- set correct_response space
- set allowed_responses space
- 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_1 always
- run define_nonwords always
- run setup_random_clicks always
- run nonword_loop always
- define inline_script keyb_resp_script
- set description "recording reaction times to click sounds"
- ___run__
- from openexp.keyboard import keyboard
- my_keyboard = keyboard(self.experiment)
- start_time = clock.time()
- current_idx = var.get('count_nonword_sequence')
- 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__
- set _prepare ""
- define logger logger
- set description "Logs experimental data"
- set auto_log yes
- define sketchpad new_sketchpad_1
- 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="spacebar to start" 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 source_file ""
- set source table
- 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 continuous no
- set column_order wordorder
- set break_if_on_first yes
- 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 wordloop_coroutine always
- run keyb_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__
- define coroutines wordloop_coroutine
- set flush_keyboard yes
- set end_after_item ""
- set duration 1000
- set description "Run items simultaneously"
- run click_paradigm end=0 runif=always start=0
- run nonword end=0 runif=always start=0
- run click_keyb_resp end=1000 runif=always start=0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement