import sys # to get file system encoding import numpy as np # working with arrays and numbers import time from psychopy import visual, core, gui, monitors, event, logging from datetime import datetime import PyDAQmx as daq # Self written packages from helper import * import psyTools as pt import nidaqTools as daqT #%% Initialize # Parameters of projection for stimulus creation use_nidaq = 1 (proj_params, use_nidaq) = pt.setup_params() # An output structure for aligning with acquired imaging frames and storing stimulus # meta data now = datetime.now() dt_string = now.strftime("%Y%m%d_%H%M%S") meta = {"nidaq": use_nidaq, "proj_params": proj_params, "date_time": dt_string} outputObj = OutputInfo(meta=meta) #%% Reading stimulus information & generating epochs # Ask user where the stim input file is located stim_fname = gui.fileOpenDlg(os.getcwd())[0] # Pre-organizing the routine and epochs routine = PyStimRoutine(stim_fname) print('Stimulus routine with {eN} epochs is generated...'.format(\ eN = routine.total_epoch_n))
from helper import * import psyTools as pt # import nidaqTools as daqT #%% Initialize # Reading stimulus information & generating epochs # Ask user where the stim input file is located stim_fname = gui.fileOpenDlg(os.getcwd())[0] # Pre-organizing the routine and epochs routine = PyStimRoutine(stim_fname) print('Stimulus routine with {eN} epochs is generated...'.format(\ eN = routine.total_epoch_n)) #%% We need a monitor and a window to present the stimulus # Parameters of projection for stimulus creation (proj_params, use_nidaq) = pt.setup_params(stim_fname) # Overwrite the current monitor parameters mon = monitors.Monitor(proj_params["monitorName"]) win = visual.Window(size=mon.getSizePix(), viewScale=proj_params['viewScale'], pos=[proj_params['posX'], proj_params['posY']], useFBO=True, screen=proj_params['onDLP'], allowGUI=False, color=[-1, -1, -1], viewOri=0.0, fullscr=False, monitor=mon) #Detecting dropped frames if any