def send_event(key, label): if netstation is not None: netstation.send_event( key, label=label, timestamp=egi.ms_localtime(), )
ns.send_event('evt3', label="event3", description="this is a description of event 3") # the description, if exists, also goes to the log window -- # -- but, at least for our version of NetStation, # CAN NOT BE EXPORTED -- so it seems that it's main goal is pure amusement . # If one is curious, this also has variable length ( up to 256 characters, # if I am not mistaken ) time.sleep(0.1) # force the events to arrive in the "correct" order # but what we really want is attach the information about the current time moment, # or may be even some other moment back in time : ns.send_event('evt5', timestamp=egi.ms_localtime()) ns.send_event('evt6', description='back in time', timestamp=egi.ms_localtime() - 50) # 1. At the moment we have to use the egi.ms_localtime() function, not some other # like time.time(), for two reasons : # (a) the timestamp should fit 32 bits ; # (b) the timestamps used internally in .sync() should be provided by the same function . # What I probably should do here is make the egi.ms_localtime() call the default option . # ( Actually, it *is* the default option -- it just happens then in a different thread # right before the actual communication. This is Ok for .sync(), # but should probably be changed for .send_event() . ) # 2. Note that in the Log Window the events appear in the order of posting,
# store data for thisExp (ExperimentHandler) thisExp.addData('key_resp_4.keys',key_resp_4.keys) if key_resp_4.keys != None: # we had a response thisExp.addData('key_resp_4.rt', key_resp_4.rt) thisExp.nextEntry() #------Prepare to start Routine "nBack"------- t = 0 nBackClock.reset() # clock frameN = -1 # update component parameters for each repeat key_resp_9 = event.BuilderKeyResponse() # create an object of type KeyResponse key_resp_9.status = NOT_STARTED ns.sync() ns.send_event( 'inst', label="Begin Instructions", timestamp=egi.ms_localtime(), table = {'time' : egi.ms_localtime()} ) # keep track of which components have finished nBackComponents = [] nBackComponents.append(key_resp_9) nBackComponents.append(image) for thisComponent in nBackComponents: if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED #-------Start Routine "nBack"------- continueRoutine = True while continueRoutine: # get current time t = nBackClock.getTime() frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
ns.send_event('evt3', label="event3", description="this is a description of event 3") # the description, if exists, also goes to the log window -- # -- but, at least for our version of NetStation, # CAN NOT BE EXPORTED -- so it seems that it's main goal is pure amusement . # If one is curious, this also has variable length ( up to 256 characters, # if I am not mistaken ) time.sleep(0.1) # force the events to arrive in the "correct" order # but what we really want is attach the information about the current time moment, # or may be even some other moment back in time : ns.send_event('evt5', timestamp=egi.ms_localtime()) ns.send_event('evt6', description='back in time', timestamp=egi.ms_localtime() - 50) # 1. At the moment we have to use the egi.ms_localtime() function, not some other # like time.time(), for two reasons : # (a) the timestamp should fit 32 bits ; # (b) the timestamps used internally in .sync() should be provided by the same function . # What I probably should do here is make the egi.ms_localtime() call the default option . # ( Actually, it *is* the default option -- it just happens then in a different thread # right before the actual communication. This is Ok for .sync(), # but should probably be changed for .send_event() . ) # 2. Note that in the Log Window the events appear in the order of posting, # but with "correct" timestamps ( i.e. last has a timestamp that is 50 ms "earlier" than the previous )
def __init__(self, code, label, table): self.code=code self.label=label self.timestamp=egi.ms_localtime() self.table=table
ns.send_event("evt3", label="event3", description="this is a description of event 3") # the description, if exists, also goes to the log window -- # -- but, at least for our version of NetStation, # CAN NOT BE EXPORTED -- so it seems that it's main goal is pure amusement . # If one is curious, this also has variable length ( up to 256 characters, # if I am not mistaken ) time.sleep(0.1) # force the events to arrive in the "correct" order # but what we really want is attach the information about the current time moment, # or may be even some other moment back in time : ns.send_event("evt5", timestamp=egi.ms_localtime()) ns.send_event("evt6", description="back in time", timestamp=egi.ms_localtime() - 50) # 1. At the moment we have to use the egi.ms_localtime() function, not some other # like time.time(), for two reasons : # (a) the timestamp should fit 32 bits ; # (b) the timestamps used internally in .sync() should be provided by the same function . # What I probably should do here is make the egi.ms_localtime() call the default option . # ( Actually, it *is* the default option -- it just happens then in a different thread # right before the actual communication. This is Ok for .sync(), # but should probably be changed for .send_event() . ) # 2. Note that in the Log Window the events appear in the order of posting, # but with "correct" timestamps ( i.e. last has a timestamp that is 50 ms "earlier" than the previous )