# initialize LocallySparseNoise object lsn = stim.LocallySparseNoise(monitor=mon, indicator=ind, pregap_dur=pregap_dur, postgap_dur=postgap_dur, coordinate=coordinate, background=background, subregion=lsn_subregion, grid_space=lsn_grid_space, sign=lsn_sign, probe_size=lsn_probe_size, probe_orientation=lsn_probe_orientation, probe_frame_num=lsn_probe_frame_num, iteration=lsn_iteration, is_include_edge=lsn_is_include_edge, min_distance=lsn_min_distance) # initialize DisplaySequence object ds = DisplaySequence(log_dir=ds_log_dir, backupdir=ds_backupdir, identifier=ds_identifier, display_iter=ds_display_iter, mouse_id=ds_mouse_id, user_id=ds_user_id, psychopy_mon=ds_psychopy_mon, is_by_index=ds_is_by_index, is_interpolate=ds_is_interpolate, is_triggered=ds_is_triggered, trigger_event=ds_trigger_event, trigger_NI_dev=ds_trigger_NI_dev, trigger_NI_port=ds_trigger_NI_port, trigger_NI_line=ds_trigger_NI_line, is_sync_pulse=ds_is_sync_pulse, sync_pulse_NI_dev=ds_sync_pulse_NI_dev, sync_pulse_NI_port=ds_sync_pulse_NI_port, sync_pulse_NI_line=ds_sync_pulse_NI_line, display_screen=ds_display_screen, initial_background_color=ds_initial_background_color) # display # =============================== display ========================================= ds.set_stim(lsn) ds.trigger_display() plt.show() # =================================================================================
import retinotopic_mapping.StimulusRoutines as stim from retinotopic_mapping.DisplayStimulus import DisplaySequence from retinotopic_mapping.MonitorSetup import Monitor, Indicator mon = Monitor(resolution=(1200, 1920), dis=15., mon_width_cm=52., mon_height_cm=32.) ind = Indicator(mon) uc = stim.UniformContrast(mon, ind, duration=10., color=-1.) ss = stim.StimulusSeparator(mon, ind) cs = stim.CombinedStimuli(mon, ind) cs.set_stimuli([ss, uc, ss]) ds = DisplaySequence(log_dir='C:/data') ds.set_stim(cs) ds.trigger_display()
# -*- coding: utf-8 -*- """ the minimum script to run 10 seconds of black screen """ import matplotlib.pyplot as plt import retinotopic_mapping.StimulusRoutines as stim from retinotopic_mapping.MonitorSetup import Monitor, Indicator from retinotopic_mapping.DisplayStimulus import DisplaySequence # Initialize Monitor object mon = Monitor(resolution=(1200, 1920), dis=15., mon_width_cm=52., mon_height_cm=32.) # Initialize Inicator object ind = Indicator(mon) # Initialize DisplaySequence object ds = DisplaySequence(log_dir='C:/data') # Initialize UniformContrast object uc = stim.UniformContrast(monitor=mon, indicator=ind, duration=10., color=-1.) # set uniform contrast stimulus into the DisplaySequence object ds.set_stim(uc) # start display ds.trigger_display() # plot distribution of frame duration plt.show()
import matplotlib.pyplot as plt import retinotopic_mapping.StimulusRoutines as stim from retinotopic_mapping.MonitorSetup import Monitor, Indicator from retinotopic_mapping.DisplayStimulus import DisplaySequence # Initialize Monitor object mon = Monitor(resolution=(1200, 1920), dis=15., mon_width_cm=52., mon_height_cm=32.) # Initialize Inicator object ind = Indicator(mon) # Initialize DisplaySequence object ds = DisplaySequence(log_dir='C:/data') # Initialize UniformContrast object sl = stim.SinusoidalLuminance(monitor=mon, indicator=ind, pregap_dur=2., midgap_dur=1., postgap_dur=3., max_level=0.5, frequency=0.5, cycle_num=5, start_phase=0.) # set uniform contrast stimulus into the DisplaySequence object ds.set_stim(sl) # start display ds.trigger_display() # plot distribution of frame duration plt.show()
# -*- coding: utf-8 -*- """ the minimum script to run 10 seconds of black screen """ import matplotlib.pyplot as plt import retinotopic_mapping.StimulusRoutines as stim from retinotopic_mapping.MonitorSetup import Monitor, Indicator from retinotopic_mapping.DisplayStimulus import DisplaySequence # Initialize Monitor object mon = Monitor(resolution=(1200, 1920), dis=15., mon_width_cm=52., mon_height_cm=32.) ind = Indicator(mon) ds = DisplaySequence(log_dir='C:/data', is_by_index=True) dgc = stim.DriftingGratingCircle(monitor=mon, indicator=ind, background=0., coordinate='degree', center=(10., 90.), sf_list=(0.02,), tf_list=(4.0, 2.0), dire_list=(45.,), con_list=(0.8,), radius_list=(20.,), block_dur=2., midgap_dur=1., iteration=3, pregap_dur=2., postgap_dur=3., is_blank_block=True) ds.set_stim(dgc) ds.trigger_display() plt.show()
import retinotopic_mapping.StimulusRoutines as stim from retinotopic_mapping.MonitorSetup import Monitor, Indicator from retinotopic_mapping.DisplayStimulus import DisplaySequence # This script is meant to be used to test the synchronization between the stim. pc and the microscope, by flashing gray images at the sensor mon = Monitor(resolution=(1024, 1280), dis=20., mon_width_cm=33.28, mon_height_cm=26.624, refresh_rate=60.0) # creating a monitor object to display the indicator on (since we don' use it) mon_bin = Monitor(resolution=(0,0), dis=15., mon_width_cm=52., mon_height_cm=32.) ind = Indicator(mon_bin) uc = stim.UniformContrast(mon, ind, duration=1, color=0) repeated_stim = stim.CombinedStimuli(mon, ind, background=-1, pregap_dur=1, postgap_dur=0) repeated_stim.set_stimuli([uc]*10) # set the number of iterations here ds = DisplaySequence(log_dir="C:/data", is_by_index=True, display_screen=1, is_sync_pulse_LJ=True) ds.set_stim(repeated_stim) ds.trigger_display(fullscr=False)
mon_width_cm=52., mon_height_cm=32.) mon.plot_map() # Hiding indicator on a "throwaway" monitor mon_temp = Monitor(resolution=(8, 8), dis=15., mon_width_cm=10., mon_height_cm=10.) ind = Indicator(mon_temp) ds = DisplaySequence(log_dir='C:/data', is_by_index=False, is_save_sequence=True) fc = stim.FlashingCircle(monitor=mon, indicator=ind, coordinate='degree', center=(0., 60.), radius=10., is_smooth_edge=False, smooth_width_ratio=0.2, smooth_func=stim.blur_cos, color=1., flash_frame_num=60, pregap_dur=2., postgap_dur=3., background=-1., midgap_dur=1., iteration=1) ds.set_stim(fc) ds.trigger_display() plt.show()
# ================ Initialize the DisplaySequence object ========================== ds = DisplaySequence(log_dir=ds_log_dir, backupdir=ds_backupdir, identifier=ds_identifier, display_iter=ds_display_iter, mouse_id=ds_mouse_id, user_id=ds_user_id, psychopy_mon=ds_psychopy_mon, is_by_index=ds_is_by_index, is_interpolate=ds_is_interpolate, is_triggered=ds_is_triggered, trigger_event=ds_trigger_event, trigger_NI_dev=ds_trigger_NI_dev, trigger_NI_port=ds_trigger_NI_port, trigger_NI_line=ds_trigger_NI_line, is_sync_pulse=ds_is_sync_pulse, sync_pulse_NI_dev=ds_sync_pulse_NI_dev, sync_pulse_NI_port=ds_sync_pulse_NI_port, sync_pulse_NI_line=ds_sync_pulse_NI_line, display_screen=ds_display_screen, is_save_sequence=ds_is_save_sequence, initial_background_color=ds_initial_background_color, color_weights=ds_color_weights) # ================================================================================= # =============================== display ========================================= ds.set_stim(ks) ds.trigger_display() plt.show() # =================================================================================
mon_width_cm=2, mon_height_cm=1.5, refresh_rate=60.0) # mon.plot_map() # plt.show() # creating a monitor object to display the indicator on (since we don' use it) mon_bin = Monitor(resolution=(0, 0), dis=15., mon_width_cm=52., mon_height_cm=32.) ind = Indicator(mon_bin, width_cm=3, height_cm=3, is_sync=True, freq=1) sparse_noise = stim.SparseNoise(mon, ind, grid_space=(0.5, 0.5), probe_size=(0.5, 0.5), probe_frame_num=6, coordinate='linear', midgap_dur=0.5, iteration=5) ds = DisplaySequence(log_dir="data", is_by_index=True, display_screen=1, is_sync_pulse_LJ=False) ds.set_stim(sparse_noise) ds.trigger_display(fullscr=False)
flash_frame_num=30, pregap_dur=2., postgap_dur=3., background=0., is_smooth_edge=True, smooth_width_ratio=0.2, smooth_func=stim.blur_cos) ds = DisplaySequence(log_dir=r'C:\data', backupdir=None, is_triggered=False, is_sync_pulse=False, is_by_index=False, display_iter=2, display_screen=0, is_interpolate=False) ds.set_stim(flashing_circle) ds.trigger_display() #============================================================================== #======================== Sparse Noise Stimulus =============================== # sparse_noise = stim.SparseNoise(mon, ind, subregion=(-20.,20.,10.,150.), grid_space=(4., 4.), # background=0., sign='ON-OFF', pregap_dur=0., postgap_dur=0., # coordinate='degree', probe_size=(4., 4.), probe_orientation=0., # probe_frame_num=6, iteration=2, is_include_edge = True) # ds = DisplaySequence(log_dir=r'C:\data', backupdir=None, is_triggered=False, # is_sync_pulse=False, display_iter=2, display_screen=1, # is_by_index=True) # ds.set_stim(sparse_noise) # ds.trigger_display() #==============================================================================
# -*- coding: utf-8 -*- """ the minimum script to run 10 seconds of black screen """ import matplotlib.pyplot as plt import retinotopic_mapping.StimulusRoutines as stim from retinotopic_mapping.MonitorSetup import Monitor, Indicator from retinotopic_mapping.DisplayStimulus import DisplaySequence # Initialize Monitor object mon = Monitor(resolution=(768, 1360), dis=15., mon_width_cm=52., mon_height_cm=32.) ind = Indicator(mon) ds = DisplaySequence(log_dir='C:/data', is_by_index=True, is_save_sequence=True) dgc = stim.DriftingGratingCircle(monitor=mon, indicator=ind, background=0., coordinate='degree', center=(10., 90.), sf_list=(0.02,), tf_list=(4.0, 2.0), dire_list=(45.,), con_list=(0.8,), radius_list=(20.,), block_dur=2., midgap_dur=1., iteration=3, pregap_dur=2., postgap_dur=2., is_blank_block=True) ds.set_stim(dgc) ds.trigger_display() plt.show()