Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from psychopy import visual
- from psychopy import core
- from psychopy import event
- win = visual.Window(color='#000000',
- fullscr=True,
- allowGUI=False,
- winType='pyglet',
- units='deg')
- ####### BEGINNING OF THE EXPERIMENT ###########
- from pypixxlib.propixx import PROPixxCTRL
- pxctrl = PROPixxCTRL()
- px_out = pxctrl.dout
- def trigger(bit, t):
- """
- bit - number between 0 and 255
- t - duration of trigger
- triggers ProPixxControl
- returns trigger time, start and end of the function
- """
- start = core.getTime() # start of the function
- wait = core.StaticPeriod()
- px_out.setBitValue(value=bit, bit_mask=0xFF)
- pxctrl.updateRegisterCache()
- wait.start(t)
- trig = core.getTime()
- wait.complete()
- px_out.setBitValue(value=0, bit_mask=0xFF)
- pxctrl.updateRegisterCache()
- end = core.getTime() # end of the function
- return (trig, start, end) # if start and end time removed 'return trig'
- ###############################################
- # bt = run['condition_nr'][row] + 1 # zero is reserved for zeroing the channels
- # stim1_tr, stim1_st, stim1_end = trigger(bt, 0.005)
- ########### TRIGGER IN EXP ####################
- trigger(0, 0.005) # zero out all the channels
- while True:
- if event.getKeys(keyList=['space']):
- trigger_time, func_start, func_end = trigger(1, 0.005) # TRIGGER, save somewhere the data from those variables
- if event.getKeys(keyList=['q']):
- break
- trigger(0, 0.005) # zero out all the channels
- ###############################################
- win.close()
- core.quit()
Add Comment
Please, Sign In to add comment