def ImageD11_run(self): while not self.ImageD11_stop_now(): ti = timer() filein, data_object = self.queue_read.get(block=True) if filein is None: for t in self.thresholds_list: self.queues_out[t].put((None, None), block=True) # exit the while 1 break data_object = correct( data_object, self.dark, self.flood, do_median=self.do_median, monitorval=self.monitorval, monitorcol=self.monitorcol, ) ti.tick(filein + " correct ") for t in self.thresholds_list: # Hope that data object is read only self.queues_out[t].put((filein, data_object), block=True) ti.tock(" enqueue ") print "Corrector thread stopping"
def go_for_it(file_series_object, darkimage, floodimage, corrfunc , thresholds_list , li_objs, OMEGA, OMEGASTEP, OMEGAOVERRIDE ): for data_object in file_series_object: t = timer() if not hasattr( data_object, "data"): # Is usually an IOError if isinstance( data_object[1], IOError): sys.stdout.write(data_object[1].strerror + '\n') # data_object[1].filename else: import traceback traceback.print_exception(data_object[0],data_object[1],data_object[2]) sys.exit() continue filein = data_object.filename if OMEGAOVERRIDE or "Omega" not in data_object.header: data_object.header["Omega"] = OMEGA OMEGA += OMEGASTEP OMEGAOVERRIDE = True # once you do it once, continue if not OMEGAOVERRIDE and options.omegamotor != "Omega": data_object.header["Omega"] = float( data_object.header[options.omegamotor] ) data_object = correct( data_object, darkimage, floodimage, do_median = options.median, monitorval = options.monitorval, monitorcol = options.monitorcol, ) t.tick(filein+" io/cor") peaksearch( filein, data_object , corrfunc , thresholds_list , li_objs ) for t in thresholds_list: li_objs[t].finalise()
def go_for_it(file_series_object, darkimage, floodimage, corrfunc, thresholds_list, li_objs): for inc, data_object in enumerate(file_series_object): t = timer() if not isinstance(data_object, fabio.fabioimage.fabioimage): # Is usually an IOError if isinstance(data_object[1], IOError): sys.stdout.write(data_object[1].strerror + '\n') # data_object[1].filename else: import traceback traceback.print_exception(data_object[0], data_object[1], data_object[2]) sys.exit() continue filein = data_object.filename data_object.header["Omega"] = float(omega_list[inc]) data_object = correct( data_object, darkimage, floodimage, do_median=options.median, monitorval=options.monitorval, monitorcol=options.monitorcol, ) t.tick(filein + " io/cor") peaksearch(filein, data_object, corrfunc, thresholds_list, li_objs) for t in thresholds_list: li_objs[t].finalise()