Пример #1
0
#box = respbox.RespBox()

###########
# Stimuli #
###########
std_params = {'anchor': 'center', # for text display objects 
              'position': (xlim/2,ylim/2), 
              'on': False} 

rest = Text(text="Press space to begin.", **std_params)
fixation = Text(text="+", font_size=55, **std_params)
blank = Text(text="", **std_params)


trial_stims = [FaceStim(f) for f in (':-)', ':-(', ':-o')]
trials = [ExpTrial(s) for s in trial_stims]
random.shuffle(trials)
# A list of trials, using a super-pythonic list comprehension
# Trials are initialized with an 'events' arg which is a list of Event instances

vision_egg.set_stimuli([rest,fixation,blank]+trial_stims, trigger=K_SPACE)
# Give set_stimuli a list of stimulus objects as well as
# the pygame keypress which you want to begin the trials
stim_control = StimController(trials, vision_egg, pause_event=Event(rest,0,0))
# pause_event begins each block after a SPACE press.
# 'rest' is the name of my text stim

stim_control.run_trials(len(trials))
stim_control.writelog(stim_control.getOutputFilename(subject,'EXPERIMENT_TEMPLATE'))
# Change the experiment name and give it the subject at the beginning
Пример #2
0
if exp_type == 't':
    trial_stims = text_stims
elif exp_type == 'c':
    trial_stims = circ_stims
elif exp_type == 'both':
    trial_stims = circ_stims + text_stims

random.shuffle(trial_stims)
trials = [ExpTrial(s) for s in trial_stims]
final_trial = Trial([Event(rest, start = 0, duration = 3)], unlogged = True) 
trials += [final_trial] 

######################
# Run the experiment #
######################

vision_egg.set_stimuli([rest,fixation,blank]+trial_stims)
# Add the voice controller here ### 
vision_egg.presentation.add_controller(None, None, voice_controller) 
stim_control = StimController(trials, vision_egg)

stim_control.run_trials('all')
stim_control.writelog(stim_control.getOutputFilename(subject, 'VT_test'))

# Save the soundfiles during resting points or after the experiment is done.
# This will prevent the hardware access from messing with the stim/response
# timing. Remember to save the soundfiles!
voice_controller.write_soundfiles()