def handle_message(self, mxmsg): if (mxmsg.type == types.SWITCH_MESSAGE and time.time() - self.time > 5): self.time = time.time() self.logger.info("Got switch message, transform scenario!") if int(self.config.get_param('finish_saving')): self.logger.info("But first send finish saving ...") acquisition_helper.send_finish_saving(self.conn) time.sleep(3) logic_helper.restart_scenario( self.conn, self.config.get_param('new_scenario'), leave_on=self.config.get_param('leave_modules').split(';')) else: self.logger.debug("Got unrecognised message: "+str(mxmsg.type)) self.no_response()
def handle_message(self, mxmsg): if (mxmsg.type == types.SWITCH_MESSAGE and time.time() - self.time > 5): self.time = time.time() self.logger.info("Got switch message, transform scenario!") if int(self.config.get_param('finish_saving')): self.logger.info("But first send finish saving ...") acquisition_helper.send_finish_saving(self.conn) time.sleep(3) logic_helper.restart_scenario( self.conn, self.config.get_param('new_scenario'), leave_on=self.config.get_param('leave_modules').split(';')) else: self.logger.warning("Got unrecognised message: "+str(mxmsg.type)) self.no_response()
def run(self): self.logger.info("RUN!!!") #process intro #ugm_helper.send_text(self.conn, self.hi_text) ugm_helper.send_config(self.conn, self.ugm) ugm_helper.send_config_for(self.conn, self.text_id, 'message', self.hi_text) #keystroke.wait([" "]) time.sleep(15) #ugm_helper.send_text(self.conn, self.trial_text) ugm_helper.send_config_for(self.conn, self.text_id, 'message', self.trial_text) time.sleep(15) #keystroke.wait([" "]) ugm_helper.send_config(self.conn, self.ugm) appliance_helper.send_freqs(self.conn, self.all_freqs[:int(self.config.get_param("fields_count"))]) #ugm_helper.send_config(self.conn, self.ugm) ugm_helper.send_config_for(self.conn, self.text_ids[1], 'message', self.feed_text) time.sleep(self.target_time) appliance_helper.send_stop(self.conn) #ugm_helper.send_text(self.conn, self.ready_text) ugm_helper.send_config(self.conn, self.ugm) ugm_helper.send_config_for(self.conn, self.text_id, 'message', self.ready_text) time.sleep(15) #keystroke.wait([" "]) self.logger.info("Send begin config ...") #ugm_helper.send_config(self.conn, self.ugm) #process trials self._run() #process good bye appliance_helper.send_stop(self.conn) #ugm_helper.send_text(self.conn, self.bye_text) ugm_helper.send_config_for(self.conn, self.text_id, 'message', self.bye_text) #acquire some more data time.sleep(2) self.logger.info("Send finish saving and finish ...") acquisition_helper.send_finish_saving(self.conn)
def end(self): ugm_helper.send_text(self.conn, self.bye_text) #acquire some more data time.sleep(2) acquisition_helper.send_finish_saving(self.conn)
def finish_saving(self, wait=True): if wait: acquisition_helper.finish_saving() else: acquisition_helper.send_finish_saving(self.tagger.conn)
trials.addData('resp.corr', resp.corr) if resp.keys != None: #we had a response trials.addData('resp.rt', resp.rt) t = t_start + word.tStart tags_helper.send_tag( TAGGER.conn, t, t, "trial", { 'keys': str(resp.keys), 'corr': str(resp.corr), 'rt': str(resp.rt), 'text': str(text), 'color': str(letterColor) }) #completed 5.0 repeats of 'trials' acquisition_helper.send_finish_saving(TAGGER.conn) trials.saveAsPickle(filename + 'trials') trials.saveAsExcel(filename + '.xlsx', sheetName='trials', stimOut=trials.trialList[0].keys(), dataOut=['n', 'all_mean', 'all_std', 'all_raw']) #Start of routine thanks t = 0 thanksClock.reset() frameN = -1 #update component parameters for each repeat #keep track of which have finished thanksComponents = [] #to keep track of which have finished thanksComponents.append(thanksText)
def finish(self): self.logger.info("start finish saving") acquisition_helper.send_finish_saving(self.conn)
t, t, "trial", { "keys": str(resp.keys), "corr": str(resp.corr), "rt": str(resp.rt), "text": str(text), "color": str(letterColor), }, ) # completed 5.0 repeats of 'trials' acquisition_helper.send_finish_saving(TAGGER.conn) trials.saveAsPickle(filename + "trials") trials.saveAsExcel( filename + ".xlsx", sheetName="trials", stimOut=trials.trialList[0].keys(), dataOut=["n", "all_mean", "all_std", "all_raw"], ) # Start of routine thanks t = 0 thanksClock.reset() frameN = -1 # update component parameters for each repeat