def loadFromISPyBPushButtonClicked( self ): print "load from ISPyB" dialog = ISPyBExperimentExplorerWidget( "ISPyBExperimentExplorerWidget" ) experiments = self.collectBrickObject.getExperimentNamesByProposalCodeNumber() dialog.loadExperiments( experiments ) if dialog.exec_() == Qt.QDialog.Accepted: xmlContent = self.collectBrickObject.getRobotXMLByExperimentId( dialog.getSelectedExperimentId() ) collectPars = CollectPars( None ) collectPars.searchXML( xmlContent ) #Loading from ISPyB collectPars.sampleType = self.sampleTypeComboBox.currentText() collectPars.storageTemperature = self.storageTemperatureDoubleSpinBox.value() collectPars.extraFlowTime = self.extraFlowTimeSpinBox.value() collectPars.optimization = self.optimizationComboBox.currentIndex() collectPars.optimizationText = self.optimizationComboBox.currentText() collectPars.initialCleaning = self.initialCleaningCheckBox.isChecked() collectPars.bufferMode = self.bufferModeComboBox.currentIndex() self.bufferNames = [] # collectPars.bufferMode = self.bufferModeComboBox.currentIndex() self.loadPars( collectPars ) else: return None
def loadFile(self, filename): try: myPars = CollectPars(filename) self.clearConfiguration() # Clear first if load was succesful # for sampleID in self.sampleIDs: index = self.sampleIDs.index(sampleID) self.tableWidget.removeRow(index) self.sampleIDs.remove(sampleID) # # General parameters # self.CBblock = 1 self.setComboBox(self.sampleTypeComboBox, myPars.sampleType) self.storageTemperatureDoubleSpinBox.setValue( float(myPars.storageTemperature)) self.extraFlowTimeSpinBox.setValue(float(myPars.extraFlowTime)) self.initialCleaningCheckBox.setChecked(myPars.initialCleaning) # These are saved by index self.optimizationComboBox.setCurrentIndex(myPars.optimization) self.bufferModeComboBox.setCurrentIndex(myPars.bufferMode) #TODO: Staffan's note: take it away # self.historyText.clear() # self.historyText.setText( myPars.history.strip() ) for myBuffer in myPars.bufferList: self.addSampleRow(myBuffer) for sample in myPars.sampleList: self.addSampleRow(sample) self.CBblock = 0 self.filename = filename self.collectBrickObject.setRobotFileName(filename) # strip all but the last part for label self.collectBrickObject.changexmlLabel(filename) except Exception: logger.exception('Cannot load collection parameters file. \n') Qt.QMessageBox.critical( self.brick_widget, "Error", "Error when trying to read file '%s'!" % filename)
def loadFile(self, filename): try: myPars = CollectPars(filename) #ISPyBCollectPars(filename) self.clearConfiguration() # Clear first if load was succesful # for sampleID in self.sampleIDs: index = self.sampleIDs.index(sampleID) self.tableWidget.removeRow(index) self.sampleIDs.remove(sampleID) # # General parameters # self.CBblock = 1 self.setComboBox(self.sampleTypeComboBox, myPars.sampleType) self.storageTemperatureDoubleSpinBox.setValue( float(myPars.storageTemperature)) self.extraFlowTimeSpinBox.setValue(float(myPars.extraFlowTime)) self.initialCleaningCheckBox.setChecked(myPars.initialCleaning) # These are saved by index self.optimizationComboBox.setCurrentIndex(myPars.optimization) self.bufferModeComboBox.setCurrentIndex(myPars.bufferMode) self.historyText.clear() self.historyText.setText(myPars.history.strip()) for myBuffer in myPars.bufferList: self.addSampleRow(myBuffer) for sample in myPars.sampleList: self.addSampleRow(sample) self.CBblock = 0 self.filename = filename Qt.QMessageBox.information( self, "Info", "The data from ISPyB was successfully loaded!") except Exception, e: logger.exception('Cannot load collection parameters file. \n') Qt.QMessageBox.critical(self, "Error", "Error when loading data from ISPyB!")
def getCollectRobotPars( self, isAll = 0 ): params = CollectPars() sampleList = SampleList() bufferList = SampleList() params.sampleType = self.sampleTypeComboBox.currentText() params.storageTemperature = self.storageTemperatureDoubleSpinBox.value() params.extraFlowTime = self.extraFlowTimeSpinBox.value() params.optimization = self.optimizationComboBox.currentIndex() params.optimizationText = self.optimizationComboBox.currentText() params.initialCleaning = self.initialCleaningCheckBox.isChecked() params.bufferMode = self.bufferModeComboBox.currentIndex() #================================================= # myBuffer mode #================================================= params.bufferFirst = False params.bufferBefore = False params.bufferAfter = False if params.bufferMode == 0: params.bufferFirst = True params.bufferAfter = True elif params.bufferMode == 1: params.bufferBefore = True elif params.bufferMode == 2: params.bufferAfter = True #================================================= # optimization mode #================================================= params.optimSEUtemp = False params.optimCodeAndSEU = False if params.optimization == 1: params.optimSEUtemp = True elif params.optimization == 2: params.optimCodeAndSEU = True #----------------------------------------------------- # # SAMPLES # #----------------------------------------------------- for i in range( 0, self.tableWidget.rowCount() ): sample = self.getSampleRow( i ) if isAll or sample.enable: if sample.isBuffer(): bufferList.append( sample ) else: sampleList.append( sample ) #================================================= # assign myBuffer to sample # TODO: allow to assign more than one myBuffer. isAll with same name #================================================= for sample in sampleList: sample.buffer = [] if len( bufferList ) == 1: # if there is one and only one myBuffer defined dont look at name. assign sample.buffer.append( bufferList[0] ) else: for myBuffer in bufferList: if myBuffer.buffername == sample.buffername: sample.buffer.append( myBuffer ) # ================================================== # OPTIMIZE DATA COLLECTION PROCEDURE (IF REQUESTED) # ================================================== if params.optimSEUtemp: sampleList.sortSEUtemp() elif params.optimCodeAndSEU: sampleList.sortCodeAndSEU() params.sampleList = sampleList params.bufferList = bufferList return params
def getCollectRobotPars(self, isAll=0): params = CollectPars() sampleList = SampleList() bufferList = SampleList() params.sampleType = self.sampleTypeComboBox.currentText() params.storageTemperature = self.storageTemperatureDoubleSpinBox.value( ) params.extraFlowTime = self.extraFlowTimeSpinBox.value() params.optimization = self.optimizationComboBox.currentIndex() params.optimizationText = self.optimizationComboBox.currentText() params.initialCleaning = self.initialCleaningCheckBox.isChecked() params.bufferMode = self.bufferModeComboBox.currentIndex() #================================================= # myBuffer mode #================================================= params.bufferFirst = False params.bufferBefore = False params.bufferAfter = False if params.bufferMode == 0: params.bufferFirst = True params.bufferAfter = True elif params.bufferMode == 1: params.bufferBefore = True elif params.bufferMode == 2: params.bufferAfter = True #================================================= # optimization mode #================================================= params.optimSEUtemp = False params.optimCodeAndSEU = False if params.optimization == 1: params.optimSEUtemp = True elif params.optimization == 2: params.optimCodeAndSEU = True #----------------------------------------------------- # # SAMPLES # #----------------------------------------------------- for i in range(0, self.tableWidget.rowCount()): sample = self.getSampleRow(i) if isAll or sample.enable: if sample.isBuffer(): bufferList.append(sample) else: sampleList.append(sample) #================================================= # assign myBuffer to sample # TODO: allow to assign more than one myBuffer. isAll with same name #================================================= for sample in sampleList: sample.buffer = [] if len( bufferList ) == 1: # if there is one and only one myBuffer defined dont look at name. assign sample.buffer.append(bufferList[0]) else: for myBuffer in bufferList: if myBuffer.buffername == sample.buffername: sample.buffer.append(myBuffer) # ================================================== # OPTIMIZE DATA COLLECTION PROCEDURE (IF REQUESTED) # ================================================== if params.optimSEUtemp: sampleList.sortSEUtemp() elif params.optimCodeAndSEU: sampleList.sortCodeAndSEU() params.sampleList = sampleList params.bufferList = bufferList return params