def buildInput(self, _edObject=None): """ This method creates an XSDataInputCharacterisation object depending on the input: - If dataFile input is provided, uses the "createDataInputCharacterisationFromDataFiles" to retrieve the data collection. - If dataSet input is provided, uses the "createDataInputCharacterisationFromDataSets" method to retrieve the data collection. After having retrieved an initial XSDataInputCharacterisation object, it then uses the method "updateDataInputCharacterisation" for updating certain parameters. """ EDVerbose.DEBUG("EDPluginControlCCP4iv1_1.buildInput...") xsDataInputCCP4i = self.getDataInput() pyListXSDataFile = xsDataInputCCP4i.getDataFile() if(len(pyListXSDataFile) > 0): # Ok, we got data files - assemble these to an XSDataInputCharacterisation object. xsDataInputCharacterisation = self.createDataInputCharacterisationFromDataFiles(pyListXSDataFile) else: # No data file input - check for image files: pyListXSDataCCP4iDataSet = xsDataInputCCP4i.getDataSet() if (pyListXSDataCCP4iDataSet is None): pyStrErrorMessage = "No input data!" errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlCCP4iv1_1.buildInput', 'EDPluginControlCCP4iv1_1', pyStrErrorMessage) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage else: xsDataInputCharacterisation = self.createDataInputCharacterisationFromDataSets(pyListXSDataCCP4iDataSet) # Update the data collection with other parameters if (xsDataInputCharacterisation is None): strError = "EDPluginControlCCP4iv1_1.buildInput: failed when building input." EDVerbose.ERROR(strError) self.addErrorMessage(strError) self.setFailure() else: self.updateDataInputCharacterisation(xsDataInputCharacterisation) return xsDataInputCharacterisation
def compareTwoValues(self, _value1, _value2, _dTolerance=0.000001): """ This method compares two values which can be of type double, integer or string. The types of the two values two be compared must be identical. If the value is of type double, an optional tolerance can be passed as an argument to the method. If both values are None the methods returns True. """ bReturnValue = False if (_value1 is None): if (_value2 is None): bReturnValue = True elif (type (_value1) != type(_value2)): strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginSubWedgeMergev1_1.compareTwoValues', self.getClassName(), "Types of values different : value1=%r, value2=%r" % (type(_value1), type(_value2))) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise Exception, strErrorMessage elif (type(_value1) == type(0.1)): if (abs(_value1 - _value2) < _dTolerance): bReturnValue = True elif (type(_value1) == type(1)): if (_value1 == _value2): bReturnValue = True elif type(_value1) == type("aaa") or type(_value1) == type(u'unicode'): if _value1 == _value2: bReturnValue = True else: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginSubWedgeMergev1_1.compareTwoValues', self.getClassName(), "Unknown value type : %r for value %r" % (type(_value1), _value1)) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise Exception, strErrorMessage return bReturnValue
def setDataInput(self, _oDataInput, _strDataInputKey=None): """ Sets the plugin input data. _oDataInput could be either an String XML or an XSData object. """ EDVerbose.DEBUG("EDPluginWrapperForJobScheduler.setDataInput") strDataInputKey = _strDataInputKey if (strDataInputKey is None): strDataInputKey = self.getDefaultInputDataKey() # Allow for None input if (_oDataInput is None): EDVerbose.DEBUG("EDPlugin.setDataInput: Data input is None") self.__dictXMLDataInput[ strDataInputKey ] = [] else: # Check the type strXMLDataInput = None if isinstance(_oDataInput, (str, unicode)): EDVerbose.DEBUG("EDPlugin.setDataInput: Input Data is string ") strXMLDataInput = _oDataInput else: try: strXMLDataInput = _oDataInput.marshal() except BaseException, e: strErrorMessage = "ERROR: EDPluginWrapperForJobScheduler.setDataInput, cannot marshal data input object" EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage # Add the object to a list if its key is not the default key if (strDataInputKey != self.getDefaultInputDataKey()) : # Check if there's already a list stored if (not strDataInputKey in self.__dictXMLDataInput.keys()): self.__dictXMLDataInput[ strDataInputKey ] = [] self.__dictXMLDataInput[ strDataInputKey ].append(strXMLDataInput) else: self.__dictXMLDataInput[ strDataInputKey ] = strXMLDataInput
def postProcess(self, _edObject=None): """ Parses the labelit.screen log file and the generated MOSFLM script """ EDPluginExecProcessScript.postProcess(self, _edObject) EDVerbose.DEBUG("EDPluginLabelitv10.postProcess...") strLabelitLog = self.readProcessLogFile() if (strLabelitLog is None): errorMessage = EDMessage.ERROR_EXECUTION_03 % ("EDPluginLabelitv10.postProcess", self.getClassName(), "Could not read the Labelit log file") EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) else: xsDataLabelitScreenOutput = self.parseLabelitScreenOutput(strLabelitLog) xsDataIntegerSelectedSolutionNumber = xsDataLabelitScreenOutput.getSelectedSolutionNumber() if (xsDataIntegerSelectedSolutionNumber is None): errorMessage = EDMessage.ERROR_EXECUTION_03 % ("EDPluginLabelitv10.postProcess", self.getClassName(), "No selected solution") EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) else: strLabelitMosflmScriptsOutput = self.readProcessFile(self.generateMosflmScriptName(xsDataIntegerSelectedSolutionNumber.getValue())) xsDataLabelitMosflmScriptsOutput = self.parseMosflmScriptsOutput(strLabelitMosflmScriptsOutput) xsDataResultLabelit = XSDataResultLabelit() xsDataResultLabelit.setLabelitScreenOutput(xsDataLabelitScreenOutput) xsDataResultLabelit.setLabelitMosflmScriptsOutput(xsDataLabelitMosflmScriptsOutput) self.setDataOutput(xsDataResultLabelit)
def postProcess(self, _edObject=None): """ Calls the parent preProcess method Checks that the installed 3rd party software is in the list of compatible versions """ EDPluginExecProcess.postProcess(self) EDVerbose.DEBUG("EDPluginExecProcessScript.postProcess") # Tests the compatibles executable versions listCompatibleVersions = self.getListOfCompatibleVersions() if(len(listCompatibleVersions) != 0): bFound = False for compatibleVersion in listCompatibleVersions: bFound = self.findStringInLog(compatibleVersion) if(bFound == True): break if(bFound == False): strErrorMessage = "Plugin not compatible with %s, compatible versions are: %s" % (self.getStringVersion(), self.getCompatibleVersionsStringLine()) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setFailure() if (EDVerbose.isVerboseDebug()): raise RuntimeError, strErrorMessage
def preProcess(self, _edObject=None): """ Loads the ISPyB execution plugin and prepares the input data """ EDPluginControl.preProcess(self, _edObject) EDVerbose.DEBUG("EDPluginControlISPyBv1_1.preProcess...") if (self.hasDataInput("shortComments")): self.__strShortComments = self.getDataInput("shortComments")[0].getValue() if (self.hasDataInput("comments")): self.__strComments = self.getDataInput("comments")[0].getValue() if (self.hasDataInput("statusMessage")): self.__strStatusMessage = self.getDataInput("statusMessage")[0].getValue() self.m_edPluginExecISPyB = self.loadPlugin(self.m_edStringPluginExecISPyBName) from EDHandlerXSDataISPyBv1_2 import EDHandlerXSDataISPyBv1_2 xsDataInputISPyB = None xsDataISPyBImage = None try: xsDataISPyBScreening = EDHandlerXSDataISPyBv1_2.generateXSDataISPyBScreening(self.getDataInput(), self.__strShortComments, self.__strComments) xsDataISPyBScreeningInput = EDHandlerXSDataISPyBv1_2.generateXSDataISPyBScreeningInput(self.getDataInput()) xsDataISPyBScreeningOutputContainer = EDHandlerXSDataISPyBv1_2.generateXSDataISPyBScreeningOutputContainer(self.getDataInput(), self.__strStatusMessage) if (xsDataISPyBScreening.getDataCollectionId() is None): xsDataISPyBImage = EDHandlerXSDataISPyBv1_2.generateXSDataISPyBImage(self.getDataInput()) except Exception, error: # This exception handling needs to be rethought, see bug #43. errorMessage = EDMessage.ERROR_DATA_HANDLER_02 % ("EDPluginControlISPyBv1_1.preProcess: Unexpected error in ISPyB handler: ", error) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage
def createDataInputCharacterisationFromDataFiles(self, _pyListXSDataFile): """ This method takes as input a list of paths to XML data files. It parses these files and create a single XSDataInputCharacterisation object. """ EDVerbose.DEBUG("EDPluginControlCCP4iv1_1.createDataInputCharacterisationFromDataFiles") xsDataInputCharacterisation = None for xsDataInputFile in _pyListXSDataFile: try: pyStrInputFileContent = EDUtilsFile.readFile(xsDataInputFile.getPath().getValue()) xsDataInputCharacterisationCurrent = XSDataInputCharacterisation.parseString(pyStrInputFileContent) except Exception, detail: errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlCCP4iv1_1.preProcess', 'EDPluginControlCCP4iv1_1', detail) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage if (xsDataInputCharacterisationCurrent is None): errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlCCP4iv1_1.preProcess', 'EDPluginControlCCP4iv1_1', "None data collection") EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage else: # Instantiate the xsDataInputCharacterisation object if it's not already done. if (xsDataInputCharacterisation is None): xsDataInputCharacterisation = XSDataInputCharacterisation() xsDataInputCharacterisation.setDataCollection(xsDataInputCharacterisationCurrent.getDataCollection())
def configure(self): """ Gets the dbserver parameters from the config file and stores them in class member attributes. """ EDPluginExec.configure(self) pluginConfiguration = self.getConfiguration() if(pluginConfiguration == None): EDVerbose.DEBUG("*** EDPluginISPyBv1_2.configure: pluginConfiguration is None, using default settings") else: EDVerbose.DEBUG("*** EDPluginISPyBv1_2.configure: pluginConfiguration found, using settings from there") strDbserverHost = EDConfiguration.getStringParamValue(pluginConfiguration, "dbserverHost") if(strDbserverHost == None): strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ("EDPluginISPyBv1_2.configure", self.getClassName(), \ "Configuration parameter missing: dbserverHost") EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage else: self.setDbserverHost(strDbserverHost) strDbserverPort = EDConfiguration.getStringParamValue(pluginConfiguration, "dbserverPort") if(strDbserverPort == None): strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ("EDPluginISPyBv1_2.configure", self.getClassName(), \ "Configuration parameter missing: dbserverPort") EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage else: self.setDbserverPort(int (strDbserverPort))
def setPluginInput(self, _edPlugin): _edPlugin.setDataInput(XSDataInputXAFSDataBatchProcessing()) xsDataInputSpline = XSDataInputSpline() if (self.__fRbkg): xsDataInputSpline.setRbkg(XSDataFloat(self.__fRbkg)) _edPlugin.getDataInput().setSplineDataInput(xsDataInputSpline) xsDataInputFFTF = XSDataInputFFTF() if (self.__fftfKmin): xsDataInputFFTF.setKmin(XSDataFloat(self.__fftfKmin)) if (self.__fftfKmax): xsDataInputFFTF.setKmax(XSDataFloat(self.__fftfKmax)) if (self.__fftfDk): xsDataInputFFTF.setDk(XSDataFloat(self.__fftfDk)) if (self.__fftfKweight): xsDataInputFFTF.setKweight(XSDataFloat(self.__fftfKweight)) _edPlugin.getDataInput().setFftfDataInput(xsDataInputFFTF) if (not self.__strDatasetFileNames is None): try: if (self.__strNxsEnergy and self.__strNxsLnI0It): _edPlugin.readXAFSNexusFiles(self.__strDatasetFileNames, self.__strNxsEnergy, self.__strNxsLnI0It, self.__strNxsScanIndex) except Exception: errorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % ("EDApplicationXAFSBatchProcessing.setPluginInput", self.__strDatasetFileNames) EDVerbose.error(errorMessage) raise RuntimeError, errorMessage
def preProcess(self, _edObject=None): """ Loads the ISPyB execution plugin and prepares the input data """ EDPluginControl.preProcess(self, _edObject) EDVerbose.DEBUG("EDPluginControlISPyBv1_4.preProcess...") if (self.hasDataInput("shortComments")): self.strShortComments = self.getDataInput("shortComments")[0].getValue() if (self.hasDataInput("comments")): self.strComments = self.getDataInput("comments")[0].getValue() if (self.hasDataInput("statusMessage")): self.strStatusMessage = self.getDataInput("statusMessage")[0].getValue() self.edPluginExecISPyB = self.loadPlugin(self.edStringPluginExecISPyBName) try: xsDataInputISPyBStoreScreening = EDHandlerXSDataISPyBv1_4.generateXSDataInputISPyBStoreScreening(self.getDataInput(), self.strStatusMessage, \ self.strShortComments, \ self.strComments) except Exception, error: raise # This exception handling needs to be rethought, see bug #43. errorMessage = "EDPluginControlISPyBv1_4.preProcess: Unexpected error in ISPyB handler: %r" % error EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage
def buildInput(self, _edPlugin=None): """ To be overridden by sub classes. This method should return an XSDataCollection object. """ errorMessage = EDMessage.ERROR_ABSTRACT_METHOD_02 % (self.getPluginName(), 'buildInput') EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage
def preProcess(self, _edObject=None): """ The pre-process of ED Plugin Control DiffractionCT Powder Integration consists in preparing the input data for SPD Cake. and declares the execution plugin as EDPluginFit2DCacke """ EDPluginControl.preProcess(self) EDVerbose.DEBUG("EDPluginControlDCTPowderIntegrationv1_1.preProcess") # Load the execution plugin self.m_edPluginPowderIntegration = self.loadPlugin(self.m_edStringControlledPluginName) #Retrive its'datamodel xsDataInputSPDCake = XSDataInputSPDCake() instrumentParameters = self.getDataInput().getInstrumentParameters() imageParameters = self.getDataInput().getImageParameters() xsDataInputSPDCake.setInputFile(self.getDataInput().getImageFile()) xsDataInputSPDCake.setWavelength(instrumentParameters.get_diffrn_radiation_wavelength()) xsDataInputSPDCake.setSampleToDetectorDistance(instrumentParameters.get_pd_instr_dist_spec_detc()) xsDataInputSPDCake.setAngleOfTilt(imageParameters.get_pd_instr_special_details_tilt_angle()) xsDataInputSPDCake.setTiltRotation(imageParameters.get_pd_instr_special_details_tilt_rotation()) xsDataInputSPDCake.setDarkCurrentImageFile(imageParameters.get_file_correction_image_dark_current()) xsDataInputSPDCake.setFlatFieldImageFile(imageParameters.get_file_correction_image_flat_field()) xsDataInputSPDCake.setSpatialDistortionFile(imageParameters.get_file_correction_spline_spatial_distortion()) # EDVerbose.screen("imageParameters.get_array_element_size_1: %s" % imageParameters.get_array_element_size_1().marshal()) xsDataInputSPDCake.setBeamCentreInPixelsX(XSDataDouble(\ EDUtilsUnit.getSIValue(imageParameters.get_diffrn_detector_element_center_1()) / \ EDUtilsUnit.getSIValue(imageParameters.get_array_element_size_1()))) xsDataInputSPDCake.setBeamCentreInPixelsY(XSDataDouble(\ EDUtilsUnit.getSIValue(imageParameters.get_diffrn_detector_element_center_2()) / \ EDUtilsUnit.getSIValue(imageParameters.get_array_element_size_2()))) xsDataInputSPDCake.setPixelSizeX(imageParameters.get_array_element_size_1()) #imageParameters.get_diffrn_detector_element_center_1()) xsDataInputSPDCake.setPixelSizeY(imageParameters.get_array_element_size_2()) #imageParameters.get_diffrn_detector_element_center_1()) xsDataInputSPDCake.setBufferSizeX(XSDataInteger(2048)) xsDataInputSPDCake.setBufferSizeY(XSDataInteger(2048)) xsDataInputSPDCake.setStartAzimuth(XSDataAngle(0)) xsDataInputSPDCake.setStopAzimuth(XSDataAngle(360)) xsDataInputSPDCake.setStepAzimuth(XSDataAngle(360)) xsDataInputSPDCake.setOutputDirCake(self.getDataInput().getDestinationDir()) xsDataInputSPDCake.setDeleteCorImg(XSDataBoolean(True)) try: self.m_edPluginPowderIntegration.setDataInput(xsDataInputSPDCake) except Exception, error: # This exception handling needs to be rethought, see bug #43. errorMessage = EDMessage.ERROR_DATA_HANDLER_02 % ("EDPluginControlDCTPowderIntegrationv1_1.preProcess: Unexpected error in SPD handler: ", error) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage
def connect(self, _pyClassMethod): """ Connects a signal between an object and a method in an other object. """ if (_pyClassMethod == None): EDVerbose.error("EDSlot.connect: None class method") return self.synchronizeOn() # Block the thread self.__listMethod.append(_pyClassMethod) self.synchronizeOff() # Release the thread
def processCommandLineInputFilePath(self): """ """ EDVerbose.DEBUG("EDApplication.processCommandLineInputFilePath") if (not self.__edCommandLine.existCommand(EDApplication.DATASET_PARAM_LABEL)): EDVerbose.error("No %s command line argument found!" % EDApplication.DATASET_PARAM_LABEL) self.__bIsFailure = True else: self.__strDataInputFilePath = self.getCommandLineArgument(EDApplication.DATASET_PARAM_LABEL) EDVerbose.DEBUG("EDApplication.initApplication : %s = %s" % (EDApplication.DATASET_PARAM_LABEL, self.__strDataInputFilePath))
def preProcess(self, _edObject=None): EDPluginExec.preProcess(self) EDVerbose.DEBUG("*** EDPluginEDFReadHeaderv1_0.preProcess") # Check that the input file is present edStringPathToInputFile = self.getDataInput().getEdfFile().getPath().getValue() if (not os.path.exists(edStringPathToInputFile)): edStringErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", edStringPathToInputFile) EDVerbose.error(edStringErrorMessage) self.addErrorMessage(edStringErrorMessage) raise RuntimeError, edStringErrorMessage
def kill(self): EDVerbose.WARNING("I will kill subprocess %s pid= %s" % (self.__subprocess, self.__iPID)) EDUtilsPlatform.kill(self.__iPID) self.synchronizeOff() self.__strExecutionStatus = "timeout" EDVerbose.DEBUG("EDPluginExecProcess.process ========================================= ERROR! ================") errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginExecProcess.process', self.getClassName(), "Timeout ") EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage
def processCommandLinePluginName(self): """ """ EDVerbose.DEBUG("EDApplication.processCommandLinePluginName") if (not self.__edCommandLine.existCommand(EDApplication.PLUGIN_PARAM_LABEL)): EDVerbose.error("No %s command line argument found!" % EDApplication.PLUGIN_PARAM_LABEL) self.__bIsFailure = True else: self.__strPluginName = self.getCommandLineArgument(EDApplication.PLUGIN_PARAM_LABEL) EDVerbose.DEBUG("EDApplication.processCommandLinePluginName : %s = %s" % (EDApplication.PLUGIN_PARAM_LABEL, self.__strPluginName))
def processCommandLineItems(self, _strCommandLineItem): if(_strCommandLineItem == EDApplicationDimplev0.TEMPLATE_PARAM_LABEL): self.bTemplateMode = True self.strGeneratedTemplateFile = self.getCommandLineArgument(EDApplicationDimplev0.TEMPLATE_PARAM_LABEL) if (self.strGeneratedTemplateFile == None): strErrorMessage = EDMessage.ERROR_MANDATORY_PARAM_MISSING_02 % ("EDApplicationDimplev0.processCommandLineItems", "No argument for command line %s key word found!" % \ EDApplicationDimplev0.TEMPLATE_PARAM_LABEL) EDVerbose.error(strErrorMessage) return False if (not os.path.isabs(self.strGeneratedTemplateFile)): self.strGeneratedTemplateFile = os.path.abspath(os.path.join(self.getCurrentWorkingDirectory(), self.strGeneratedTemplateFile))
def preProcess(self, _edObject=None): EDPluginExec.preProcess(self) EDVerbose.DEBUG("EDPluginCopyExifv1_0.preProcess") self.strInfile = self.getDataInput().getInputImagePath().getPath().getValue() self.strOutfile = self.getDataInput().getOutputImagePath().getPath().getValue() for oneFile in [self.strInfile, self.strOutfile]: if not os.path.isfile(oneFile): strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", oneFile) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage
def doSuccessWaitFile(self, _edPlugin=None): EDVerbose.DEBUG("EDPluginControlID29CreateThumbnailv1_0.doSuccessWaitFile") self.retrieveSuccessMessages(_edPlugin, "EDPluginControlID29CreateThumbnailv1_0.doSuccessWaitFile") # Check that the image is really there # The image is here - make the first thumbnail if not self.__edPluginWaitFile.getDataOutput().getTimedOut().getValue(): self.__edPluginExecThumbnail.connectSUCCESS(self.doSuccessExecThumbnail) self.__edPluginExecThumbnail.connectFAILURE(self.doFailureExecThumbnail) self.__edPluginExecThumbnail.executeSynchronous() else: EDVerbose.error("Time-out while waiting for image!") self.setFailure()
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) strError = self.readProcessErrorLogFile() if((strError is not None) and (strError != "")): pyStrErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginBestv1_1.postProcess', 'EDPluginBestv1_1', strError) EDVerbose.error(pyStrErrorMessage) self.addErrorMessage(pyStrErrorMessage) raise RuntimeError, pyStrErrorMessage outputData = self.getOutputDataFromDNATableFile(os.path.join(self.getWorkingDirectory(), self.getScriptBaseName() + "_dnaTables.xml")) self.setDataOutput(outputData)
def preProcess(self, _edObject=None): EDPluginExecProcessScript.preProcess(self) EDVerbose.DEBUG("EDPluginSPDCakev1_0.preProcess") # Check that the input data and correction images are present xsDataInputSPDCake = self.getDataInput() pathToInputFile = xsDataInputSPDCake.getInputFile().getPath().getValue() if (not os.path.exists(pathToInputFile)): strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pathToInputFile) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage pathToDarkCurrentImageFile = xsDataInputSPDCake.getDarkCurrentImageFile().getPath().getValue() if (not os.path.exists(pathToDarkCurrentImageFile)): strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pathToDarkCurrentImageFile) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage pathToFlatFieldImageFile = xsDataInputSPDCake.getFlatFieldImageFile().getPath().getValue() if (not os.path.exists(pathToFlatFieldImageFile)): strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pathToFlatFieldImageFile) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage pathToSpatialDistortionFile = xsDataInputSPDCake.getSpatialDistortionFile().getPath().getValue() if (not os.path.exists(pathToSpatialDistortionFile)): strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pathToSpatialDistortionFile) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage if xsDataInputSPDCake.getOutputDir() is not None: self.outputDir = xsDataInputSPDCake.getOutputDir().getPath().getValue() if not os.path.isdir(self.outputDir): os.makedirs(self.outputDir) self.generateSPDCommand()
def getReferenceDataOutputFile(self, _strDataOutputKey=None): """ Returns the data input file """ strReferenceDataOutputFile = None strDataOutputKey = _strDataOutputKey if (strDataOutputKey is None): strDataOutputKey = self._strDefaultOutputDataKey if (strDataOutputKey in self._dictStrReferenceDataOutputFiles.keys()): strReferenceDataOutputFile = self._dictStrReferenceDataOutputFiles[ strDataOutputKey ] else: strErrorMessage = "ERROR: " + str(self.__class__) + ".getReferenceDataOutputFile, no data output file defined for key: " + strDataOutputKey EDVerbose.error(strErrorMessage) raise RuntimeError, strErrorMessage return strReferenceDataOutputFile
def preProcess(self, _edObject=None): EDPluginExecProcessScript.preProcess(self) EDVerbose.DEBUG("EDPluginExecSaxsAddMetadatav1_0.preProcess") self.strImage = self.getDataInput().getInputImage().getPath().getValue() if not os.path.isfile(self.strImage): strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", self.strImage) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage if self.getDataInput().getKey() is not None: self.strKey = self.getDataInput().getKey().getValue() if self.getDataInput().getValue() is not None: self.strValue = self.getDataInput().getValue().getValue() self.generateEdfheaderaddkey2DCommands()
def configure(self): EDPluginExecProcessScript.configure(self) EDVerbose.DEBUG("EDPluginControlLabelitv10.configure") xsPluginItem = self.getConfiguration() if (xsPluginItem == None): EDVerbose.warning("EDPluginControlLabelitv10.configure: No Labelit plugin item defined.") xsPluginItem = XSPluginItem() strPathToLabelitSetpathScript = EDConfiguration.getStringParamValue(xsPluginItem, self.strCONF_PATH_TO_LABELIT_SETPATH_SCRIPT) if(strPathToLabelitSetpathScript == None): errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlLabelitv10.configure', self.getClassName(), "Configuration parameter missing: " + self.strCONF_PATH_TO_LABELIT_SETPATH_SCRIPT) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage else: self.setPathToLabelitSetpathScript(strPathToLabelitSetpathScript)
def postProcess(self, _edObject=None): EDPluginExecProcessScript.postProcess(self) strError = self.readProcessErrorLogFile() if((strError is not None) and (strError != "")): strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginMxv1ParamsToXMLv1_0.postProcess', 'EDPluginMxv1ParamsToXMLv1_0', strError) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage # This should work as long as there is a single output, i.e. not a list: strFilePath = os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName()) xsDataFileResult = XSDataFile() xsDataFileResult.setPath(XSDataString(strFilePath)) # Do not specify name of output here: self.setDataOutput(xsDataFileResult)
def finallyProcess(self, _edObject=None): EDPluginExecProcessScript.finallyProcess(self) EDVerbose.DEBUG("EDPluginBestv1_2.finallyProcess") strError = self.readProcessErrorLogFile() if((strError is not None) and (strError != "")): strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginBestv1_2.postProcess', 'EDPluginBestv1_2', strError) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setDataOutput(XSDataResultBest()) self.setFailure() else: xsDataResultBest = self.getOutputDataFromDNATableFile(EDUtilsPath.mergePath(self.getWorkingDirectory(), self.getScriptBaseName() + "_dnaTables.xml")) xsDataFilePathToLog = XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName()))) xsDataResultBest.setPathToLogFile(xsDataFilePathToLog) self.setDataOutput(xsDataResultBest)
def createPlugin(self): """ Creates a plugin instance """ edPlugin = None exceptionObject = None try: edFactoryPlugin = EDFactoryPlugin() edPlugin = edFactoryPlugin.loadPlugin(self.getPluginName()) except ImportError(exceptionObject): strWarningMessage = "Could not create the plugin: %s, reason: %s" % (self.getPluginName(), exceptionObject) EDVerbose.WARNING(strWarningMessage) if edPlugin is None: if exceptionObject is None: EDVerbose.error("EDTestCasePlugin.createPlugin: Could not create plugin: " + self.getPluginName()) return edPlugin
def getXSDataResultCharacterisation(self, _strListOfOutputFiles): listResult = _strListOfOutputFiles.split() # Search for the outputfile xsDataResultCharacterisation = None strPathToXSDataResultCharacteristion = None for strLine in listResult: if (strLine.find("dataOutput.xml") != -1): strPathToXSDataResultCharacteristion = strLine if (strPathToXSDataResultCharacteristion is not None): xsDataResultCharacterisation = XSDataResultCharacterisation.parseFile(strPathToXSDataResultCharacteristion) else: errorMessage = EDMessage.ERROR_DATA_HANDLER_02 % ("EDPluginControlInterfaceToMXCuBEv1_2.getXSDataResultCharacterisation", "Cannot find dataOutput.xml file in %s" % _strListOfOutputFiles) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage return xsDataResultCharacterisation
def postProcess(self, _edObject=None): """ Parses the labelit.screen log file and the generated MOSFLM script """ EDPluginLabelitv1_1.postProcess(self, _edObject) EDVerbose.DEBUG("EDPluginLabelitDistlv1_1.postProcess") strLabelitDistlLog = self.readProcessLogFile() if (strLabelitDistlLog is None): strErrorMessage = "EDPluginLabelitDistlv1_1.postProcess : Could not read the Labelit log file" EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setFailure() else: xsDataImageQualityIndicators = self.parseLabelitDistlOutput(strLabelitDistlLog) xsDataImage = self.getDataInput("referenceImage")[0] xsDataImageQualityIndicators.setImage(xsDataImage) self.setDataOutput(xsDataImageQualityIndicators, "imageQualityIndicators")
class EDPluginControlKappaStrategyv2_0(EDPluginControl): """ The Plugin that controls the strategy step """ def __init__(self): EDPluginControl.__init__(self) #self.setXSDataInputClass(EDList) self.setRequiredToHaveConfiguration(True) self.strPluginRaddoseName = "EDPluginRaddosev10" self.edPluginRaddose = None self.edHandlerXSDataRaddose = None self.strPluginBestName = "EDPluginBestv1_2" self.edPluginBest = None from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2 self.edHandlerXSDataBest = EDHandlerXSDataBestv1_2() self.strPluginAlignmentName = "EDPluginSTACAlignmentv2_0" self.edPluginAlignment = None self.edHandlerXSDataAlignment = None self.strPluginKappaStrategyName = "EDPluginSTACStrategyv2_0" self.edPluginKappaStrategy = None self.edHandlerXSDataKappaStrategy = None self.setXSDataInputClass(XSDataInputStrategy, "mxv1InputStrategy") EDFactoryPluginStatic.loadModule("XSDataMXv2") import XSDataMXv2 self.setXSDataInputClass(XSDataMXv2.XSDataCollection, "mxv2DataCollection") import XSDataMXv1 self.setXSDataInputClass(XSDataMXv1.XSDataIndexingResult, "mxv1IndexingResult") #disable kappa by default self.KappaStrategy = 0 self.strCONF_SYMOP_HOME = "symopHome" # Default value for the location of the symop table self.strSymopHome = os.path.normpath("/opt/pxsoft/ccp4-6.0.2/lib/data") self.xsDataSampleCopy = None # For default chemical composition self.fAverageAminoAcidVolume = 135.49 self.fAverageCrystalSolventContent = 0.47 self.fAverageSulfurContentPerAminoacid = 0.05 self.fAverageSulfurConcentration = 314 def setSymopHome(self, _strSymopHome): self.strSymopHome = _strSymopHome def getSymopHome(self): return self.strSymopHome def preProcess(self, _edObject=None): """ Gets the Configuration Parameters, if found, overrides default parameters """ EDPluginControl.preProcess(self, _edObject) EDVerbose.DEBUG("EDPluginControlKappaStrategyv2_0.preProcess...") self.edPluginRaddose = None xsDataSampleCrystalMM = self.getDataInput( "mxv1InputStrategy")[0].getSample() if (xsDataSampleCrystalMM is None): self.xsDataSampleCopy = XSDataSampleCrystalMM() else: strXmlStringDataSample = xsDataSampleCrystalMM.marshal() self.xsDataSampleCopy = XSDataSampleCrystalMM.parseString( strXmlStringDataSample) xsDataCrystal = self.getDataInput( "mxv1InputStrategy")[0].getCrystalRefined() if (xsDataCrystal is not None): self.xsDataSampleCopy.setCrystal(xsDataCrystal) # Raddose is enabled only if the beam flux is set if (self.getDataInput("mxv1InputStrategy") [0].getExperimentalCondition().getBeam().getFlux() is None): strWarningMessage = EDMessage.WARNING_CANNOT_USE_PLUGIN_03 % ( 'EDPluginControlKappaStrategyv2_0.preProcess', self.strPluginRaddoseName, "Beam Flux not set") EDVerbose.warning(strWarningMessage) self.addWarningMessage(strWarningMessage) else: self.edPluginRaddose = self.loadPlugin(self.strPluginRaddoseName) if (self.edPluginRaddose is not None): EDVerbose.DEBUG( "EDPluginControlKappaStrategyv2_0.preProcess: " + self.strPluginRaddoseName + " Found... setting Data Input") strFileSymop = os.path.join(self.getSymopHome(), "symop.lib") xsDataStringSpaceGroup = self.getDataInput( "mxv1InputStrategy")[0].getDiffractionPlan( ).getForcedSpaceGroup() # Space Group has been forced # Prepare chemical composition calculation with the forced Space Group (Space Group Name) strNumOperators = None strSpaceGroup = None if (xsDataStringSpaceGroup is not None): strSpaceGroup = xsDataStringSpaceGroup.getValue() EDVerbose.DEBUG( "EDPluginControlKappaStrategyv2_0.preProcess: Forced Space Group Found: " + strSpaceGroup) try: strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName( strSpaceGroup, strFileSymop) except Exception, detail: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ( 'EDPluginControlKappaStrategyv2_0.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage # Space Group has NOT been forced else: xsDataStringSpaceGroup = self.xsDataSampleCopy.getCrystal( ).getSpaceGroup().getName() if (xsDataStringSpaceGroup is not None): # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group Name) strSpaceGroup = self.xsDataSampleCopy.getCrystal( ).getSpaceGroup().getName().getValue() EDVerbose.DEBUG( "EDPluginControlKappaStrategyv2_0.preProcess: Space Group IT Name found by indexing: " + strSpaceGroup) try: strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName( strSpaceGroup, strFileSymop) except Exception, detail: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ( 'EDPluginControlKappaStrategyv2_0.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage else: # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group IT number) dSpaceGroupITNumber = self.xsDataSampleCopy.getCrystal( ).getSpaceGroup().getITNumber().getValue() EDVerbose.DEBUG( "EDPluginControlKappaStrategyv2_0.preProcess: Space Group IT Number Found by indexing: %d" % dSpaceGroupITNumber) try: strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupITNumber( str(dSpaceGroupITNumber), strFileSymop) except Exception, detail: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ( 'EDPluginControlKappaStrategyv2_0.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage
def process(self, _edObject=None): EDPluginExec.process(self) EDVerbose.DEBUG("EDPluginExecReadImageHeaderMARCCDv10.process") xsDataInputReadImageHeader = self.getDataInput() xsDataFile = xsDataInputReadImageHeader.getImage() strPath = xsDataFile.getPath().getValue() dictMARCCDHeader = self.readHeaderMarccd(strPath) if (dictMARCCDHeader is None): strErrorMessage = "EDPluginExecReadImageHeaderMARCCDv10.process : Cannot read header : %s" % strPath EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setFailure() else: xsDataExperimentalCondition = XSDataExperimentalCondition() xsDataDetector = XSDataDetector() iNoPixelsX = int(dictMARCCDHeader["nslow"]) iNoPixelsY = int(dictMARCCDHeader["nfast"]) xsDataDetector.setNumberPixelX(XSDataInteger(iNoPixelsX)) xsDataDetector.setNumberPixelY(XSDataInteger(iNoPixelsY)) fPixelSizeX = float(dictMARCCDHeader["pixelsize_x"]) / 1000.0 xsDataDetector.setPixelSizeX(XSDataLength(fPixelSizeX)) fPixelSizeY = float(dictMARCCDHeader["pixelsize_y"]) / 1000.0 xsDataDetector.setPixelSizeY(XSDataLength(fPixelSizeY)) fBeamPositionX = float(dictMARCCDHeader["beam_x"]) / 1000.0 fBeamPositionY = float(dictMARCCDHeader["beam_y"]) / 1000.0 # Fix for bug 397 - check if the beam position is close to the centre of the image fTwoTheta = float(dictMARCCDHeader["end_twotheta"]) / 1000.0 xsDataDetector.setTwoTheta(XSDataAngle(fTwoTheta)) if (abs(fTwoTheta) < 0.1): if (abs(fBeamPositionX / (fPixelSizeX / 1000.0) - iNoPixelsX / 2.0) > (2 * iNoPixelsX)): fBeamPositionX = fBeamPositionX * fPixelSizeX / 1000.0 fBeamPositionY = fBeamPositionY * fPixelSizeY / 1000.0 xsDataDetector.setBeamPositionX(XSDataLength(fBeamPositionX)) xsDataDetector.setBeamPositionY(XSDataLength(fBeamPositionY)) fDistance = float(dictMARCCDHeader["xtal_to_detector"]) / 1000.0 if (abs(fDistance) < 0.1): fDistanceStart = float( dictMARCCDHeader["start_xtal_to_detector"]) / 1000.0 fDistanceEnd = float( dictMARCCDHeader["end_xtal_to_detector"]) / 1000.0 if (abs(fDistanceStart - fDistanceEnd) < 0.1): fDistance = fDistanceStart else: # Somethings very wrong with the distances... strErrorMessage = "EDPluginExecReadImageHeaderMARCCDv10.process : Inconsistency in MAR CCD image header: start_xtal_to_detector = %d, end_xtal_to_detector = %d" % \ (fDistanceStart, fDistanceEnd) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setFailure() xsDataDetector.setDistance(XSDataLength(fDistance)) xsDataDetector.setNumberBytesInHeader( XSDataInteger(float(dictMARCCDHeader["header_size"]))) #xsDataDetector.setSerialNumber( XSDataInteger( dictMARCCDHeader[ "DETECTOR_SN" ] ) ) ) #xsDataDetector.setBin( XSDataString( dictMARCCDHeader[ "BIN" ] ) ) ) #xsDataDetector.setDataType( XSDataString( dictMARCCDHeader[ "TYPE" ] ) ) ) #xsDataDetector.setByteOrder( XSDataString( dictMARCCDHeader[ "BYTE_ORDER" ] ) ) ) xsDataDetector.setImageSaturation( XSDataInteger(int(dictMARCCDHeader["saturation_level"]))) # Determine type of detector... if (iNoPixelsX == 2048 and iNoPixelsY == 2048): xsDataDetector.setName(XSDataString("MAR CCD 165")) xsDataDetector.setType(XSDataString("mar165")) elif (iNoPixelsX == 3072 and iNoPixelsY == 3072): xsDataDetector.setName(XSDataString("MAR CCD 225")) xsDataDetector.setType(XSDataString("mar225")) elif (iNoPixelsX == 4096 and iNoPixelsY == 4096): xsDataDetector.setName(XSDataString("MAR CCD 325")) xsDataDetector.setType(XSDataString("mar325")) else: strErrorMessage = EDMessage.ERROR_DATA_HANDLER_02 % ( "EDPluginExecReadImageHeaderMARCCDv10.process", "Unknown detector type") EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage xsDataExperimentalCondition.setDetector(xsDataDetector) # Beam object xsDataBeam = XSDataBeam() xsDataBeam.setWavelength( XSDataWavelength( float(dictMARCCDHeader["source_wavelength"]) / 100000.0)) xsDataBeam.setExposureTime( XSDataTime(float(dictMARCCDHeader["exposure_time"]) / 1000.0)) xsDataExperimentalCondition.setBeam(xsDataBeam) # Goniostat object xsDataGoniostat = XSDataGoniostat() fRotationAxisStart = float(dictMARCCDHeader["start_phi"]) / 1000.0 fOscillationWidth = float( dictMARCCDHeader["rotation_range"]) / 1000.0 xsDataGoniostat.setRotationAxisStart( XSDataAngle(fRotationAxisStart)) xsDataGoniostat.setRotationAxisEnd( XSDataAngle(fRotationAxisStart + fOscillationWidth)) xsDataGoniostat.setOscillationWidth(XSDataAngle(fOscillationWidth)) xsDataExperimentalCondition.setGoniostat(xsDataGoniostat) # Create the image object xsDataImage = XSDataImage() xsDataImage.setPath(XSDataString(strPath)) strTimeStamp = dictMARCCDHeader["acquire_timestamp"] xsDataImage.setDate(XSDataString(strTimeStamp)) iImageNumber = EDUtilsImage.getImageNumber(strPath) xsDataImage.setNumber(XSDataInteger(iImageNumber)) xsDataSubWedge = XSDataSubWedge() xsDataSubWedge.setExperimentalCondition( xsDataExperimentalCondition) xsDataSubWedge.addImage(xsDataImage) self.__xsDataResultReadImageHeader = XSDataResultReadImageHeader() self.__xsDataResultReadImageHeader.setSubWedge(xsDataSubWedge)
errorMessage = EDMessage.ERROR_EXECUTION_03 % ( 'EDPluginControlStrategyv10.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage if (strNumOperators is not None): iNumOperators = int(strNumOperators) else: errorMessage = EDMessage.ERROR_EXECUTION_03 % ( 'EDPluginControlStrategyv10.preProcess', "No symmetry operators found for Space Group: ", strSpaceGroup) EDVerbose.error(errorMessage) self.addErrorMessage(errorMessage) raise RuntimeError, errorMessage xsDataChemicalComposition = self.__xsDataSampleCopy.getChemicalComposition( ) if (xsDataChemicalComposition is None): # create a default chemical composition and assign it to the sample xsDataDefaultChemicalComposition = self.getDefaultChemicalComposition( self.__xsDataSampleCopy, iNumOperators) self.__xsDataSampleCopy.setChemicalComposition( xsDataDefaultChemicalComposition) else: # Check for Sulfur atoms, if none, add native sulfur atoms xsDataUpdatedChemicalComposition = self.updateChemicalComposition(
def preProcess(self, _edObject=None): EDPluginExecProcessScript.preProcess(self) EDVerbose.DEBUG("*** EDPluginFIT2DCakev1_1.preProcess") # Check that the input data and correction images are present xsDataInputFIT2DCake = self.getDataInput() pyStrPathToInputFile = xsDataInputFIT2DCake.getInputFile().getPath().getValue() if (not os.path.exists(pyStrPathToInputFile)): strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pyStrPathToInputFile) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage pyStrPathToDarkCurrentImageFile = xsDataInputFIT2DCake.getDarkCurrentImageFile().getPath().getValue() if (not os.path.exists(pyStrPathToDarkCurrentImageFile)): strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pyStrPathToDarkCurrentImageFile) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage pyStrPathToFlatFieldImageFile = xsDataInputFIT2DCake.getFlatFieldImageFile().getPath().getValue() if (not os.path.exists(pyStrPathToFlatFieldImageFile)): strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pyStrPathToFlatFieldImageFile) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage pyStrPathToSpatialDistortionFile = xsDataInputFIT2DCake.getSpatialDistortionFile().getPath().getValue() if (not os.path.exists(pyStrPathToSpatialDistortionFile)): strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (self.getPluginName() + ".preProcess", pyStrPathToSpatialDistortionFile) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage # Rev 946 ##Generate the image cleaned from the background and flatfield # edfImage=EDF.EdfFile(pyStrPathToInputFile) # npArrayImage=edfImage.GetData(0).astype("float32") # edfDark=EDF.EdfFile(pyStrPathToDarkCurrentImageFile) # Md=edfDark.GetData(0).astype("float32") # edfFlat=EDF.EdfFile( pyStrPathToFlatFieldImageFile ) # Mf=edfFlat.GetData(0).astype("float32") # npaTmp = NP.zeros_like(npArrayImage) # npaNum = NP.maximum(npArrayImage-Md,NP.zeros_like(npArrayImage)) # npaDen = NP.maximum(Mf-Md,NP.ones_like(npArrayImage)) # npaTmp += NP.max( npaDen ) # npaRes = npaTmp * npaNum / npaDen # # edfOutfile=EDF.EdfFile(os.path.join( self.getWorkingDirectory(), "CleanedImage.edf") ) # edfOutfile.WriteImage(edfImage.GetHeader(0), npaRes.astype("uint16"), Append=0) ##End Generate cleaned image #Generate the image cleaned from the background and flatfield edfImage = EDF.EdfFile(pyStrPathToInputFile) npArrayImage = edfImage.GetData(0).astype("float32") edfDark = EDF.EdfFile(pyStrPathToDarkCurrentImageFile) Md = edfDark.GetData(0).astype("float32") edfFlat = EDF.EdfFile(pyStrPathToFlatFieldImageFile) Mf = edfFlat.GetData(0).astype("float32") #npaTmp = NP.zeros_like(npArrayImage) npaNum = npArrayImage - Md npaDen = Mf # npaTmp += NP.max( npaDen ) npaRes = npaNum / npaDen edfOutfile = EDF.EdfFile(os.path.join(self.getWorkingDirectory(), "CleanedImage.edf")) edfOutfile.WriteImage(edfImage.GetHeader(0), npaRes.astype("float32"), Append=0) #End Generate cleaned image self.generateFIT2DCommands()
numpy = EDFactoryPluginStatic.preImport("numpy", numpyPath, _strMethodVersion="__version__") h5py = EDFactoryPluginStatic.preImport("h5py", h5pyPath, _strMethodVersion="version.api_version", _strForceVersion="1.8") Image = EDFactoryPluginStatic.preImport("Image", imagingPath, _strMethodVersion="VERSION") fabio = EDFactoryPluginStatic.preImport("fabio", fabioPath, _strMethodVersion="version") if h5py is None: EDVerbose.error("h5py is None ... please investigate why !!!") EDVerbose.writeErrorTrace() # raise ImportError("EDPluginHDF5 cannot work without h5py !!!") if "EDNA_SITE" not in os.environ: os.environ["EDNA_SITE"] = "edna-site" class EDPluginHDF5(EDPlugin): """ This is a common part for all EDNA plugin writing HDF5. most methods are class methods """ __semCls = Semaphore() __dictHDF5 = {} #key: filename, value: hdf5 h5py objects __dictLock = {} #key: filename, value:semaphores for writing __bConfigured = False
def preProcess(self, _edObject=None): """ Gets the Configuration Parameters, if found, overrides default parameters """ EDPluginControl.preProcess(self, _edObject) EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess...") self._edPluginRaddose = None xsDataSampleCrystalMM = self.getDataInput().getSample() if(xsDataSampleCrystalMM is None): self._xsDataSampleCopy = XSDataSampleCrystalMM() else: strXmlStringDataSample = xsDataSampleCrystalMM.marshal() self._xsDataSampleCopy = XSDataSampleCrystalMM.parseString(strXmlStringDataSample) xsDataCrystal = self.getDataInput().getCrystalRefined() if(xsDataCrystal is not None): self._xsDataSampleCopy.setCrystal(xsDataCrystal) # Load the Best plugin self._edPluginBest = self.loadPlugin(self._strPluginBestName) self._edPluginBest.setBaseDirectory(self.getWorkingDirectory()) self._edPluginBest.setBaseName(self._strPluginBestName) # Load the plot gle plugin self._edPluginPlotGle = self.loadPlugin(self._strPluginPlotGleName) # Check if radiation damage estimation is required or not in the diffraction plan xsDataDiffractionPlan = self.getDataInput().getDiffractionPlan() if xsDataDiffractionPlan is not None: if xsDataDiffractionPlan.getEstimateRadiationDamage(): if xsDataDiffractionPlan.getEstimateRadiationDamage().getValue(): # Yes, is requested self._bEstimateRadiationDamage = True else: # No, is explicitly not requested self._bEstimateRadiationDamage = False elif xsDataDiffractionPlan.getStrategyOption() is not None: if xsDataDiffractionPlan.getStrategyOption().getValue().find("-DamPar") != -1: # The "-DamPar" option requires estimation of radiation damage self._bEstimateRadiationDamage = True # Check if we know what to do with radiation damage if self._bEstimateRadiationDamage is None: # "Force" the estimation of radiation damage if the flux is present if self.getDataInput().getExperimentalCondition().getBeam().getFlux() is None: strWarningMessage = "EDPluginControlStrategyv1_2: Missing flux input - cannot estimate radiation damage." EDVerbose.WARNING(strWarningMessage) self.addWarningMessage(strWarningMessage) self._bEstimateRadiationDamage = False else: self._bEstimateRadiationDamage = True if self._bEstimateRadiationDamage: if self.getDataInput().getExperimentalCondition().getBeam().getFlux() is None: strErrorMessage = "EDPluginControlStrategyv1_2: Missing flux input. Cannot estimate radiation damage" EDVerbose.ERROR(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setFailure() if not self.isFailure(): self._edPluginRaddose = self.loadPlugin(self._strPluginRaddoseName) if (self._edPluginRaddose is not None): EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: " + self._strPluginRaddoseName + " Found... setting Data Input") strFileSymop = os.path.join(self.getSymopHome(), "symop.lib") xsDataStringSpaceGroup = self.getDataInput().getDiffractionPlan().getForcedSpaceGroup() # Space Group has been forced # Prepare chemical composition calculation with the forced Space Group (Space Group Name) bSpaceGroupForced = False if(xsDataStringSpaceGroup is not None): strSpaceGroup = xsDataStringSpaceGroup.getValue().upper().replace(" ", "") if strSpaceGroup != "": EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: Forced Space Group Found: " + strSpaceGroup) try: strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(strSpaceGroup, strFileSymop) bSpaceGroupForced = True except Exception, detail: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv1_2.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage if not bSpaceGroupForced: # Space Group has NOT been forced xsDataStringSpaceGroup = self._xsDataSampleCopy.getCrystal().getSpaceGroup().getName() if (xsDataStringSpaceGroup is not None): # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group Name) strSpaceGroupName = self._xsDataSampleCopy.getCrystal().getSpaceGroup().getName().getValue() EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: Space Group IT Name found by indexing: " + strSpaceGroupName) try: strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(strSpaceGroupName, strFileSymop) except Exception, detail: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv1_2.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage else: # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group IT number) iSpaceGroupITNumber = self._xsDataSampleCopy.getCrystal().getSpaceGroup().getITNumber().getValue() EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: Space Group IT Number Found by indexing: %d" % iSpaceGroupITNumber) try: strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupITNumber(str(iSpaceGroupITNumber), strFileSymop) except Exception, detail: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv1_2.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage
def preProcess(self): """ Creates the application working directory (log dir) Initializes the configuration retrieves the plugin xml data to be passed to the plugin """ EDVerbose.DEBUG("EDApplication.preProcess") self.processCommandline() if (not self.__bIsFailure): # Check that the plugin can be located strPluginLocation = EDFactoryPluginStatic.getFactoryPlugin( ).getModuleLocation(self.__strPluginName) if (strPluginLocation is None): EDVerbose.error("Plugin %s cannot be loaded!" % self.__strPluginName) self.__bIsFailure = True # Check that the input file can be read if (self.getDataInputFilePath() is not None) and ( not os.path.exists(self.__strDataInputFilePath)): EDVerbose.error("Input XML file not found : %s" % self.__strDataInputFilePath) self.__bIsFailure = True # Check that the output file can be created if (self.__strDataOutputFilePath is not None): strOutputDirectory = os.path.dirname( self.__strDataOutputFilePath) if (strOutputDirectory is None or strOutputDirectory == ""): strOutputDirectory = os.getcwd() self.__strDataOutputFilePath = os.path.join( strOutputDirectory, self.__strDataOutputFilePath) if (not os.access(strOutputDirectory, os.W_OK)): EDVerbose.error("Output directory not writable: %s" % strOutputDirectory) self.__bIsFailure = True elif (os.path.exists(self.__strDataOutputFilePath)): if (not os.access(self.__strDataOutputFilePath, os.W_OK)): EDVerbose.error("Output file not writable: %s" % self.__strDataOutputFilePath) self.__bIsFailure = True if (not self.__bIsFailure): EDVerbose.DEBUG("EDApplication.PLUGIN_PARAM_LABEL: " + EDApplication.PLUGIN_PARAM_LABEL) if self.__strConfigurationFileName is not None: # Load the configuration file if (os.path.exists(self.__strConfigurationFileName)): EDVerbose.screen("Loading Configuration file: %s" % self.__strConfigurationFileName) EDConfigurationStatic.addConfigurationFile( self.__strConfigurationFileName, _bReplace=True) else: EDVerbose.warning("Cannot find configuration file: %s" % self.__strConfigurationFileName) pyDictionary = {} pyDictionary["${EDNA_HOME}"] = EDUtilsPath.getEdnaHome() if self.getDataInputFilePath() is not None: self.__strXMLData = EDUtilsFile.readFileAndParseVariables( self.getDataInputFilePath(), pyDictionary) # Create the application working directory if (self.__strWorkingDir is None): self.__strWorkingDir = self.__strApplicationInstanceName self.createApplicationWorkingDirectory()
def process(self, _edObject=None): EDPluginExec.process(self) EDVerbose.DEBUG("EDPluginExecReadImageHeaderPilatus6Mv10.process") xsDataInputReadImageHeader = self.getDataInput() xsDataFile = xsDataInputReadImageHeader.getImage() strPath = xsDataFile.getPath().getValue() dictPilatus6MHeader = self.readHeaderPilatus6M(strPath) if (dictPilatus6MHeader is None): strErrorMessage = "EDPluginExecReadImageHeaderPilatus6Mv10.process : Cannot read header : %s" % strPath EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setFailure() else: xsDataExperimentalCondition = XSDataExperimentalCondition() xsDataDetector = XSDataDetector() iNoPixelsX = 2463 iNoPixelsY = 2527 xsDataDetector.setNumberPixelX(XSDataInteger(iNoPixelsX)) xsDataDetector.setNumberPixelY(XSDataInteger(iNoPixelsY)) # Pixel size listPixelSizeXY = dictPilatus6MHeader[ "Pixel_size" ].split(" ") fPixelSizeX = float(listPixelSizeXY[0]) * 1000 xsDataDetector.setPixelSizeX(XSDataLength(fPixelSizeX)) fPixelSizeY = float(listPixelSizeXY[3]) * 1000 xsDataDetector.setPixelSizeY(XSDataLength(fPixelSizeY)) # Beam position listBeamPosition = dictPilatus6MHeader["Beam_xy"].replace("(", " ").replace(")", " ").replace(",", " ").split() fBeamPositionX = float(listBeamPosition[1]) * fPixelSizeX fBeamPositionY = float(listBeamPosition[0]) * fPixelSizeY xsDataDetector.setBeamPositionX(XSDataLength(fBeamPositionX)) xsDataDetector.setBeamPositionY(XSDataLength(fBeamPositionY)) fDistance = float(dictPilatus6MHeader[ "Detector_distance" ].split(" ")[0]) * 1000 xsDataDetector.setDistance(XSDataLength(fDistance)) # xsDataDetector.setNumberBytesInHeader(XSDataInteger(float(dictPilatus6MHeader[ "header_size" ]))) xsDataDetector.setSerialNumber(XSDataString(dictPilatus6MHeader[ "Detector:" ])) # #xsDataDetector.setBin( XSDataString( dictPilatus6MHeader[ "BIN" ] ) ) ) # #xsDataDetector.setDataType( XSDataString( dictPilatus6MHeader[ "TYPE" ] ) ) ) # #xsDataDetector.setByteOrder( XSDataString( dictPilatus6MHeader[ "BYTE_ORDER" ] ) ) ) # xsDataDetector.setImageSaturation(XSDataInteger(int(dictPilatus6MHeader[ "saturation_level" ]))) xsDataDetector.setName(XSDataString("PILATUS 6M")) xsDataDetector.setType(XSDataString("pilatus6m")) xsDataExperimentalCondition.setDetector(xsDataDetector) # Beam object xsDataBeam = XSDataBeam() xsDataBeam.setWavelength(XSDataWavelength(float(dictPilatus6MHeader[ "Wavelength" ].split(" ")[0]))) xsDataBeam.setExposureTime(XSDataTime(float(dictPilatus6MHeader[ "Exposure_time" ].split(" ")[0]))) xsDataExperimentalCondition.setBeam(xsDataBeam) # Goniostat object xsDataGoniostat = XSDataGoniostat() fRotationAxisStart = float(dictPilatus6MHeader[ "Start_angle" ].split(" ")[0]) fOscillationWidth = float(dictPilatus6MHeader[ "Angle_increment" ].split(" ")[0]) xsDataGoniostat.setRotationAxisStart(XSDataAngle(fRotationAxisStart)) xsDataGoniostat.setRotationAxisEnd(XSDataAngle(fRotationAxisStart + fOscillationWidth)) xsDataGoniostat.setOscillationWidth(XSDataAngle(fOscillationWidth)) xsDataExperimentalCondition.setGoniostat(xsDataGoniostat) # # Create the image object xsDataImage = XSDataImage() xsDataImage.setPath(XSDataString(strPath)) if "DateTime" in dictPilatus6MHeader: strTimeStamp = dictPilatus6MHeader[ "DateTime" ] xsDataImage.setDate(XSDataString(strTimeStamp)) iImageNumber = EDUtilsImage.getImageNumber(strPath) xsDataImage.setNumber(XSDataInteger(iImageNumber)) xsDataSubWedge = XSDataSubWedge() xsDataSubWedge.setExperimentalCondition(xsDataExperimentalCondition) xsDataSubWedge.addImage(xsDataImage) self.__xsDataResultReadImageHeader = XSDataResultReadImageHeader() self.__xsDataResultReadImageHeader.setSubWedge(xsDataSubWedge)
def preProcess(self, _edObject=None): """ Gets the Configuration Parameters, if found, overrides default parameters """ EDPluginControl.preProcess(self, _edObject) EDVerbose.DEBUG("EDPluginControlKappaStrategyv2_0.preProcess...") self.edPluginRaddose = None xsDataSampleCrystalMM = self.getDataInput( "mxv1InputStrategy")[0].getSample() if (xsDataSampleCrystalMM is None): self.xsDataSampleCopy = XSDataSampleCrystalMM() else: strXmlStringDataSample = xsDataSampleCrystalMM.marshal() self.xsDataSampleCopy = XSDataSampleCrystalMM.parseString( strXmlStringDataSample) xsDataCrystal = self.getDataInput( "mxv1InputStrategy")[0].getCrystalRefined() if (xsDataCrystal is not None): self.xsDataSampleCopy.setCrystal(xsDataCrystal) # Raddose is enabled only if the beam flux is set if (self.getDataInput("mxv1InputStrategy") [0].getExperimentalCondition().getBeam().getFlux() is None): strWarningMessage = EDMessage.WARNING_CANNOT_USE_PLUGIN_03 % ( 'EDPluginControlKappaStrategyv2_0.preProcess', self.strPluginRaddoseName, "Beam Flux not set") EDVerbose.warning(strWarningMessage) self.addWarningMessage(strWarningMessage) else: self.edPluginRaddose = self.loadPlugin(self.strPluginRaddoseName) if (self.edPluginRaddose is not None): EDVerbose.DEBUG( "EDPluginControlKappaStrategyv2_0.preProcess: " + self.strPluginRaddoseName + " Found... setting Data Input") strFileSymop = os.path.join(self.getSymopHome(), "symop.lib") xsDataStringSpaceGroup = self.getDataInput( "mxv1InputStrategy")[0].getDiffractionPlan( ).getForcedSpaceGroup() # Space Group has been forced # Prepare chemical composition calculation with the forced Space Group (Space Group Name) strNumOperators = None strSpaceGroup = None if (xsDataStringSpaceGroup is not None): strSpaceGroup = xsDataStringSpaceGroup.getValue() EDVerbose.DEBUG( "EDPluginControlKappaStrategyv2_0.preProcess: Forced Space Group Found: " + strSpaceGroup) try: strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName( strSpaceGroup, strFileSymop) except Exception, detail: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ( 'EDPluginControlKappaStrategyv2_0.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage # Space Group has NOT been forced else: xsDataStringSpaceGroup = self.xsDataSampleCopy.getCrystal( ).getSpaceGroup().getName() if (xsDataStringSpaceGroup is not None): # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group Name) strSpaceGroup = self.xsDataSampleCopy.getCrystal( ).getSpaceGroup().getName().getValue() EDVerbose.DEBUG( "EDPluginControlKappaStrategyv2_0.preProcess: Space Group IT Name found by indexing: " + strSpaceGroup) try: strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName( strSpaceGroup, strFileSymop) except Exception, detail: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ( 'EDPluginControlKappaStrategyv2_0.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage else: # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group IT number) dSpaceGroupITNumber = self.xsDataSampleCopy.getCrystal(
def set(self, value=0, filename="test.edf", position=(0, 0)): """ This is the set method that will first ensure that the data are available #then set a lock on it and finally #No more write the data #before unlocking. #No more @param: value value of the pixel to set @type value: probably float but can be any figure @param filename: name of the file to be processed @type filename: string @param position: the position of the pixel to modify @type position: 2-tuple of integers """ if not isinstance(value, float): EDVerbose.error("ERROR The value %s is not a float" % value) raise Exception("ERROR The value %s is not a float" % value) if not (isinstance(filename, str) or isinstance(filename, unicode)): EDVerbose.error("ERROR The filename variable %s is not a string " % filename) raise Exception("ERROR The filename variable %s is not a string " % filename) if not isinstance(position, tuple): EDVerbose.error("ERROR The position variable %s is not a tuple " % position) raise Exception("ERROR The position variable %s is not a tuple " % position) if len(position) != 2: EDVerbose.error("ERROR in the size of the position-tuple") raise Exception("ERROR in the size of the position-tuple") if position[0] < 0: EDVerbose.error("ERROR in the X part of the position-tuple") raise Exception("ERROR in the X part of the position-tuple") if position[1] < 0: EDVerbose.error("ERROR in the Y part of the position-tuple") raise Exception("ERROR in the Y part of the position-tuple") if not self.data.has_key(filename): EDVerbose.warning( "ERROR, the destination image %s is not in the list of images tracked : %s" % (filename, self.data.keys())) pystrDirname, pystrFilename = os.path.split(filename) fileInDir = [] for onefile in os.listdir(pystrDirname): if onefile.find("%sSize" % pystrFilename) == 0: if onefile[-4:].lower() == ".edf": XxY = onefile.split("Size")[-1][:-4] try: size = tuple( [int(i) for i in tuple(XxY.split("x"))]) except Exception: size = None if size: fileInDir.append(onefile) if len(fileInDir) > 1: EDVerbose.warning( "ERROR, for %s, I found too many images corresponding to what you are looking for : %s" % (filename, fileInDir)) raise Exception( "ERROR, I found too many images corresponding to what you are looking for : %s" % (filename, fileInDir)) elif len(fileInDir) == 1: EDVerbose.warning( "WARNING, As The file %s exists, I will try to read it. The expected size is %s" % (filename, size)) self.size[filename] = size fullFilename = "%sSize%ix%i.edf" % ((filename, ) + size) self.headers[filename] = {} self.data[filename] = numpy.zeros(size, dtype="float32") self.synchronizeOn() try: self.edf[filename] = EdfFile(fullFilename) self.headers[filename] = self.edf[filename].GetHeader(0) self.data[filename] = self.edf[filename].GetData(0) except Exception: EDVerbose.warning( "ERROR in reading file %s: Reintializing it" % filename) self.edf[filename] = EdfFile(fullFilename) self.data[filename] = numpy.zeros(size, dtype="float32") self.headers[filename] = {} self.synchronizeOff() if self.data[filename].shape != size: self.data[filename] = numpy.zeros(size, dtype="float32") self.headers[filename] = {} else: EDVerbose.error( "ERROR, the destination image %s is not in the list of images tracked : %s" % (filename, self.data.keys())) raise Exception( "ERROR, the destination image %s is not in the list of images tracked : %s" % (filename, self.data.keys())) if position[0] > self.data[filename].shape[0]: EDVerbose.error( "ERROR in the X part of the position-tuple: too large %i > %i" % (position[0], npArray.shape[0])) raise Exception( "ERROR in the X part of the position-tuple: too large %i > %i" % (position[0], npArray.shape[0])) if position[1] > self.data[filename].shape[1]: EDVerbose.error( "ERROR in the Y part of the position-tuple: too large %i > %i" % (position[1], npArray.shape[1])) raise Exception( "ERROR in the Y part of the position-tuple: too large %i > %i" % (position[1], npArray.shape[1])) self.data[filename][position[0], position[1]] = value self.synchronizeOn() try: self.edf[filename].WriteImage(self.headers[filename], self.data[filename], Append=0) except Exception: EDVerbose.error("ERROR in writing image %s at position %s" % (filename, position)) self.synchronizeOff()
class EDPluginControlStrategyv1_2(EDPluginControl): """ The Plugin that controls the strategy step """ def __init__ (self): """ """ EDPluginControl.__init__(self) self.setXSDataInputClass(XSDataInputStrategy) self._strPluginRaddoseName = "EDPluginRaddosev10" self._edPluginRaddose = None self._edHandlerXSDataRaddose = None self._strPluginBestName = "EDPluginBestv1_2" self._edPluginBest = None self._edHandlerXSDataBest = None self._strPluginPlotGleName = "EDPluginExecPlotGlev1_0" self._edPluginPlotGle = None self._strCONF_SYMOP_HOME = "symopHome" # Default value for the location of the symop table self._strSymopHome = None self._xsDataSampleCopy = None # For default chemical composition self._fAverageAminoAcidVolume = 135.49 self._fAverageCrystalSolventContent = 0.47 self._fAverageSulfurContentPerAminoacid = 0.05 self._fAverageSulfurConcentration = 314 # This varaible determines if Raddose should be executed or not self._bEstimateRadiationDamage = None # Raddose log file self.xsDataFileRaddoseLog = None def setSymopHome(self, _strSymopHome): self._strSymopHome = _strSymopHome def getSymopHome(self): return self._strSymopHome def preProcess(self, _edObject=None): """ Gets the Configuration Parameters, if found, overrides default parameters """ EDPluginControl.preProcess(self, _edObject) EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess...") self._edPluginRaddose = None xsDataSampleCrystalMM = self.getDataInput().getSample() if(xsDataSampleCrystalMM is None): self._xsDataSampleCopy = XSDataSampleCrystalMM() else: strXmlStringDataSample = xsDataSampleCrystalMM.marshal() self._xsDataSampleCopy = XSDataSampleCrystalMM.parseString(strXmlStringDataSample) xsDataCrystal = self.getDataInput().getCrystalRefined() if(xsDataCrystal is not None): self._xsDataSampleCopy.setCrystal(xsDataCrystal) # Load the Best plugin self._edPluginBest = self.loadPlugin(self._strPluginBestName) self._edPluginBest.setBaseDirectory(self.getWorkingDirectory()) self._edPluginBest.setBaseName(self._strPluginBestName) # Load the plot gle plugin self._edPluginPlotGle = self.loadPlugin(self._strPluginPlotGleName) # Check if radiation damage estimation is required or not in the diffraction plan xsDataDiffractionPlan = self.getDataInput().getDiffractionPlan() if xsDataDiffractionPlan is not None: if xsDataDiffractionPlan.getEstimateRadiationDamage(): if xsDataDiffractionPlan.getEstimateRadiationDamage().getValue(): # Yes, is requested self._bEstimateRadiationDamage = True else: # No, is explicitly not requested self._bEstimateRadiationDamage = False elif xsDataDiffractionPlan.getStrategyOption() is not None: if xsDataDiffractionPlan.getStrategyOption().getValue().find("-DamPar") != -1: # The "-DamPar" option requires estimation of radiation damage self._bEstimateRadiationDamage = True # Check if we know what to do with radiation damage if self._bEstimateRadiationDamage is None: # "Force" the estimation of radiation damage if the flux is present if self.getDataInput().getExperimentalCondition().getBeam().getFlux() is None: strWarningMessage = "EDPluginControlStrategyv1_2: Missing flux input - cannot estimate radiation damage." EDVerbose.WARNING(strWarningMessage) self.addWarningMessage(strWarningMessage) self._bEstimateRadiationDamage = False else: self._bEstimateRadiationDamage = True if self._bEstimateRadiationDamage: if self.getDataInput().getExperimentalCondition().getBeam().getFlux() is None: strErrorMessage = "EDPluginControlStrategyv1_2: Missing flux input. Cannot estimate radiation damage" EDVerbose.ERROR(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setFailure() if not self.isFailure(): self._edPluginRaddose = self.loadPlugin(self._strPluginRaddoseName) if (self._edPluginRaddose is not None): EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: " + self._strPluginRaddoseName + " Found... setting Data Input") strFileSymop = os.path.join(self.getSymopHome(), "symop.lib") xsDataStringSpaceGroup = self.getDataInput().getDiffractionPlan().getForcedSpaceGroup() # Space Group has been forced # Prepare chemical composition calculation with the forced Space Group (Space Group Name) bSpaceGroupForced = False if(xsDataStringSpaceGroup is not None): strSpaceGroup = xsDataStringSpaceGroup.getValue().upper().replace(" ", "") if strSpaceGroup != "": EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: Forced Space Group Found: " + strSpaceGroup) try: strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(strSpaceGroup, strFileSymop) bSpaceGroupForced = True except Exception, detail: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv1_2.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage if not bSpaceGroupForced: # Space Group has NOT been forced xsDataStringSpaceGroup = self._xsDataSampleCopy.getCrystal().getSpaceGroup().getName() if (xsDataStringSpaceGroup is not None): # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group Name) strSpaceGroupName = self._xsDataSampleCopy.getCrystal().getSpaceGroup().getName().getValue() EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: Space Group IT Name found by indexing: " + strSpaceGroupName) try: strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupName(strSpaceGroupName, strFileSymop) except Exception, detail: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv1_2.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage else: # Prepare chemical composition calculation with the Space Group calculated by indexing (Space Group IT number) iSpaceGroupITNumber = self._xsDataSampleCopy.getCrystal().getSpaceGroup().getITNumber().getValue() EDVerbose.DEBUG("EDPluginControlStrategyv1_2.preProcess: Space Group IT Number Found by indexing: %d" % iSpaceGroupITNumber) try: strNumOperators = EDUtilsSymmetry.getNumberOfSymmetryOperatorsFromSpaceGroupITNumber(str(iSpaceGroupITNumber), strFileSymop) except Exception, detail: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv1_2.preProcess', "Problem to calculate Number of symmetry operators", detail) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage if (strNumOperators is not None): iNumOperators = int(strNumOperators) else: strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginControlStrategyv1_2.preProcess', "No symmetry operators found for Space Group: ", strNumOperators) EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) raise RuntimeError, strErrorMessage xsDataChemicalComposition = self._xsDataSampleCopy.getChemicalComposition() if(xsDataChemicalComposition is None): # create a default chemical composition and assign it to the sample xsDataDefaultChemicalComposition = self.getDefaultChemicalComposition(self._xsDataSampleCopy, iNumOperators) self._xsDataSampleCopy.setChemicalComposition(xsDataDefaultChemicalComposition) else: # Check for Sulfur atoms, if none, add native sulfur atoms xsDataUpdatedChemicalComposition = self.updateChemicalComposition(xsDataChemicalComposition) self._xsDataSampleCopy.setChemicalComposition(xsDataUpdatedChemicalComposition) # create Data Input for Raddose from EDHandlerXSDataRaddosev10 import EDHandlerXSDataRaddosev10 self._edHandlerXSDataRaddose = EDHandlerXSDataRaddosev10() xsDataBeam = self.getDataInput().getExperimentalCondition().getBeam() # Calculate number of images (MXSUP-1616): iNumberOfImages = None xsDataCollection = self.dataInput.dataCollection if xsDataCollection is not None: iNumberOfImages = 0 for xsDataSubWedge in xsDataCollection.subWedge: xsDataGoniostat = xsDataSubWedge.experimentalCondition.goniostat iOscStart = xsDataGoniostat.rotationAxisStart.value iOscEnd = xsDataGoniostat.rotationAxisEnd.value iOscWidth = xsDataGoniostat.oscillationWidth.value iNumberOfImages += int((iOscEnd-iOscStart)/iOscWidth) if iNumberOfImages is None: iNumberOfImages = 1 self.WARNING("No goniostat information, number of images for RADDOSE set to 1") xsDataRaddoseInput = self._edHandlerXSDataRaddose.getXSDataRaddoseInput(xsDataBeam, self._xsDataSampleCopy, iNumOperators, iNumberOfImages) if xsDataRaddoseInput is not None: self._edPluginRaddose.setDataInput(xsDataRaddoseInput) self._edPluginRaddose.setBaseDirectory(self.getWorkingDirectory()) self._edPluginRaddose.setBaseName(self._strPluginRaddoseName)
""" edTestSuite = None exceptionObject = None try: edTestSuite = EDUtilsTest.getFactoryPluginTest().loadPlugin( _strTestSuiteName) except ImportError, exceptionObject: strWarningMessage = "Could not create the test suite: %s, reason: %s" % ( _strTestSuiteName, exceptionObject) EDVerbose.WARNING(strWarningMessage) self.__dictTestCaseNotExecuted[_strTestSuiteName] = "%s : %s" % ( self.getClassName(), strWarningMessage) if edTestSuite is None: if exceptionObject is None: EDVerbose.error( "EDTestSuitePluginUnit.addTestSuiteFromName: Could not create test suite: " + _strTestSuiteName) self.__dictTestSuiteNotExecuted[ _strTestSuiteName] = "%s : Could not create the test suite" % self.getClassName( ) else: self.__listTestSuite.append(edTestSuite) def processKernel(self): """ This method executes the test suite. """ EDVerbose.DEBUG("Execution: EDTestSuite.processKernel()") EDVerbose.screen("") EDVerbose.screen("") EDVerbose.unitTest(
def preProcess(self, _edObject=None): EDPluginControl.preProcess(self) EDVerbose.DEBUG( "EDPluginControlPyarchThumbnailGeneratorv1_0.preProcess") # Check that the input image exists and is of the expected type strPathToDiffractionImage = self.getDataInput().getDiffractionImage( ).getPath().getValue() strImageFileNameExtension = os.path.splitext( strPathToDiffractionImage)[1] if not strImageFileNameExtension in [ ".img", ".marccd", ".mccd", ".cbf" ]: EDVerbose.error( "Unknown image file name extension for pyarch thumbnail generator: %s" % strPathToDiffractionImage) self.setFailure() else: # Load the waitFile plugin xsDataInputWaitFile = XSDataInputWaitFile() xsDataInputWaitFile.setExpectedSize( XSDataInteger(self.iExpectedSize)) xsDataInputWaitFile.setExpectedFile( self.getDataInput().getDiffractionImage()) if self.getDataInput().getWaitForFileTimeOut(): xsDataInputWaitFile.setTimeOut( self.getDataInput().getWaitForFileTimeOut()) self.edPluginWaitFile = EDPluginWaitFile() self.edPluginWaitFile.setDataInput(xsDataInputWaitFile) # Load the execution plugin self.edPluginExecThumbnail = self.loadPlugin( self.strExecThumbnailPluginName) xsDataInputExecThumbnail = XSDataInputExecThumbnail() xsDataInputExecThumbnail.setInputImagePath( self.getDataInput().getDiffractionImage()) xsDataInputExecThumbnail.setLevelsInvert(XSDataBoolean(True)) xsDataInputExecThumbnail.setLevelsMin(XSDataDoubleWithUnit(0.0)) xsDataDoubleWithUnitLevelsMax = XSDataDoubleWithUnit(99.95) xsDataDoubleWithUnitLevelsMax.setUnit(XSDataString("%")) xsDataInputExecThumbnail.setLevelsMax( xsDataDoubleWithUnitLevelsMax) xsDataInputExecThumbnail.setFilterDilatation([XSDataInteger(4)]) xsDataInputExecThumbnail.setLevelsColorize(XSDataBoolean(False)) xsDataInputExecThumbnail.setThumbHeight(XSDataInteger(1024)) xsDataInputExecThumbnail.setThumbWidth(XSDataInteger(1024)) xsDataInputExecThumbnail.setKeepRatio(XSDataBoolean(False)) # Output path strImageNameWithoutExt = os.path.basename( os.path.splitext(strPathToDiffractionImage)[0]) strImageDirname = os.path.dirname(strPathToDiffractionImage) if self.getDataInput().getForcedOutputDirectory(): strForcedOutputDirectory = self.getDataInput( ).getForcedOutputDirectory().getPath().getValue() if not os.access(strForcedOutputDirectory, os.W_OK): EDVerbose.error( "Cannot write to forced output directory : %s" % strForcedOutputDirectory) self.setFailure() else: self.strOutputPathWithoutExtension = os.path.join( strForcedOutputDirectory, strImageNameWithoutExt) else: # Try to store in the ESRF pyarch directory strOutputDirname = EDHandlerESRFPyarchv1_0.createPyarchFilePath( strImageDirname) # Check that output pyarch path exists and is writeable: bIsOk = False if strOutputDirname: if not os.path.exists(strOutputDirname): # Try to create the directory try: os.makedirs(strOutputDirname) bIsOk = True except BaseException, e: EDVerbose.WARNING( "Couldn't create the directory %s" % strOutputDirname) elif os.access(strOutputDirname, os.W_OK): bIsOk = True if not bIsOk: EDVerbose.warning("Cannot write to pyarch directory: %s" % strOutputDirname) strOutputDirname = tempfile.mkdtemp( "", "EDPluginPyarchThumbnailv10_", "/tmp") EDVerbose.warning("Writing thumbnail images to: %s" % strOutputDirname) self.strOutputPathWithoutExtension = os.path.join( strOutputDirname, strImageNameWithoutExt) self.strOutputPath = os.path.join( self.strOutputPathWithoutExtension + ".jpeg") xsDataInputExecThumbnail.setOutputPath( XSDataFile(XSDataString(self.strOutputPath))) self.edPluginExecThumbnail.setDataInput(xsDataInputExecThumbnail)
class EDTestCasePlugin(EDTestCase): """ This is the main test class to test a plugin (Unit and Execution) """ URL_EDNA_SITE = "http://www.edna-site.org/data/tests/images" def __init__(self, _strPluginName, _strPluginDir=None, _strTestName=None): """ Initialize the test case by determining the paths to the plugin home and plugin test directories. """ EDTestCase.__init__(self, _strTestName) self._edPlugin = None self._strPluginName = _strPluginName self._strPluginHome = EDUtilsTest.getFactoryPluginTest().getModuleLocation(_strPluginName) self._strPluginTestsDataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName()) self._listRequiredConfigurationPluginNames = [] self._strConfigurationFile = None self._oldConfig = None def preProcess(self): # Check if the plugin to be tested requires configuration edPlugin = self.createPlugin() if edPlugin is None: strErr = "Unable to create plugin %s: Check the corresponding module" % self.getPluginName() EDVerbose.ERROR(strErr) raise RuntimeError(strErr) if edPlugin.isRequiredToHaveConfiguration(): self._listRequiredConfigurationPluginNames.append(self.getPluginName()) # Check if the required plugin parameters are available for strPluginName in self._listRequiredConfigurationPluginNames: if self.getPluginConfiguration(strPluginName) is None: EDVerbose.DEBUG("EDTestCasePlugin.preProcess: plugin configuration NOT found for plugin %s" % strPluginName) self.setReasonForNotBeingExectuted("Missing configuration for %s" % strPluginName) else: EDVerbose.DEBUG("EDTestCasePlugin.preProcess: plugin configuration found for plugin %s" % strPluginName) def postProcess(self): EDTestCase.postProcess(self) EDConfigurationStatic.setXSConfigurationItem(self._oldConfig) def getPluginConfiguration(self, _strPluginName=None): # Load the configuration file if provided if _strPluginName is None: strPluginName = self.getPluginName() else: strPluginName = _strPluginName self._oldConfig = EDConfigurationStatic.getXSConfigurationItem(strPluginName) if self._strConfigurationFile is not None: edConfig = EDConfiguration(self._strConfigurationFile) EDConfigurationStatic.setXSConfigurationItem(edConfig.getXSConfigurationItem(strPluginName)) xsConfiguration = EDConfigurationStatic.getXSConfigurationItem(strPluginName) return xsConfiguration def setConfigurationFile(self, _strConfigurationFile): """ Sets the configuration file """ self._strConfigurationFile = _strConfigurationFile def getConfigurationFile(self): """ Returns the configuration file """ return self._strConfigurationFile def setRequiredPluginConfiguration(self, _strPluginName=None): if _strPluginName is None: self._listRequiredConfigurationPluginNames.append(self._strPluginName) else: self._listRequiredConfigurationPluginNames.append(_strPluginName) def createPlugin(self): """ Creates a plugin instance """ edPlugin = None exceptionObject = None try: edFactoryPlugin = EDFactoryPlugin() edPlugin = edFactoryPlugin.loadPlugin(self.getPluginName()) except ImportError, exceptionObject: strWarningMessage = "Could not create the plugin: %s, reason: %s" % (self.getPluginName(), exceptionObject) EDVerbose.WARNING(strWarningMessage) if edPlugin is None: if exceptionObject is None: EDVerbose.error("EDTestCasePlugin.createPlugin: Could not create plugin: " + self.getPluginName()) return edPlugin
def preProcess(self, _edObject=None): """ """ EDPluginExec.preProcess(self) EDVerbose.DEBUG("*** EDPluginDCTWriteSinogramv1_0.preProcess") pyStrPathToInputCIFFile = self.getDataInput().getIntegratedIntensities( ).getPath().getValue() EDVerbose.DEBUG("This is the file which will be analyzed: %s" % pyStrPathToInputCIFFile) self.pystrPathToSinogramsDir = self.getDataInput( ).getSinogramDirectory().getPath().getValue() if not PyOs.path.isdir(self.pystrPathToSinogramsDir): PyOs.makedirs(self.pystrPathToSinogramsDir) self.pystrSinogramPrefix = self.getDataInput( ).getSinogramFileNamePrefix().getValue() EDVerbose.DEBUG( "Now generation of the SinoGrams, Path: %s, Prefix= %s" % (self.pystrPathToSinogramsDir, self.pystrSinogramPrefix)) if (not EDUtilsPath.existPath(pyStrPathToInputCIFFile)): pyStrErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % ( self.getPluginName() + ".preProcess", pyStrPathToInputFile) EDVerbose.error(pyStrErrorMessage) self.addErrorMessage(pyStrErrorMessage) raise RuntimeError, pyStrErrorMessage # File exists, try to read it with the CIF library try: self.m_cifPowderData = CIF() self.m_cifPowderData.loadCIF(pyStrPathToInputCIFFile) EDVerbose.DEBUG("Parsing of the CIF file %s successful" % pyStrPathToInputCIFFile) except Exception: pyStrErrorMessage = EDMessage.ERROR_UNEXPECTED_01 % ( "EDPluginDCTWriteSinogramv1_0.preProcess: Error when trying to read CIF file : %s" % pyStrPathToInputCIFFile) EDVerbose.error(pyStrErrorMessage) self.addErrorMessage(pyStrErrorMessage) # Just raise the exception in order to not loose the error stack trace raise if not self.m_cifPowderData.exists("_tomo_scan_type"): EDVerbose.DEBUG( "How do you want to generate a Sinogram if you are lacking essential things like the scan type !!!!" ) raise self.pydMetaDataEDF = self.m_cifPowderData.copy( ) #This is a simple python dictionary if self.pydMetaDataEDF.has_key("loop_"): self.pydMetaDataEDF.pop("loop_") if self.pydMetaDataEDF.has_key("_synchrotron_photon-flux"): self.pydMetaDataEDF.pop("_synchrotron_photon-flux") if self.pydMetaDataEDF.has_key("_synchrotron_ring-intensity"): self.pydMetaDataEDF.pop("_synchrotron_ring-intensity") if self.pydMetaDataEDF.has_key("_tomo_spec_displ_rotation"): self.pydMetaDataEDF.pop("_tomo_spec_displ_rotation") if self.pydMetaDataEDF.has_key("_tomo_spec_displ_x"): self.pydMetaDataEDF.pop("_tomo_spec_displ_x") if self.pydMetaDataEDF.has_key("_tomo_spec_displ_z"): self.pydMetaDataEDF.pop("_tomo_spec_displ_z") self.powderIntegrator = PowderIntegrator(self.m_cifPowderData) self.pyintXpos, self.pyintYpos = self.powderIntegrator.getSinogramPosition( ) (Xmax, Ymax) = self.powderIntegrator.getSinogramSize() self.pydProcessSinograms = {} for pystrSinogramSuffix in [ "PhotonFlux", "IntegratedRaw", "IntegratedCor" ]: pystrSinogramFullPath = PyOs.path.join( self.pystrPathToSinogramsDir, self.pystrSinogramPrefix + "Sinogram" + pystrSinogramSuffix) self.pydProcessSinograms[ pystrSinogramFullPath] = pystrSinogramSuffix if self.m_cifPowderData.exists("_pd_sum_2theta_range_min"): for basename in ["Raw", "Cor"]: startregion = float( self.m_cifPowderData["_pd_sum_2theta_range_min"]) stopregion = float( self.m_cifPowderData["_pd_sum_2theta_range_max"]) pystrSinogramFilename = "%sSinogramROI%i-%i%s" % ( self.pystrSinogramPrefix, int( round(startregion)), int(round(stopregion)), basename) pystrSinogramFullPath = PyOs.path.join( self.pystrPathToSinogramsDir, pystrSinogramFilename) self.pydProcessSinograms[pystrSinogramFullPath] = [ startregion, stopregion ] else: for oneloop in self.m_cifPowderData["loop_"]: if "_pd_sum_2theta_range_min" in oneloop[0]: for i in oneloop[1]: startregion = float(i["_pd_sum_2theta_range_min"]) stopregion = float(i["_pd_sum_2theta_range_max"]) for basename in ["Raw", "Cor"]: pystrSinogramFilename = "%sSinogramROI%i-%i%s" % ( self.pystrSinogramPrefix, int(round(startregion)), int( round(stopregion)), basename) pystrSinogramFullPath = PyOs.path.join( self.pystrPathToSinogramsDir, pystrSinogramFilename) self.pydProcessSinograms[pystrSinogramFullPath] = [ startregion, stopregion ]
def configure(self): """ Configures the plugin from the configuration file with the following parameters - The shell that will execute the script - Script executor - Script executable to be invoked - Path to CCP4 setup file if required - The 3rd party executable installed version """ EDPluginExec.configure(self) EDVerbose.DEBUG("EDPluginExecProcessXIA2CORE.configure") xsPluginItem = self.getConfiguration() if (xsPluginItem == None): EDVerbose.warning( "EDPluginExecProcessXIA2CORE.configure: No plugin item defined." ) xsPluginItem = XSPluginItem() if (self.getExecutable() is None): strExecutable = EDConfiguration.getStringParamValue( xsPluginItem, EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_EXECUTABLE) if (strExecutable == None): strErrorMessage = "Configuration parameter missing: " + \ EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_EXECUTABLE EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setFailure() if (EDVerbose.isVerboseDebug()): raise RuntimeError, strErrorMessage else: # Check that the executable file exists if (os.path.exists(strExecutable) == False): strErrorMessage = "Cannot find configured " + EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_EXECUTABLE + " : " + strExecutable EDVerbose.error(strErrorMessage) self.addErrorMessage(strErrorMessage) self.setFailure() if (EDVerbose.isVerboseDebug()): raise RuntimeError, strErrorMessage else: self.setExecutable(strExecutable) if (self.getConfigXIA2COREType() is None): strXIA2COREType = EDConfiguration.getStringParamValue( xsPluginItem, EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_XIA2CORE_TYPE) if (strXIA2COREType == None): strErrorMessage = "Configuration parameter not set: " + \ EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_XIA2CORE_TYPE EDVerbose.DEBUG(strErrorMessage) else: # FIXME test that this is a legal name self.__strConfigXIA2COREType = strXIA2COREType strVersion = EDConfiguration.getStringParamValue( xsPluginItem, EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_VERSION_STRING) if (strVersion == None): EDVerbose.DEBUG("EDPluginExecProcessXIA2CORE.configure: No configuration parameter found for: " + \ EDPluginExecProcessXIA2CORE.CONF_EXEC_PROCESS_VERSION_STRING + ", NO default value!") else: self.setStringVersion(strVersion) if (self.__strLogFileName == None): self.setLogFileName(self.getBaseName() + ".log") if (self.__strErrorLogFileName == None): self.setErrorLogFileName(self.getBaseName() + ".err") if self.__strExecutable is None: EDVerbose.ERROR("Executable not defined in configuration file") # shall we raise an exception? self.__strPathToHostNamePidFile = os.path.join( self.getWorkingDirectory(), os.path.basename(self.__strExecutable) + "_hostNamePid.txt") return