def __call__(self, command, asynchronous=True): # logger.debug("executing %s",command) if asynchronous: cmd = SpecCommand.SpecCommandA(command, self.specVersion) else: cmd = SpecCommand.SpecCommand(command, self.specVersion, None) return cmd()
def update_clicked(self): xtalcmd = SpecCommand.SpecCommandA('', 'corvette.cars.aps.anl.gov:6780') Dist = self.T1.text() cmdcon0 = 'BMCPilatusDist = ' + Dist eval("xtalcmd.executeCommand(\"%s\")" % cmdcon0) time.sleep(0.2) beamX = self.T2.text() cmdcon1 = 'BMCPilatusBeamX = ' + beamX eval("xtalcmd.executeCommand(\"%s\")" % cmdcon1) time.sleep(0.2) beamY = self.T3.text() cmdcon2 = 'BMCPilatusBeamY = ' + beamY eval("xtalcmd.executeCommand(\"%s\")" % cmdcon2) time.sleep(0.2) if self.R2.isChecked() == True: cmdcon3 = 'TIFCBF = 1' xtalcmd.executeCommand(cmdcon3) else: cmdcon3 = 'TIFCBF = 0' xtalcmd.executeCommand(cmdcon3) CrysTxt = 'APEX parameters have been written.\nCrysAlis parameters are:\nDetectorDist = ' CrysTxt = CrysTxt + Dist + '\nX0 = ' CrysTxt = CrysTxt + str(float(beamX) + 32.0) + '\nY0= ' CrysTxt = CrysTxt + str(1044.0 - float(beamY)) self.CrysAlis.setText(CrysTxt)
def newsample(self, newsample): SamNam = newsample.text() xtalcmd = SpecCommand.SpecCommandA('','corvette.cars.aps.anl.gov:6780') cmdcon = 'newsample '+SamNam eval("xtalcmd.executeCommand(\"%s\")" % cmdcon) time.sleep(0.2) self.nextscan(self.LogL1, 'templog.txt')
def DataColl(self, Delt, Nu, KphiS, KphiE, StpN, TimNE): flgon = 1 flgon = self.epicswarning(self.Delt, self.warn1, '13BMC:m37', flgon) flgon = self.epicswarning(self.Nu, self.warn2, '13BMC:m38', flgon) flgon = self.epicswarning(self.KphiStart, self.warn3, '13BMC:m33', flgon) flgon = self.epicswarning(self.KphiEnd, self.warn4, '13BMC:m33', flgon) flgon = self.stepwarning(self.StpN, self.warn5, flgon) flgon = self.speedwarning(self.TimperFrm, self.warn6, self.KphiStart, self.KphiEnd, self.StpN, flgon) if flgon: self.Detmov(Delt, Nu) xtalcmd = SpecCommand.SpecCommandA( '', 'corvette.cars.aps.anl.gov:6780') kphivelo = epics.caget('13BMC:m33.VELO') kphiini = epics.caget('13BMC:m33.VAL') cmdcon = "xtal kphi " + KphiS.text() + ' ' + KphiE.text( ) + ' ' + StpN.text() + ' ' + TimNE.text() eval("xtalcmd.executeCommand(\"%s\")" % cmdcon) Ttem = np.abs(kphiini - float(KphiS.text())) / kphivelo + float( TimNE.text()) * float(StpN.text()) + 3 time.sleep(Ttem) if (int(StpN.text()) > 1) and (self.SUMCK.isChecked() == True): time.sleep(2) DummyPath = SpecVariable.SpecVariable( 'SCANLOG_PATH', 'corvette.cars.aps.anl.gov:6780').getValue() DummyN = SpecVariable.SpecVariable( 'SCAN_N', 'corvette.cars.aps.anl.gov:6780').getValue() DumS = 'S' + (3 - len(str(DummyN))) * '0' + str(DummyN) + '/' L = re.split('/', DummyPath) # For Win7 system # FL = 'T:/'+ L[5]+'/'+ L[6]+'/'+ L[7]+'/'+ L[8]+'/'+ L[9]+'/'+ L[10]+'/'+ L[11]+'/images/'+ L[13]+'/'+DumS # For Win10 system FL = '//cars5/data/' + L[5] + '/' + L[6] + '/' + L[ 7] + '/' + L[8] + '/' + L[9] + '/' + L[10] + '/' + L[ 11] + '/images/' + L[13] + '/' + DumS files = [] # r=root, d=directories, f = files for r, d, f in os.walk(FL): for file in f: if '.cbf' in file: files.append(os.path.join(r, file)) elif '.tif' in file: files.append(os.path.join(r, file)) img = fabio.open(files[0]) for file in files[1:]: data = fabio.open(file).data img.data = img.data + data for xi in range(1043): for xj in range(981): if img.data[xi, xj] < 0: img.data[xi, xj] = -1 IML = FL + 'sum.cbf' img.write(IML) self.lastscan(self.LogL1, 'templog.txt')
def newsample(self, newsample): SamNam = newsample.text() self.warn7.setText('') if (SamNam.contains('_') == True) or (SamNam.contains('/') == True) or (SamNam.contains('.') == True) or (SamNam.contains(' ') == True): self.warn7.setText('Invalid symbol: _ / . space') else: xtalcmd = SpecCommand.SpecCommandA( '', 'corvette.cars.aps.anl.gov:6780') cmdcon = 'newsample ' + SamNam eval("xtalcmd.executeCommand(\"%s\")" % cmdcon) time.sleep(0.2) self.nextscan(self.LogL1, 'templog.txt')
def DataColl(self, Delt, Nu, KphiS, KphiE, StpN, TimNE): flgon = 1 flgon = self.epicswarning(self.Delt, self.warn1, '13BMC:m37', flgon) flgon = self.epicswarning(self.Nu, self.warn2, '13BMC:m38', flgon) flgon = self.epicswarning(self.KphiStart, self.warn3, '13BMC:m33', flgon) flgon = self.epicswarning(self.KphiEnd, self.warn4, '13BMC:m33', flgon) flgon = self.stepwarning(self.StpN, self.warn5, flgon) flgon = self.speedwarning(self.TimperFrm, self.warn6, self.KphiStart, self.KphiEnd, self.StpN, flgon) if flgon: self.Detmov(Delt, Nu) xtalcmd = SpecCommand.SpecCommandA('','corvette.cars.aps.anl.gov:6780') kphivelo = epics.caget('13BMC:m33.VELO') kphiini = epics.caget('13BMC:m33.VAL') cmdcon = "xtal kphi " + KphiS.text()+' '+ KphiE.text()+' '+ StpN.text()+' '+ TimNE.text() eval("xtalcmd.executeCommand(\"%s\")" % cmdcon) Ttem = np.abs(kphiini-float(KphiS.text()))/kphivelo + float(TimNE.text())*float(StpN.text()) + 3 time.sleep(Ttem) self.lastscan(self.LogL1, 'templog.txt')
'STARTUP_PROJECT_PATH', 'corvette.cars.aps.anl.gov:6780').getValue() len1 = len(MajorPath + "scandata/") dummy = LogPath[len1:-1] cmdcon = time.asctime( ) + '\n\tNew data will be saved in folder: ' + dummy + '\n' f = open(tempfile, 'a+') dummy2 = f.read() f.close() os.remove(tempfile) dummy3 = cmdcon + dummy2 f = open(tempfile, 'a+') f.write(dummy3) f.close() widget1.setText(dummy3) if __name__ == "__main__": xtalcmd = SpecCommand.SpecCommandA('', 'corvette.cars.aps.anl.gov:6780') eval("xtalcmd.executeCommand(\"%s\")" % 'wh') try: os.remove('templog.txt') except: pass time.sleep(0.3) app = QtGui.QApplication(sys.argv) MainWindow = QtGui.QMainWindow() ui1 = uilogic() ui1.setupUi(MainWindow) MainWindow.show() sys.exit(app.exec_())
def resume(self): if self.isConnected() and self.paused: SpecCommand.SpecCommandA('scan_on', self.specVersion)()