def update_point(self, update_gui=True): ctr = self.get_ctr() if ctr == None: return apnt = self.components.AnchorPointNum.stringSelection if len(apnt) > 0: apnt = int(apnt) (intpar, corrpar) = ctr_data.get_params(ctr, apnt) if self.components.SetCorrParams.checked == False: corrpar = {} if self.components.SetIntParams.checked == False: intpar = {} point = int(self.components.PointNum.stringSelection) ctr_data.set_params(ctr, point, intpar=intpar, corrpar=corrpar) if self.components.AutoIntegrate.checked == True: self.integrate_point(update_plots=update_gui) if update_gui: self.update_gui_from_ctr() if self.components.AutoPlotScan.checked == True: self._plot_scan() if self.components.AutoPlotCorr.checked == True: self._plot_corr()
def update_point(self,update_gui=True): ctr = self.get_ctr() if ctr == None: return apnt = self.components.AnchorPointNum.stringSelection if len(apnt) > 0: apnt = int(apnt) (intpar,corrpar) = ctr_data.get_params(ctr,apnt) if self.components.SetCorrParams.checked == False: corrpar = {} if self.components.SetIntParams.checked == False: intpar = {} point = int(self.components.PointNum.stringSelection) ctr_data.set_params(ctr,point,intpar=intpar,corrpar=corrpar) if self.components.AutoIntegrate.checked == True: self.integrate_point(update_plots=update_gui) if update_gui: self.update_gui_from_ctr() if self.components.AutoPlotScan.checked == True: self._plot_scan() if self.components.AutoPlotCorr.checked == True: self._plot_corr()
def update_gui_from_ctr(self, ): """ update gui from a ctr data instance """ # if DEBUG: tm1 = time.time() # ctr = self.get_ctr() if ctr == None: return npts = len(ctr.L) pnts = range(npts) self.init_PointNum(pnts=pnts) self.init_AnchorPointNum(pnts=pnts) # point = int(self.components.PointNum.text) set = self.set if point in ctr.bad: bad_flag = True else: bad_flag = False # try to get alpha and beta angles try: alp = "%6.3f" % ctr.get_corr(point).gonio.pangles['alpha'] bet = "%6.3f" % ctr.get_corr(point).gonio.pangles['beta'] except: alp = '' bet = '' try: sname = str(ctr.get_scan_name(point)) except: sname = '' header1 = SET_HEADER % (str(len(ctr.L)), str(set)) header2 = POINT_HEADER % ( str(point), ctr.H[point], ctr.K[point], ctr.L[point], str(ctr.scan_type[point]), sname, str(ctr.labels['I'][point]), str(ctr.labels['Inorm'][point]), str( ctr.labels['Ierr'][point]), str(ctr.labels['Ibgr'][point]), str(ctr.corr_params[point].get('geom')), str(ctr.corr_params[point].get('beam_slits')), str(ctr.corr_params[point].get('det_slits')), str(ctr.corr_params[point].get('sample')), str(ctr.corr_params[point].get('scale')), str(bad_flag), ctr.I[point], ctr.Ierr[point], ctr.Ibgr[point], ctr.ctot[point], ctr.F[point], ctr.Ferr[point], alp, bet) self.components.SetData.text = header1 self.components.PointData.text = header2 # (intpar, corrpar) = ctr_data.get_params(ctr, point) self.init_IntParamList(params=intpar) self.init_CorrParamList(params=corrpar) # if ctr.scan_type[point] == 'image': (immax, im_max) = self.image_max() self.components.ImaxSlider.min = 0 self.components.ImaxSlider.max = int(immax) if im_max == -1: self.components.Imax.text = '-1' self.components.ImaxSlider.value = int(immax) else: self.components.Imax.text = str(im_max) self.components.ImaxSlider.value = int(im_max) if DEBUG: print "Update gui time(s)", time.time() - tm1
def update_gui_from_ctr(self,): """ update gui from a ctr data instance """ # if DEBUG: tm1 = time.time() # ctr = self.get_ctr() if ctr == None: return npts = len(ctr.L) pnts = range(npts) self.init_PointNum(pnts=pnts) self.init_AnchorPointNum(pnts=pnts) # point = int(self.components.PointNum.text) set = self.set if point in ctr.bad: bad_flag = True else: bad_flag = False # try to get alpha and beta angles try: alp = "%6.3f" % ctr.get_corr(point).gonio.pangles['alpha'] bet = "%6.3f" % ctr.get_corr(point).gonio.pangles['beta'] except: alp = '' bet = '' try: sname = str(ctr.get_scan_name(point)) except: sname = '' header1 = SET_HEADER % (str(len(ctr.L)),str(set)) header2 = POINT_HEADER % (str(point), ctr.H[point],ctr.K[point],ctr.L[point], str(ctr.scan_type[point]), sname, str(ctr.labels['I'][point]), str(ctr.labels['Inorm'][point]), str(ctr.labels['Ierr'][point]), str(ctr.labels['Ibgr'][point]), str(ctr.corr_params[point].get('geom')), str(ctr.corr_params[point].get('beam_slits')), str(ctr.corr_params[point].get('det_slits')), str(ctr.corr_params[point].get('sample')), str(ctr.corr_params[point].get('scale')), str(bad_flag), ctr.I[point],ctr.Ierr[point],ctr.Ibgr[point], ctr.ctot[point],ctr.F[point],ctr.Ferr[point], alp, bet) self.components.SetData.text = header1 self.components.PointData.text = header2 # (intpar,corrpar) = ctr_data.get_params(ctr,point) self.init_IntParamList(params=intpar) self.init_CorrParamList(params=corrpar) # if ctr.scan_type[point] == 'image': (immax,im_max) = self.image_max() self.components.ImaxSlider.min = 0 self.components.ImaxSlider.max = int(immax) if im_max == -1: self.components.Imax.text = '-1' self.components.ImaxSlider.value = int(immax) else: self.components.Imax.text = str(im_max) self.components.ImaxSlider.value = int(im_max) if DEBUG: print "Update gui time(s)", time.time()-tm1