def run(self): '''Triggered at Run ''' self.total_times = [] self.timestamp = [] self.stimmed = [] self.frametimes = [] with RunManager(self.name, self.runAcquirer, self.setup, self.q_sig, self.q_comm) as rm: print(rm) self.imgs = np.array(self.saveArray) f = h5py.File('output/sample_stream.h5', 'w', libver='latest') f.create_dataset("default", data=self.imgs) f.close() np.savetxt('output/stimmed.txt', np.array(self.stimmed)) np.savetxt('output/timing/frametimes.txt', np.array(self.frametimes)) print('Acquisition complete, avg time per frame: ', np.mean(self.total_times)) print('Acquire got through ', self.frame_num, ' frames') np.savetxt('output/timing/acquire_frame_time.txt', self.total_times) np.savetxt('output/timing/acquire_timestamp.txt', self.timestamp)
def run(self): self.total_times = [] self.puttime = [] self.colortime = [] self.stimtime = [] self.timestamp = [] self.LL = [] with RunManager(self.name, self.runStep, self.setup, self.q_sig, self.q_comm) as rm: logger.info(rm) print('Analysis broke, avg time per frame: ', np.mean(self.total_times, axis=0)) print('Analysis broke, avg time per put analysis: ', np.mean(self.puttime)) print('Analysis broke, avg time per color frame: ', np.mean(self.colortime)) print('Analysis broke, avg time per stim avg: ', np.mean(self.stimtime)) print('Analysis got through ', self.frame, ' frames') N = self.p["numNeurons"] np.savetxt('output/model_weights.txt', self.theta[:N * N].reshape( (N, N))) np.savetxt('output/timing/analysis_frame_time.txt', np.array(self.total_times)) np.savetxt('output/timing/analysis_timestamp.txt', np.array(self.timestamp)) np.savetxt('output/analysis_estsAvg.txt', np.array(self.estsAvg)) np.savetxt('output/analysis_proc_S.txt', np.array(self.S)) np.savetxt('output/analysis_LL.txt', np.array(self.LL)) np.savetxt('output_snap/stims.txt', self.currStimID)
def run(self): ''' Run indefinitely. Calls runAcquirer after checking for signals ''' self.total_times = [] self.timestamp = [] with RunManager(self.name, self.runAcquirer, self.setup, self.q_sig, self.q_comm) as rm: print(rm) print('Done running Acquire, avg time per frame: ', np.mean(self.total_times)) print('Acquire got through ', self.frame_num, ' frames') if not os._exists('output'): try: os.makedirs('output') except: pass if not os._exists('output/timing'): try: os.makedirs('output/timing') except: pass np.savetxt('output/timing/acquire_frame_time.txt', np.array(self.total_times)) np.savetxt('output/timing/acquire_timestamp.txt', np.array(self.timestamp))
def run(self): self.total_times = [] self.puttime = [] self.colortime = [] self.stimtime = [] self.timestamp = [] with RunManager(self.name, self.runAvg, self.setup, self.q_sig, self.q_comm) as rm: logger.info(rm) print('Analysis broke, avg time per frame: ', np.mean(self.total_times, axis=0)) print('Analysis broke, avg time per put analysis: ', np.mean(self.puttime)) print('Analysis broke, avg time per color frame: ', np.mean(self.colortime)) print('Analysis broke, avg time per stim avg: ', np.mean(self.stimtime)) print('Analysis got through ', self.frame, ' frames') if not os._exists('output'): try: os.makedirs('output') except: pass if not os._exists('output/timing'): try: os.makedirs('output/timing') except: pass np.savetxt('output/timing/analysis_frame_time.txt', np.array(self.total_times)) np.savetxt('output/timing/analysisput_frame_time.txt', np.array(self.puttime)) np.savetxt('output/timing/analysiscolor_frame_time.txt', np.array(self.colortime)) np.savetxt('output/timing/analysis_timestamp.txt', np.array(self.timestamp))
def run(self): ''' continually run the watcher to check all of the input queues for objects to save ''' with RunManager(self.name, self.watchrun, self.setup, self.q_sig, self.q_comm) as rm: logger.info(rm) print('watcher saved ' + str(self.numSaved) + ' objects')
def run(self): ''' Run the processor continually on input frames ''' self.fitframe_time = [] self.putAnalysis_time = [] self.procFrame_time = [] #aka t_motion self.detect_time = [] self.shape_time = [] self.flag = False self.total_times = [] self.timestamp = [] self.counter = 0 with RunManager(self.name, self.runProcess, self.setup, self.q_sig, self.q_comm) as rm: logger.info(rm) print('Processor broke, avg time per frame: ', np.mean(self.total_times, axis=0)) print('Processor got through ', self.frame_number, ' frames') if not os._exists('output'): try: os.makedirs('output') except: pass if not os._exists('output/timing'): try: os.makedirs('output/timing') except: pass np.savetxt('output/timing/process_frame_time.txt', np.array(self.total_times)) np.savetxt('output/timing/process_timestamp.txt', np.array(self.timestamp)) np.savetxt('output/timing/putAnalysis_time.txt', np.array(self.putAnalysis_time)) np.savetxt('output/timing/procFrame_time.txt', np.array(self.procFrame_time)) self.shape_time = np.array(self.onAc.t_shapes) self.detect_time = np.array(self.onAc.t_detect) np.savetxt('output/timing/fitframe_time.txt', np.array(self.fitframe_time)) np.savetxt('output/timing/shape_time.txt', self.shape_time) np.savetxt('output/timing/detect_time.txt', self.detect_time)
def run(self): self.total_times = [] self.puttime = [] self.colortime = [] self.stimtime = [] self.timestamp = [] with RunManager(self.name, self.runAvg, self.setup, self.q_sig, self.q_comm) as rm: logger.info(rm) print('Analysis broke, avg time per frame: ', np.mean(self.total_times, axis=0)) print('Analysis broke, avg time per put analysis: ', np.mean(self.puttime)) print('Analysis broke, avg time per color frame: ', np.mean(self.colortime)) print('Analysis broke, avg time per stim avg: ', np.mean(self.stimtime)) print('Analysis got through ', self.frame, ' frames') np.savetxt('output/timing/analysis_frame_time.txt', np.array(self.total_times)) np.savetxt('output/timing/analysisput_frame_time.txt', np.array(self.puttime)) np.savetxt('output/timing/analysiscolor_frame_time.txt', np.array(self.colortime)) np.savetxt('output/timing/analysis_timestamp.txt', np.array(self.timestamp)) np.savetxt('output/final/analysis_tuning_curves.txt', np.array(self.polarAvg))
def run(self): '''Run the processor continually on input frames ''' self.fitframe_time = [] self.putAnalysis_time = [] self.procFrame_time = [] #aka t_motion self.detect_time = [] self.shape_time = [] self.flag = False self.total_times = [] self.timestamp = [] self.counter = 0 with RunManager(self.name, self.runProcess, self.setup, self.q_sig, self.q_comm) as rm: logger.info(rm) print('Processor broke, avg time per frame: ', np.mean(self.total_times, axis=0)) print('Processor got through ', self.frame_number, ' frames') np.savetxt('output/timing/process_frame_time.txt', np.array(self.total_times)) np.savetxt('output/timing/process_timestamp.txt', np.array(self.timestamp)) self.shape_time = np.array(self.onAc.t_shapes) self.detect_time = np.array(self.onAc.t_detect) np.savetxt('output/timing/fitframe_time.txt', np.array(self.fitframe_time)) np.savetxt('output/timing/shape_time.txt', self.shape_time) np.savetxt('output/timing/detect_time.txt', self.detect_time) np.savetxt('output/timing/putAnalysis_time.txt', np.array(self.putAnalysis_time)) np.savetxt('output/timing/procFrame_time.txt', np.array(self.procFrame_time)) # before = self.params['init_batch'] # nb = self.onAc.params.get('init', 'nb') # np.savetxt('raw_C.txt', np.array(self.onAc.estimates.C_on[nb:self.onAc.M, before:self.frame_number+before])) print('Number of times coords updated ', self.counter) # with open('../S.pk', 'wb') as f: # init = self.params['init_batch'] # S = np.stack([osi.s[init:] for osi in self.onAc.estimates.OASISinstances]) # print('--------Final S shape: ', S.shape) # pickle.dump(S, f) # with open('../A.pk', 'wb') as f: # nb = self.onAc.params.get('init', 'nb') # A = self.onAc.estimates.Ab[:, nb:] # print(type(A)) # pickle.dump(A, f) if self.onAc.estimates.OASISinstances is not None: try: init = self.params['init_batch'] S = np.stack([ osi.s[init:] for osi in self.onAc.estimates.OASISinstances ]) np.savetxt('output/end_spikes.txt', S) except Exception as e: logger.error('Exception {}: {} during frame number {}'.format( type(e).__name__, e, self.frame_number)) print(traceback.format_exc()) else: print('No OASIS') self.coords1 = [o['CoM'] for o in self.coords] print(self.coords1[0]) print('type ', type(self.coords1[0])) np.savetxt('output/contours.txt', np.array(self.coords1))
def run(self): with RunManager(self.name, self.run_acquirer, self.setup, self.q_sig, self.q_comm) as rm: print(rm)
def run(self): ''' Run continuously, waiting for input ''' with RunManager(self.name, self.getInput, self.setup, self.q_sig, self.q_comm) as rm: logger.info(rm)