Hi Kit,
I'd like to save the frame times during my code.
it might be redundant to code inside visionegg, but you can use a function controller to collect the frame timestamps. See the attached code example which prints the timestamps of all frames presented.
Best, Jens.
#!/usr/bin/env python """Sinusoidal grating calculated in realtime.""" ############################ # Import various modules # ############################ import VisionEgg VisionEgg.start_default_logging(); VisionEgg.watch_exceptions() from VisionEgg.Core import * from VisionEgg.FlowControl import Presentation from VisionEgg.Gratings import * ##################################### # Initialize OpenGL window/screen # ##################################### screen = get_default_screen() ###################################### # Create sinusoidal grating object # ###################################### stimulus = SinGrating2D(position = ( screen.size[0]/2.0, screen.size[1]/2.0 ), anchor = 'center', size = ( 300.0 , 300.0 ), spatial_freq = 10.0 / screen.size[0], # units of cycles/pixel temporal_freq_hz = 1.0, orientation = 45.0 ) ############################################################### # Create viewport - intermediary between stimuli and screen # ############################################################### viewport = Viewport( screen=screen, stimuli=[stimulus] ) ##################### # Record timestamps # ##################### class ts_recorder(object): def __init__(self): # initialize the timestamp list self.ts=[] def record(self, t): # append current time value to the list self.ts.append(t) def show(self): # traverse list and print timestamps for n in range(len(self.ts)): print 'Frame ', n, ': ', self.ts[n], 's' # create an object of that class rec=ts_recorder() ######################################## # Create presentation object and go! # ######################################## p = Presentation(go_duration=(5.0,'seconds'),viewports=[viewport]) # register the record method bound to the "rec" p.add_controller(None, None, FunctionController(during_go_func=rec.record)) p.go() ############################ # Display frame timestamps # ############################ rec.show()