Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Generated by OpenSesame 0.27.4 (Frisky Freud)
- # Fri Oct 18 20:39:38 2013 (nt)
- # <http://www.cogsci.nl/opensesame>
- set foreground "#ffffff"
- set subject_parity "even"
- set font_size "60"
- set description "Default description"
- set title "bk_new_pm_exp"
- set transparent_variables "no"
- set font_bold "yes"
- set coordinates "relative"
- set height "1080"
- set mouse_backend "xpyriment"
- set width "1920"
- set compensation "0"
- set sampler_backend "legacy"
- set font_italic "no"
- set background "#000000"
- set subject_nr "0"
- set keyboard_backend "legacy"
- set start "experiment"
- set font_family "sans"
- set synth_backend "legacy"
- set canvas_backend "xpyriment"
- define loop s1_block_loop
- set repeat "1"
- set description "Repeatedly runs another item"
- set skip "0"
- set item "s1_trial_sequence"
- set column_order "cue"
- set cycles "24"
- set order "sequential"
- setcycle 0 cue ""
- setcycle 1 cue ""
- setcycle 2 cue ""
- setcycle 3 cue ""
- setcycle 4 cue ""
- setcycle 5 cue ""
- setcycle 6 cue ""
- setcycle 7 cue ""
- setcycle 8 cue ""
- setcycle 9 cue ""
- setcycle 10 cue ""
- setcycle 11 cue ""
- setcycle 12 cue ""
- setcycle 13 cue ""
- setcycle 14 cue ""
- setcycle 15 cue ""
- setcycle 16 cue ""
- setcycle 17 cue ""
- setcycle 18 cue ""
- setcycle 19 cue ""
- setcycle 20 cue ""
- setcycle 21 cue ""
- setcycle 22 cue ""
- setcycle 23 cue "Mouse"
- run s1_trial_sequence
- define sequence sequence
- run question_word "always"
- run blank "always"
- define parallel _parallel
- run s_keyboard_response "always"
- run _sequence "always"
- define sequence _sequence
- run question_word "always"
- run blank "always"
- define sequence p_trial_sequence
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run p_ongoing_script "always"
- run p_response_script "always"
- run fixation_dot "always"
- run question "always"
- run parallel "always"
- run logger "always"
- define sequence s1_trial_sequence
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run s1_ongoing_script "always"
- run s1_response_script "always"
- run fixation_dot "always"
- run question "always"
- run _parallel "always"
- run logger "always"
- define sequence s1_sequence
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run s1_ongoing_list "always"
- run s1_block_loop "always"
- define sketchpad blank
- set duration "1400"
- set description "Displays stimuli"
- define inline_script p_response_script
- set _run ""
- ___prepare__
- # For the ongoing task.
- # Set the variable 'correct_response':
- exp.set('correct_response', None)
- # Define correct/incorrect responses:
- correct = 'l'
- incorrect = 'a'
- # State what constitutes a correct response for each question:
- if stim_word in one:
- exp.set('correct_response', correct)
- if stim_word in n_one:
- exp.set('correct_response', incorrect)
- if stim_word in ee:
- exp.set('correct_response', correct)
- if stim_word in n_ee:
- exp.set('correct_response', incorrect)
- if stim_word in wiw:
- exp.set('correct_response', correct)
- if stim_word in n_wiw:
- exp.set('correct_response', incorrect)
- # Determine correct ongoing keyboard response:
- if self.get('correct_response') == 'l':
- correct_keyboard_response_1 = 'l'
- else:
- correct_keyboard_response_1 = 'a'
- # Set the correct response for the ongoing task and PM cue by giving the variables
- # 'correct_ongoing_response' and 'correct_cue_response' values:
- exp.set("correct_ongoing_response", correct_keyboard_response_1)
- __end__
- set description "Executes Python code"
- define inline_script s1_ongoing_script
- set _run ""
- ___prepare__
- # Import the module 'numpy':
- import numpy as np
- # Set variable 'question' for use in the GUI (e.g. can be accessed in a sketchpad):
- exp.set('question', None)
- # To avoid that some words are shown twice, and others never, we draw the
- # words without replacement by using the built-in Python function pop():
- # For more info, see: http://docs.python.org/2/tutorial/datastructures.html
- stim_word = s1_twl.pop()
- # Define task questions:
- q1 = "1 Syllable?"
- q2 = "Long 'EE' sound?"
- q3 = "Word in word?"
- # Define word lists relevant to each question:
- one = ["Dad", "Found", "Deep", "Set"] # 'Correct' words...
- n_one = ["Lever", "Police", "Competed", "Idea"] # 'Non-correct' words...
- ee = ["Envy", "Key", "Misery", "Minister"]
- n_ee = ["Extra", "Major", "North"]
- wiw = ["Feel", "Start", "Peace", "President"]
- n_wiw = ["Bank", "Tea", "Ear", "Heaven"]
- # Now connect each question with the random word produced:
- if stim_word in one:
- exp.set('question', q1)
- if stim_word in n_one:
- exp.set('question', q1)
- if stim_word in ee:
- exp.set('question', q2)
- if stim_word in n_ee:
- exp.set('question', q2)
- if stim_word in wiw:
- exp.set('question', q3)
- if stim_word in n_wiw:
- exp.set('question', q3)
- # Connect the session cue with the correct question:
- if stim_word == "Mouse":
- exp.set('question', q2)
- # Set the variable 'stim_word' to be available in the GUI (e.g. can be accessed in a sketchpad):
- exp.set('stim_word', stim_word)
- __end__
- set description "Executes Python code"
- define loop s1
- set repeat "1"
- set description "Repeatedly runs another item"
- set item "s1_sequence"
- set column_order ""
- set cycles "1"
- set order "random"
- run s1_sequence
- define sketchpad question
- set duration "1000"
- set description "Displays stimuli"
- draw textline 0 -128 "[question]" center=1 color=#ffffff font_family="mono" font_size=60 font_italic=no font_bold=yes show_if="always" html="yes"
- define text_display experiment_instructions
- set foreground "#ffffff"
- set font_size "20"
- set description "Presents a display consisting of text"
- set maxchar "200"
- set align "center"
- __content__
- You will see a series of words one at a time
- For each word you will be asked to respond to a question
- Press the 'L' key if your answer is YES
- Press the 'A' key if your answer is NO
- As you look at the screen a an asterisk will appear in the centre
- This will be replaced by the cue for each question
- A different word will appear below the cue each time
- Press the appropriate key to record your answer
- There will be a blank screen before the next sequence begins, starting with *
- Please press the space bar when you are ready to begin
- __end__
- set background "#000000"
- set duration "keypress"
- set font_family "sans"
- define sequence experiment
- run experiment_instructions "always"
- run practice "always"
- run text_display "always"
- run s1 "always"
- define sketchpad fixation_dot
- set duration "1400"
- set description "Displays stimuli"
- draw textline 0 -128 "*" center=1 color=#ffffff font_family="sans" font_size=60 font_italic=no font_bold=yes show_if="always" html="yes"
- define logger logger
- set ignore_missing "yes"
- set description "Logs experimental data"
- set auto_log "no"
- set use_quotes "yes"
- log "cue"
- log "subject_nr"
- log "correct_1"
- log "keyboard_response_1"
- log "keyboard_response_time_1"
- log "question"
- log "stim_word"
- log "correct_ongoing_response"
- log "correct_cue_response"
- log "pm_correct_response"
- log "correct_2"
- log "keyboard_response_2"
- log "keyboard_response_time_2"
- define inline_script s_keyboard_response
- ___run__
- from openexp.keyboard import keyboard
- # The keypress timeout
- timeout = 2600
- # Poll for responses. First, 'keyboard_response_1' waits for an 'A' or an 'L'.
- # Second, 'keyboard_response_2' waits for a '1':
- exp.set('keyboard_response_1', None)
- exp.set('keyboard_response_time_1', None)
- keylist_1 = ['a', 'l']
- exp.set('keyboard_response_2', None)
- exp.set('keyboard_response_time_2', None)
- keylist_2 = ['1']
- # Create a keyboard object that doesn't block the experiment, so we can use it to poll for
- # keypresses continuously:
- my_keyboard = keyboard(exp, timeout=0)
- # Loop until we timeout:
- start_time = self.time()
- while self.time() - timeout < start_time:
- key, key_time = my_keyboard.get_key()
- # If a key from keylist 1 is pressed, set keyboard_response_1 and keyboard_response_time_1.
- # Also, set key_list_1 to [], so that we do not capture multiple keypresses from this list:
- if key in keylist_1:
- exp.set('keyboard_response_1', key)
- exp.set('keyboard_response_time_1', key_time - start_time)
- keylist_1 = []
- # If a key from keylist 2 is pressed, set keyboard_response_2 and keyboard_response_time_2.
- # Also, set key_list_2 to [], so that we do not capture multiple keypresses from this list:
- if key in keylist_2:
- exp.set('keyboard_response_2', key)
- exp.set('keyboard_response_time_2', key_time - start_time)
- keylist_2 = []
- # Create a variable to check the first key response against the expected response:
- if self.get('keyboard_response_1') == self.get('correct_ongoing_response'):
- correct_1 = '1'
- else:
- correct_1 = '0'
- exp.set("correct_1", correct_1)
- # Create a variable to check the second key response against the expected response:
- if self.get('keyboard_response_2') == self.get('correct_cue_response'):
- correct_2 = '1'
- else:
- correct_2 = '0'
- exp.set("correct_2", correct_2)
- __end__
- set _prepare ""
- set description "Executes Python code"
- define loop p_block_loop
- set repeat "1"
- set description "Repeatedly runs another item"
- set skip "0"
- set item "p_trial_sequence"
- set column_order ""
- set cycles "12"
- set order "sequential"
- run p_trial_sequence
- define inline_script p_keyboard_response
- ___run__
- from openexp.keyboard import keyboard
- # The keypress timeout
- timeout = 2600
- # Poll for responses. 'keyboard_response_1' waits for an 'A' or an 'L':
- exp.set('keyboard_response_1', None)
- exp.set('keyboard_response_time_1', None)
- keylist_1 = ['a', 'l']
- # Create a keyboard object that doesn't block the experiment, so we can use it to poll for
- # keypresses continuously:
- my_keyboard = keyboard(exp, timeout=0)
- # Loop until we timeout:
- start_time = self.time()
- while self.time() - timeout < start_time:
- key, key_time = my_keyboard.get_key()
- # If a key from keylist 1 is pressed, set keyboard_response_1 and keyboard_response_time_1.
- # Also, set key_list_1 to [], so that we do not capture multiple keypresses from this list:
- if key in keylist_1:
- exp.set('keyboard_response_1', key)
- exp.set('keyboard_response_time_1', key_time - start_time)
- keylist_1 = []
- # Create a variable to check the key response against the expected response:
- if self.get('keyboard_response_1') == self.get('correct_ongoing_response'):
- correct_1 = '1'
- else:
- correct_1 = '0'
- exp.set("correct_1", correct_1)
- __end__
- set _prepare ""
- set description "Executes Python code"
- define inline_script s1_ongoing_list
- set _run ""
- ___prepare__
- # Import the module 'Random':
- import random as rdm
- # Define trial word list:
- twl = ["Dad", "Found", "Deep", "Set", "Lever", "Police", "Competed", "Idea", \
- "Extra", "Envy", "Key", "Misery", "Major", "North", "Minister", \
- "Feel", "Start", "Peace", "President", "Bank", "Tea", "Ear", "Heaven"]
- # Shuffle list order.
- rdm.shuffle(twl)
- # Define PM cue word:
- cue = ["Mouse"]
- # Add twl list to cue:
- s1_twl = cue + twl
- # Note: it is VERY important that the cue be first in the expression 'cue + twl'.
- # 'twl + cue' will make the cue appear FIRST in the experimental session!
- # Make list 's1_twl' global for future use:
- global s1_twl
- __end__
- set description "Executes Python code"
- define loop practice
- set repeat "1"
- set description "Repeatedly runs another item"
- set skip "0"
- set item "p_sequence"
- set column_order ""
- set cycles "1"
- set order "sequential"
- run p_sequence
- define inline_script s1_response_script
- set _run ""
- ___prepare__
- # For the ongoing task.
- # Set the variable 'correct_response':
- exp.set('correct_response', None)
- # Define correct/incorrect responses:
- correct = 'l'
- incorrect = 'a'
- # State what constitutes a correct response for each question:
- if stim_word in one:
- exp.set('correct_response', correct)
- if stim_word in n_one:
- exp.set('correct_response', incorrect)
- if stim_word in ee:
- exp.set('correct_response', correct)
- if stim_word in n_ee:
- exp.set('correct_response', incorrect)
- if stim_word in wiw:
- exp.set('correct_response', correct)
- if stim_word in n_wiw:
- exp.set('correct_response', incorrect)
- # Determine correct ongoing keyboard response:
- if self.get('correct_response') == 'l':
- correct_keyboard_response_1 = 'l'
- else:
- correct_keyboard_response_1 = 'a'
- # Set the correct response for the ongoing task and PM cue by giving the variables
- # 'correct_ongoing_response' and 'correct_cue_response' values:
- exp.set("correct_ongoing_response", correct_keyboard_response_1)
- # For the PM cue:
- # Set the variable 'pm_correct_response':
- exp.set('pm_correct_response', None)
- # Define PM correct response:
- pm_cue = '1'
- # State what constitutes a correct cue response:
- if stim_word == "Mouse":
- exp.set('pm_correct_response', pm_cue)
- # Determine correct ongoing keyboard response:
- if self.get('pm_correct_response') == '1':
- correct_keyboard_response_2 = '1'
- else:
- correct_keyboard_response_2 = ''
- # Set the correct response for the ongoing task and PM cue by giving the variables
- # 'correct_ongoing_response' and 'correct_cue_response' values:
- exp.set("correct_cue_response", correct_keyboard_response_2)
- __end__
- set description "Executes Python code"
- define inline_script p_ongoing_script
- set _run ""
- ___prepare__
- # Import the module 'numpy':
- import numpy as np
- # Set variable 'question' for use in the GUI (e.g. can be accessed in a sketchpad):
- exp.set('question', None)
- # To avoid that some words are shown twice, and others never, we draw the
- # words without replacement by using the built-in Python function pop():
- # For more info, see: http://docs.python.org/2/tutorial/datastructures.html
- stim_word = p_twl.pop()
- # Define task questions:
- q1 = "1 Syllable?"
- q2 = "Long 'EE' sound?"
- q3 = "Word in word?"
- # Define word lists relevant to each question:
- one = ["Hard", "Form"] # 'Correct' words...
- n_one = ["Money", "Comedy"] # 'Incorrect' words...
- ee = ["Reef", "Achieve"]
- n_ee = ["Island", "Papers"]
- wiw = ["Clear", "Afford"]
- n_wiw = ["She", "Heavy"]
- # Now connect each question with the random word produced:
- if stim_word in one:
- exp.set('question', q1)
- if stim_word in n_one:
- exp.set('question', q1)
- if stim_word in ee:
- exp.set('question', q2)
- if stim_word in n_ee:
- exp.set('question', q2)
- if stim_word in wiw:
- exp.set('question', q3)
- if stim_word in n_wiw:
- exp.set('question', q3)
- # Set the variable 'stim_word' to be available in the GUI (e.g. can be accessed in a sketchpad):
- exp.set('stim_word', stim_word)
- __end__
- set description "Executes Python code"
- define sequence p_sequence
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run p_ongoing_list "always"
- run p_block_loop "always"
- define parallel parallel
- run p_keyboard_response "always"
- run sequence "always"
- define text_display text_display
- set foreground "#ffffff"
- set font_size "60"
- set description "Presents a display consisting of text"
- set maxchar "50"
- set align "center"
- __content__
- s1 start
- press a key
- __end__
- set background "#000000"
- set duration "keypress"
- set font_family "sans"
- define inline_script p_ongoing_list
- set _run ""
- ___prepare__
- # Import the module 'Random':
- import random as rdm
- # Define trial word list:
- p_twl = ["Hard", "Form", "Money", "Comedy", "Reef", "Achieve",\
- "Island", "Papers", "Clear", "Afford", "She", "Heavy"]
- # Shuffle list order.
- rdm.shuffle(p_twl)
- # Make list global for future use:
- global p_twl
- __end__
- set description "Executes Python code"
- define sketchpad question_word
- set duration "1200"
- set description "Displays stimuli"
- draw textline 0 -128 "[question]" center=1 color=#ffffff font_family="mono" font_size=60 font_italic=no font_bold=yes show_if="always" html="yes"
- draw textline 0 -32 "[stim_word]" center=1 color=#ffff00 font_family="mono" font_size=60 font_italic=no font_bold=yes show_if="always" html="yes"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement