def run_camstim_debug(img_stack, timing_list, frame_length, runs):

    assert (img_stack.dtype) == 'uint8'
    assert len(img_stack.shape) == 3

    from camstim import SweepStim, MovieStim
    from camstim import Foraging
    from camstim import Window

    # Create display window, warped
    window = Window(fullscr=True, monitor='Gamma1.Luminance50', screen=0)

    tmp_dir = tempfile.mkdtemp()

    timing_list = sorted(timing_list, key=lambda x: x[0])
    movie_path = '%s.npy' % get_hash(img_stack)
    np.save(movie_path, img_stack)
    movie = MovieStim(movie_path=movie_path,
                      window=window,
                      frame_length=frame_length,
                      size=(opc.SCREEN_W, opc.SCREEN_H),
                      start_time=0.0,
                      stop_time=None,
                      flip_v=True,
                      runs=runs)

    movie.set_display_sequence(timing_list)
    stimuli = [movie]

    ss = SweepStim(window, stimuli=stimuli, pre_blank_sec=0, post_blank_sec=0)

    f = Foraging(window=window,
                 auto_update=False,
                 nidaq_tasks={
                     'digital_input': ss.di,
                     'digital_output': ss.do,
                 })  #share di and do with SS
    ss.add_item(f, "foraging")
    ss.run()
timing_list = [(ii * frame_length * number_of_frames,
                (ii + 1) * frame_length * number_of_frames)
               for ii in range(runs)]
curr_stimulus_list, tf = get_block(file_name,
                                   timing_list,
                                   frame_length,
                                   runs,
                                   t0=t0)
stimuli.append(curr_stimulus_list)
assert tf - t0 == expected_familiar_movie_duration

assert tf == expected_total_duration
params = {}
ss = SweepStim(
    window,
    stimuli=stimuli,
    pre_blank_sec=0,
    post_blank_sec=0,
    params=params,
)

f = Foraging(window=window,
             auto_update=False,
             params=params,
             nidaq_tasks={
                 'digital_input': ss.di,
                 'digital_output': ss.do,
             })  #share di and do with SS
ss.add_item(f, "foraging")
ss.run()
# kwargs
params = {
    #'syncsqrloc': (510,360),
    #'syncsqrsize': (50,140),
    'syncpulse': True,
    'syncpulseport': 1,
    #'syncpulselines': [1,2],
    'trigger_delay_sec': 5.0,
}

# create SweepStim instance
ss = SweepStim(
    window,
    stimuli=[size_by_contrast, behavior_flashes],
    pre_blank_sec=2,
    post_blank_sec=2,
    params=params,
)

# add in foraging so we can track wheel, potentially give rewards, etc
f = Foraging(window=window,
             auto_update=False,
             params=params,
             nidaq_tasks={
                 'digital_input': ss.di,
                 'digital_output': ss.do,
             })  #share di and do with SS
ss.add_item(f, "foraging")

# run it
예제 #4
0
#}

params = {
    'syncsqrloc': (510, 360),  #added by DM
    'syncsqrsize': (50, 140),  #added by DM
    'syncpulse': True,
    'syncpulseport': 1,
    'syncpulselines': [1, 2],  #[5, 6],  # frame, start/stop
    'trigger_delay_sec': 5.0,
}

# create SweepStim instance
ss = SweepStim(
    window,
    stimuli=[ms],
    pre_blank_sec=2,  #TODO: 60
    post_blank_sec=2,
    params=params,
)

# add in foraging so we can track wheel, potentially give rewards, etc
f = Foraging(window=window,
             auto_update=False,
             params=params,
             nidaq_tasks={
                 'digital_input': ss.di,
                 'digital_output': ss.do,
             })  #share di and do with SS
ss.add_item(f, "foraging")

# run it
    'syncsqrsize': (80, 140),
    'syncpulse': True,
    'syncpulseport': 1,
    'syncpulselines': [1, 2],  # frame, start/stop
    'trigger_delay_sec': 5.0,
}

# create SweepStim instance
ss = SweepStim(
    window,
    stimuli=[
        surround,
        annulus_1,
        annulus_2,
        annulus_3,
        annulus_4,
        annulus_5,
        center,
        lsn,
    ],
    pre_blank_sec=2,
    post_blank_sec=2,
    params=params,
)

# add in foraging so we can track wheel, potentially give rewards, etc
f = Foraging(
    window=window,
    auto_update=False,
    params=params,
    nidaq_tasks={
        'digital_input': ss.di,