instruct_text = [
    "Welcome to the experiment.\nToday you'll see a lot of pictures.",
    "If the picture shows something a Nochmani would eat,\npress the %s button to EAT it.\n\nIf the picture shows something a Nochmani would not eat,\npress the %s button to NOT EAT it."
    % (APPROACH_SIDE_FIRST, WITHDRAW_SIDE_FIRST),
    "Please press the buttons as quickly as you can.",
    "Ready to start?",
]
instruct_text = [s + "\n\n\nPress SPACE to continue." for s in instruct_text]
instructions = [InstructTrial(s) for s in instruct_text]
switch_text = (
    "That was the first half of the experiment.\n For the next part, you'll do the same thing, but switch hands.\nNow, press the %s button for something a Nochmani would EAT,\nand the %s button for something a Nochmani would NOT EAT.\n\nPlease let the experimenter know when you're ready to go on."
    % (WITHDRAW_SIDE_FIRST, APPROACH_SIDE_FIRST)
)
switch_inst = InstructTrial(switch_text)
# put all the trials together w/ instructions in the right place
all_trials = instructions + trials[: len(trials) / 2] + [switch_inst] + trials[len(trials) / 2 :]

###############
# Run the exp #
###############
exp_stimuli = [rest_screen, fixation, blank, switch_inst.stim] + [s.stim for s in instructions] + stim_list
vision_egg.set_stimuli(exp_stimuli)
# stim_control = StimController(all_trials,
# vision_egg, pause_event = Event(rest_screen, 0, 0))
stim_control = StimController(all_trials, vision_egg)

stim_control.run_trials(len(all_trials))
stim_control.writelog(stim_control.getOutputFilename(SUBJECT, "MotivHand"))

print "\n\n\n\n\n\t\tThanks for participating!\n\n\n\n\n"
#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
Beispiel #3
0
    which take args: label (how the response is named in the csv)
        limit -- if you give it key values (e.g. ("l","m") accepts only those)
        buttonbox -- a parallel.respbox.RespBox instance
            this gives back the integer 2^x, x indexes the finger
            dont give it a limit if you do this"""

def event_list(stim_num, fix_type):
    return [Event(fixation[fix_type], log={'fix_type': fix_type}, start=0, duration=2.0),
            Event(trial_stims[stim_num], start=2, duration=.5,
                  log={'stim_num': stim_num},
                  # Need some way for the Response to dynamically log the
                  # x.position and update it
                  response=Response(label='press',limit=('z','/')) ),
            Event(None, start=2, duration=2.5) ]

# Trials are initialized with an "events" arg which is a list of Event instances
# trial_stims * 4 gives us 20 Trials
stim_order = range(len(trial_stims)) * 4
random.shuffle(stim_order)
fix_order = fixation.keys() * 10
random.shuffle(fix_order)
trials = [Trial(event_list(stim_num, fix_type))
            for stim_num, fix_type in zip(stim_order, fix_order)]


# pause_event begins each block after a SPACE press.
# 'rest' is the name of my text stim
stim_control = StimController(trials, vision_egg, pause_event=Event(rest,0,0))

stim_control.run_trials()
stim_control.writelog('example.log')
Beispiel #4
0
    ]
    instruct_text2 = [
        s + "\n\nPress SPACE to continue." for s in instruct_text2
    ]
    instructions2 = [InstructTrial(s) for s in instruct_text2]

    all_trials = instructions + treatment_trials + instructions2 + trials

    exp_stimuli = [rest_screen, fixation, mask, blank] + \
        [s.stim for s in instructions] + [s.stim for s in instructions2] + flat_list

else:
    quit('Time must be 1, 2, 3, 4')

###############
# Run the exp #
###############
vision_egg.set_stimuli(exp_stimuli)
stim_control = StimController(all_trials, vision_egg)

stim_control.run_trials(len(all_trials))
if time_point == 1:
    stim_control.writelog(
        stim_control.getOutputFilename('results/T1_' + str(SUBJECT), 'DP_LDT'))
else:
    stim_control.writelog(
        stim_control.getOutputFilename(
            'results/T' + str(time_point) + '_' + str(SUBJECT), 'DP_LDT'))

print '\n\n\n\n\n\t\tThis section is complete. Please inform the experimenter.\n\n\n\n\n'