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()