예제 #1
0
 def run(self):
     try:
         self.log('Initializing planner!')
 
         scan_config = json.load(open('scan.json'))
         
         rconfig = self.rconfig
         obj = rconfig['uscope']['objective'][rconfig['obj']]
         im_w_pix = int(rconfig['uscope']['imager']['width'])
         im_h_pix = int(rconfig['uscope']['imager']['height'])
         x_um = float(obj['x_view'])
         self.planner = Planner(scan_config=scan_config, hal=rconfig['cnc_hal'], imager=rconfig['imager'],
                 img_sz=(im_w_pix, im_h_pix), unit_per_pix=(x_um / im_w_pix),
                 out_dir=rconfig['out_dir'],
                 progress_cb=rconfig['progress_cb'],
                 dry=rconfig['dry'],
                 #img_scalar=float(rconfig['uscope']['imager']['scalar']),
                 log=self.log, verbosity=2)
         self.log('Running planner')
         b = Benchmark()
         self.planner.run()
         b.stop()
         self.log('Planner done!  Took : %s' % str(b))
     except Exception as e:
         self.log('WARNING: planner thread crashed: %s' % str(e))
         traceback.print_exc()
         #raise
     finally:
         self.plannerDone.emit()
예제 #2
0
    def run(self):
        try:
            self.log('Initializing planner!')

            scan_config = json.load(open('scan.json'))

            rconfig = self.rconfig
            obj = rconfig['uscope']['objective'][rconfig['obj']]
            im_w_pix = int(rconfig['uscope']['imager']['width'])
            im_h_pix = int(rconfig['uscope']['imager']['height'])
            x_um = float(obj['x_view'])
            self.planner = Planner(scan_config=scan_config, hal=rconfig['cnc_hal'], imager=rconfig['imager'],
                    img_sz=(im_w_pix, im_h_pix), unit_per_pix=(x_um / im_w_pix),
                    out_dir=rconfig['out_dir'],
                    progress_cb=rconfig['progress_cb'],
                    dry=rconfig['dry'],
                    #img_scalar=float(rconfig['uscope']['imager']['scalar']),
                    log=self.log, verbosity=2)
            self.log('Running planner')
            b = Benchmark()
            self.planner.run()
            b.stop()
            self.log('Planner done!  Took : %s' % str(b))
        except Exception as e:
            self.log('WARNING: planner thread crashed: %s' % str(e))
            traceback.print_exc()
            #raise
        finally:
            self.plannerDone.emit()
예제 #3
0
class PlannerThread(QThread):
    plannerDone = pyqtSignal()

    def __init__(self,parent, rconfig):
        QThread.__init__(self, parent)
        self.rconfig = rconfig
        self.planner = None

    def log(self, msg):
        #print 'emitting log %s' % msg
        #self.log_buff += str(msg) + '\n'
        self.emit(SIGNAL('log'), msg)

    def setRunning(self, running):
        planner = self.planner
        if planner:
            planner.setRunning(running)

    def run(self):
        try:
            self.log('Initializing planner!')

            scan_config = json.load(open('scan.json'))

            rconfig = self.rconfig
            obj = rconfig['uscope']['objective'][rconfig['obj']]
            im_w_pix = int(rconfig['uscope']['imager']['width'])
            im_h_pix = int(rconfig['uscope']['imager']['height'])
            x_um = float(obj['x_view'])
            self.planner = Planner(scan_config=scan_config, hal=rconfig['cnc_hal'], imager=rconfig['imager'],
                    img_sz=(im_w_pix, im_h_pix), unit_per_pix=(x_um / im_w_pix),
                    out_dir=rconfig['out_dir'],
                    progress_cb=rconfig['progress_cb'],
                    dry=rconfig['dry'],
                    #img_scalar=float(rconfig['uscope']['imager']['scalar']),
                    log=self.log, verbosity=2)
            self.log('Running planner')
            b = Benchmark()
            self.planner.run()
            b.stop()
            self.log('Planner done!  Took : %s' % str(b))
        except Exception as e:
            self.log('WARNING: planner thread crashed: %s' % str(e))
            traceback.print_exc()
            #raise
        finally:
            self.plannerDone.emit()
예제 #4
0
class PlannerThread(QThread):
    plannerDone = pyqtSignal()

    def __init__(self,parent, rconfig):
        QThread.__init__(self, parent)
        self.rconfig = rconfig
        self.planner = None
        
    def log(self, msg):
        #print 'emitting log %s' % msg
        #self.log_buff += str(msg) + '\n'
        self.emit(SIGNAL('log'), msg)
    
    def setRunning(self, running):
        planner = self.planner
        if planner:
            planner.setRunning(running)
        
    def run(self):
        try:
            self.log('Initializing planner!')
    
            scan_config = json.load(open('scan.json'))
            
            rconfig = self.rconfig
            obj = rconfig['uscope']['objective'][rconfig['obj']]
            im_w_pix = int(rconfig['uscope']['imager']['width'])
            im_h_pix = int(rconfig['uscope']['imager']['height'])
            x_um = float(obj['x_view'])
            self.planner = Planner(scan_config=scan_config, hal=rconfig['cnc_hal'], imager=rconfig['imager'],
                    img_sz=(im_w_pix, im_h_pix), unit_per_pix=(x_um / im_w_pix),
                    out_dir=rconfig['out_dir'],
                    progress_cb=rconfig['progress_cb'],
                    dry=rconfig['dry'],
                    #img_scalar=float(rconfig['uscope']['imager']['scalar']),
                    log=self.log, verbosity=2)
            self.log('Running planner')
            b = Benchmark()
            self.planner.run()
            b.stop()
            self.log('Planner done!  Took : %s' % str(b))
        except Exception as e:
            self.log('WARNING: planner thread crashed: %s' % str(e))
            traceback.print_exc()
            #raise
        finally:
            self.plannerDone.emit()