def generateXSDataISPyBScreeningInput(_xsDataInputControlISPyB): """ """ EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2") from XSDataISPyBv1_2 import XSDataISPyBScreeningInput from XSDataISPyBv1_2 import XSDataDouble xsDataResultCharacterisation = _xsDataInputControlISPyB.getCharacterisationResult() xsDataISPyBScreeningInput = XSDataISPyBScreeningInput() xsDataCollection = EDHandlerXSDataISPyBv2_0.getDataCollectionFromSuggestedStrategy(xsDataResultCharacterisation) # Data collection information if (xsDataCollection is not None): xsDataSubWedgeList = xsDataCollection.getSubWedge() if (xsDataSubWedgeList is not None): xsDataSubWedgeFirst = xsDataSubWedgeList[0] xsDataExperimentalCondition = xsDataSubWedgeFirst.getExperimentalCondition() if (xsDataExperimentalCondition is not None): xsDataDetector = xsDataExperimentalCondition.getDetector() if (xsDataDetector is not None): fBeamPositionX = xsDataDetector.getBeamPositionX().getValue() fBeamPositionY = xsDataDetector.getBeamPositionY().getValue() xsDataISPyBScreeningInput.setBeamX(XSDataDouble(fBeamPositionX)) xsDataISPyBScreeningInput.setBeamY(XSDataDouble(fBeamPositionY)) return xsDataISPyBScreeningInput
def writeKappaSettings(self): ''' # future version for getting motor positions related to images under processing # checking in order: # - value got as input # - mosflm.descr file in process subdir (if BCM (like mxcube) registered it) # - {imageTemplate}_kappa_settings.xml file (if BCM (like DNA) registered it) # - read it now (and try to register as {imageTemplate}_kappa_settings.xml) # - just use the datum (0,0,0) ''' #code for using a predefined datum (0;0;0) #EDUtilsFile.writeFile( EDDiskExplorer.mergePath( self.getWorkingDirectory(), "DNA_STAC_Kappa_Settings" ), "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><kappa_collect_settings><motorSettings><motorName>Omega</motorName><motorValue>0</motorValue></motorSettings><motorSettings><motorName>Kappa</motorName><motorValue>0.000000</motorValue></motorSettings><motorSettings><motorName>Phi</motorName><motorValue>0</motorValue></motorSettings><motorSettings><motorName>X</motorName><motorValue>0.261444</motorValue></motorSettings><motorSettings><motorName>Y</motorName><motorValue>-0.085559</motorValue></motorSettings><motorSettings><motorName>Z</motorName><motorValue>0.659333</motorValue></motorSettings><comment>BCM query performed by STAC</comment></kappa_collect_settings>") # gonio settings from DC descriptor object EDFactoryPluginStatic.loadModule("XSDataMXv2") #import XSDataMXv2 #dc = XSDataMXv2.XSDataCollection() from XSDataMXv2 import XSDataCollection dc = XSDataCollection() dc = self.getDataInput("dataCollection")[0] omega = dc.getXSSubWedge()[0].getXSRotationalGoniostatSetting().getBaseaxissetting() [kappa, phi] = dc.getXSSubWedge()[0].getXSRotationalGoniostatSetting().getAxissetting() EDUtilsFile.writeFile(os.path.join(self.getWorkingDirectory(), "DNA_STAC_Kappa_Settings"), "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><kappa_collect_settings><motorSettings><motorName>Omega</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>Kappa</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>Phi</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>X</motorName><motorValue>0.261444</motorValue></motorSettings><motorSettings><motorName>Y</motorName><motorValue>-0.085559</motorValue></motorSettings><motorSettings><motorName>Z</motorName><motorValue>0.659333</motorValue></motorSettings><comment>BCM query performed by STAC</comment></kappa_collect_settings>" % (omega.getValue(), kappa.getValue(), phi.getValue())) '''
def generateXSDataISPyBScreeningInput(_xsDataInputControlISPyB): """ """ EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2") from XSDataISPyBv1_2 import XSDataISPyBScreeningInput from XSDataISPyBv1_2 import XSDataDouble xsDataResultCharacterisation = _xsDataInputControlISPyB.getCharacterisationResult( ) xsDataISPyBScreeningInput = XSDataISPyBScreeningInput() # Data collection information xsDataCollection = xsDataResultCharacterisation.getDataCollection() if (xsDataCollection is not None): xsDataSubWedgeList = xsDataCollection.getSubWedge() if (xsDataSubWedgeList is not None): xsDataSubWedgeFirst = xsDataSubWedgeList[0] xsDataExperimentalCondition = xsDataSubWedgeFirst.getExperimentalCondition( ) if (xsDataExperimentalCondition is not None): xsDataDetector = xsDataExperimentalCondition.getDetector() if (xsDataDetector is not None): fBeamPositionX = xsDataDetector.getBeamPositionX( ).getValue() fBeamPositionY = xsDataDetector.getBeamPositionY( ).getValue() xsDataISPyBScreeningInput.setBeamX( XSDataDouble(fBeamPositionX)) xsDataISPyBScreeningInput.setBeamY( XSDataDouble(fBeamPositionY)) return xsDataISPyBScreeningInput
def generateXSDataISPyBImage(_xsDataInputControlISPyB): """ """ EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2") from XSDataISPyBv1_2 import XSDataString from XSDataISPyBv1_2 import XSDataISPyBImage xsDataResultCharacterisationv2_0 = _xsDataInputControlISPyB.getCharacterisationResult() xsDataResultCharacterisation = xsDataResultCharacterisationv2_0.getMxv1ResultCharacterisation() xsDataISPyBImage = None # Find path to first image from data collection information strPathToFirstImage = None xsDataCollection = xsDataResultCharacterisation.getDataCollection() if (xsDataCollection is not None): lXSDataSubWedge = xsDataCollection.getSubWedge() if (lXSDataSubWedge is not None): xsDataSubWedgeFirst = lXSDataSubWedge[0] lXSDataImage = xsDataSubWedgeFirst.getImage() if (lXSDataImage is not None): xsDataImageFirst = lXSDataImage[ 0 ] strPathToFirstImage = xsDataImageFirst.getPath().getValue() # Add an image path if the dataCollectionId is not present... if (strPathToFirstImage is not None): xsDataISPyBImage = XSDataISPyBImage() strImageBaseName = EDUtilsFile.getBaseName(strPathToFirstImage) strDirectoryName = EDUtilsPath.getFolderName(strPathToFirstImage) xsDataISPyBImage.setFileName(XSDataString(strImageBaseName)) xsDataISPyBImage.setFileLocation(XSDataString(strDirectoryName)) return xsDataISPyBImage
def __init__ (self): """ """ EDPluginControl.__init__(self) #self.setXSDataInputClass( XSDataInputCharacterisation ) #self.setXSDataInputClass(EDList) #self.strPluginIndexingName = "EDPluginControlIndexingv2_0" self.strPluginIndexingName = "EDPluginControlIndexingv10" self.edPluginIndexing = None self.strPluginIntegrationName = "EDPluginControlIntegrationv10" self.edPluginIntegration = None self.strPluginStrategyName = "EDPluginControlKappaStrategyv2_0" self.edPluginStrategy = None self.xsDataResultCharacterisationv2_0 = None self.xsDataResultCharacterisation = None self.xsDataInputStrategy = None self.setXSDataInputClass(XSDataInputCharacterisationv2_0) EDFactoryPluginStatic.loadModule("XSDataMXv1") import XSDataMXv1 self.setXSDataInputClass(XSDataMXv1.XSDataInputCharacterisation, "mxv1InputCharacterisation") EDFactoryPluginStatic.loadModule("XSDataMXv2") import XSDataMXv2 self.setXSDataInputClass(XSDataMXv2.XSDataCollection, "mxv2DataCollection")
def preProcess(self, _edPlugin=None): """ This method prepares the input for the CCP4i plugin and loads it. """ EDPluginControl.preProcess(self, _edPlugin) EDVerbose.DEBUG("EDPluginControlInterfaceToMXCuBEv1_2.preProcess...") EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1") from XSDataCCP4iv1_1 import XSDataInputCCP4i xsDataInputCCP4i = XSDataInputCCP4i() xsDataInputMXCuBE = self.getDataInput() xsDataInputCCP4i.setDataSet(xsDataInputMXCuBE.getDataSet()) #xsDataInputCCP4i.setDataFile( xsDataInputMXCuBE.getDataFile() ) xsDataInputCCP4i.setExperimentalCondition(xsDataInputMXCuBE.getExperimentalCondition()) xsDataInputCCP4i.setDiffractionPlan(xsDataInputMXCuBE.getDiffractionPlan()) xsDataInputCCP4i.setSample(xsDataInputMXCuBE.getSample()) self.__edPluginControlCCP4i = self.loadPlugin(self.__strPluginControlCCP4i, "CCP4i") self.__edPluginControlCCP4i.setDataInput(xsDataInputCCP4i) self.__xsDataIntegerDataCollectionId = xsDataInputMXCuBE.getDataCollectionId() if (self.__xsDataIntegerDataCollectionId is not None): self.__edPluginControlISPyB = self.loadPlugin(self.__strPluginControlISPyB, "ISPyB") self.__edPluginExecOutputHTML = self.loadPlugin(self.__strPluginExecOutputHTMLName, "OutputHTML")
def mergeAtomicComposition(self, _xsDataAtomicComposition1, _xsDataAtomicComposition2): EDFactoryPluginStatic.loadModule("XSDataRaddosev10") mergedAtomicComposition = XSDataAtomicComposition() dictionary = {} for atom in _xsDataAtomicComposition2.getAtom(): dictionary[atom.getSymbol().getValue()] = atom.getNumberOf().getValue() for atom1 in _xsDataAtomicComposition1.getAtom(): symbol = atom1.getSymbol().getValue() if (self.exists(symbol, _xsDataAtomicComposition2) == True): mergedAtom = XSDataAtom() mergedAtom.setNumberOf(XSDataDouble(atom1.getNumberOf().getValue() + dictionary[symbol])) mergedAtom.setSymbol(XSDataString(symbol)) mergedAtomicComposition.addAtom(mergedAtom) else: mergedAtomicComposition.addAtom(atom1) for atom2 in _xsDataAtomicComposition2.getAtom(): symbol = atom2.getSymbol().getValue() if (self.exists(symbol, _xsDataAtomicComposition1) == False): mergedAtomicComposition.addAtom(atom2) return mergedAtomicComposition
def generateXSDataISPyBImage(_xsDataInputControlISPyB): """ """ EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2") from XSDataISPyBv1_2 import XSDataString from XSDataISPyBv1_2 import XSDataISPyBImage xsDataResultCharacterisation = _xsDataInputControlISPyB.getCharacterisationResult( ) xsDataISPyBImage = None # Find path to first image from data collection information strPathToFirstImage = None xsDataCollection = xsDataResultCharacterisation.getDataCollection() if (xsDataCollection is not None): lXSDataSubWedge = xsDataCollection.getSubWedge() if (lXSDataSubWedge is not None): xsDataSubWedgeFirst = lXSDataSubWedge[0] lXSDataImage = xsDataSubWedgeFirst.getImage() if (lXSDataImage is not None): xsDataImageFirst = lXSDataImage[0] strPathToFirstImage = xsDataImageFirst.getPath().getValue() # Add an image path if the dataCollectionId is not present... if (strPathToFirstImage is not None): xsDataISPyBImage = XSDataISPyBImage() strImageBaseName = EDUtilsFile.getBaseName(strPathToFirstImage) strDirectoryName = EDUtilsPath.getFolderName( strPathToFirstImage) xsDataISPyBImage.setFileName(XSDataString(strImageBaseName)) xsDataISPyBImage.setFileLocation( XSDataString(strDirectoryName)) return xsDataISPyBImage
def testGenerateXSDataInputBestv1_2( self, _strFileNameXSDataInputStrategy_reference, _strFileNameXSDataInputBest_reference): """ This method is testing the generation of the XSDataInputBest object given a XSDataIndexingStrategy object. """ strReferenceInputFile = os.path.join( self.strDataPath, _strFileNameXSDataInputStrategy_reference) strPath = os.path.join(self.strDataPath, strReferenceInputFile) from XSDataMXv1 import XSDataInputStrategy xsDataInputStrategy = XSDataInputStrategy.parseFile(strPath) from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2 edHandlerXSDataBestv1_2 = EDHandlerXSDataBestv1_2() xsDataInputBestv1_2 = edHandlerXSDataBestv1_2.getXSDataInputBest( xsDataInputStrategy) strReferencePath = os.path.join(self.strDataPath, _strFileNameXSDataInputBest_reference) strXMLInputBestReference = EDUtilsTest.readAndParseFile( strReferencePath) EDFactoryPluginStatic.loadModule("XSDataBestv1_2") from XSDataBestv1_2 import XSDataInputBest xsDataInputBestReference = XSDataInputBest.parseString( strXMLInputBestReference) EDAssert.equal(xsDataInputBestReference.marshal(), xsDataInputBestv1_2.marshal())
def generateXSDataISPyBScreening(_xsDataInputControlISPyB, _strShortComments=None, _strComments=None): """ """ EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2") from XSDataISPyBv1_2 import XSDataString from XSDataISPyBv1_2 import XSDataISPyBScreening xsDataIntegerDataCollectionId = _xsDataInputControlISPyB.getDataCollectionId( ) # General information xsDataISPyBScreening = XSDataISPyBScreening() xsDataISPyBScreening.setProgramVersion(XSDataString("EDNA MXv1")) pyStrTimeStamp = time.strftime("%Y-%m-%d %H:%M:%S") xsDataISPyBScreening.setTimeStamp(XSDataString(pyStrTimeStamp)) if (not _strShortComments is None): xsDataISPyBScreening.setShortComments( XSDataString(_strShortComments)) if (not _strComments is None): xsDataISPyBScreening.setComments(XSDataString(_strComments)) # Use dataCollectionId if provided in the input if (xsDataIntegerDataCollectionId is not None): xsDataISPyBScreening.setDataCollectionId( xsDataIntegerDataCollectionId) return xsDataISPyBScreening
def __init__(self): """ """ EDPluginControl.__init__(self) #self.setXSDataInputClass( XSDataInputCharacterisation ) #self.setXSDataInputClass(EDList) #self.strPluginIndexingName = "EDPluginControlIndexingv2_0" self.strPluginIndexingName = "EDPluginControlIndexingv10" self.edPluginIndexing = None self.strPluginIntegrationName = "EDPluginControlIntegrationv10" self.edPluginIntegration = None self.xsDataResultCharacterisationv2_0 = None self.xsDataResultCharacterisation = None self.xsDataInputStrategy = None self.setXSDataInputClass(XSDataInputCharacterisationv2_0) EDFactoryPluginStatic.loadModule("XSDataMXv1") import XSDataMXv1 self.setXSDataInputClass(XSDataMXv1.XSDataInputCharacterisation, "mxv1InputCharacterisation") EDFactoryPluginStatic.loadModule("XSDataMXv2") import XSDataMXv2 self.setXSDataInputClass(XSDataMXv2.XSDataCollection, "mxv2DataCollection")
def testCreateOutputFileDictionary(self): strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(), "XSDataResultCCP4i_reference.xml") strXML = self.readAndParseFile(strPathToCCP4iResult) EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1") from XSDataCCP4iv1_1 import XSDataResultCCP4i xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML) xsDataStringListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles( ) pluginMXCuBE = self.createPlugin() pluginMXCuBE.configure() strResultCharacterisationFileName = "XSDataResultCharacterisation_reference.xml" strPathToReferenceFile = os.path.join( self.getPluginTestsDataHome(), strResultCharacterisationFileName) strXML = self.readAndParseFile(strPathToReferenceFile) xsDataResultCharacterisation = XSDataResultCharacterisation.parseString( strXML) strDNAFileDirectoryPath = pluginMXCuBE.createDNAFileDirectoryPath( xsDataResultCharacterisation) pluginMXCuBE.createDNAFileDirectory(strDNAFileDirectoryPath) xsDataDictionary = pluginMXCuBE.createOutputFileDictionary( xsDataStringListOfOutputFiles, xsDataResultCharacterisation, strDNAFileDirectoryPath) EDAssert.equal(False, xsDataDictionary is None) shutil.rmtree(strDNAFileDirectoryPath)
def testGenerateXSDataInputISPyB(self): """ This method is testing the generation of the XSDataInputISPyB object given a XSDataIndexingInput object. """ strReferenceInputControlISPyBFile = EDUtilsPath.mergePath( self.strDataPath, "XSDataInputControlISPyB_reference.xml") strPath = os.path.join(self.strDataPath, strReferenceInputControlISPyBFile) strXMLIndexingInput = self.readAndParseFile(strPath) from XSDataMXv1 import XSDataInputControlISPyB xsDataInputControlISPyB = XSDataInputControlISPyB.parseString( strXMLIndexingInput) from EDHandlerXSDataISPyBv1_1 import EDHandlerXSDataISPyBv1_1 xsDataInputISPyB = EDHandlerXSDataISPyBv1_1.generateXSDataInputISPyB( xsDataInputControlISPyB) strReferenceInputISPyBFile = EDUtilsPath.mergePath( self.strDataPath, "XSDataInputISPyB_reference.xml") strReferencePath = os.path.join(self.strDataPath, strReferenceInputISPyBFile) strXMLInputISPyBReference = self.readAndParseFile(strReferencePath) EDFactoryPluginStatic.loadModule("XSDataISPyBv1_1") from XSDataISPyBv1_1 import XSDataInputISPyB xsDataInputISPyBReference = XSDataInputISPyB.parseString( strXMLInputISPyBReference) # Remove the time strings since they otherwise make the test fail xsDataInputISPyBReference.getScreening().setTimeStamp(None) xsDataInputISPyB.getScreening().setTimeStamp(None) EDAssert.equal(xsDataInputISPyBReference.marshal(), xsDataInputISPyB.marshal())
def writeKappaSettings(self): ''' # future version for getting motor positions related to images under processing # checking in order: # - value got as input # - mosflm.descr file in process subdir (if BCM (like mxcube) registered it) # - {imageTemplate}_kappa_settings.xml file (if BCM (like DNA) registered it) # - read it now (and try to register as {imageTemplate}_kappa_settings.xml) # - just use the datum (0,0,0) ''' #code for using a predefined datum (0;0;0) #EDUtilsFile.writeFile( EDDiskExplorer.mergePath( self.getWorkingDirectory(), "DNA_STAC_Kappa_Settings" ), "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><kappa_collect_settings><motorSettings><motorName>Omega</motorName><motorValue>0</motorValue></motorSettings><motorSettings><motorName>Kappa</motorName><motorValue>0.000000</motorValue></motorSettings><motorSettings><motorName>Phi</motorName><motorValue>0</motorValue></motorSettings><motorSettings><motorName>X</motorName><motorValue>0.261444</motorValue></motorSettings><motorSettings><motorName>Y</motorName><motorValue>-0.085559</motorValue></motorSettings><motorSettings><motorName>Z</motorName><motorValue>0.659333</motorValue></motorSettings><comment>BCM query performed by STAC</comment></kappa_collect_settings>") # gonio settings from DC descriptor object EDFactoryPluginStatic.loadModule("XSDataMXv2") #import XSDataMXv2 #dc = XSDataMXv2.XSDataCollection() from XSDataMXv2 import XSDataCollection dc = XSDataCollection() dc = self.getDataInput("dataCollection")[0] omega = dc.getXSSubWedge()[0].getXSRotationalGoniostatSetting( ).getBaseaxissetting() [kappa, phi] = dc.getXSSubWedge()[0].getXSRotationalGoniostatSetting( ).getAxissetting() EDUtilsFile.writeFile( os.path.join(self.getWorkingDirectory(), "DNA_STAC_Kappa_Settings"), "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><kappa_collect_settings><motorSettings><motorName>Omega</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>Kappa</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>Phi</motorName><motorValue>%e</motorValue></motorSettings><motorSettings><motorName>X</motorName><motorValue>0.261444</motorValue></motorSettings><motorSettings><motorName>Y</motorName><motorValue>-0.085559</motorValue></motorSettings><motorSettings><motorName>Z</motorName><motorValue>0.659333</motorValue></motorSettings><comment>BCM query performed by STAC</comment></kappa_collect_settings>" % (omega.getValue(), kappa.getValue(), phi.getValue())) '''
def mergeAtomicComposition(self, _xsDataAtomicComposition1, _xsDataAtomicComposition2): EDFactoryPluginStatic.loadModule("XSDataRaddosev10") mergedAtomicComposition = XSDataAtomicComposition() dictionary = {} for atom in _xsDataAtomicComposition2.getAtom(): dictionary[ atom.getSymbol().getValue()] = atom.getNumberOf().getValue() for atom1 in _xsDataAtomicComposition1.getAtom(): symbol = atom1.getSymbol().getValue() if (self.exists(symbol, _xsDataAtomicComposition2) == True): mergedAtom = XSDataAtom() mergedAtom.setNumberOf( XSDataDouble(atom1.getNumberOf().getValue() + dictionary[symbol])) mergedAtom.setSymbol(XSDataString(symbol)) mergedAtomicComposition.addAtom(mergedAtom) else: mergedAtomicComposition.addAtom(atom1) for atom2 in _xsDataAtomicComposition2.getAtom(): symbol = atom2.getSymbol().getValue() if (self.exists(symbol, _xsDataAtomicComposition1) == False): mergedAtomicComposition.addAtom(atom2) return mergedAtomicComposition
def __init__(self): """ """ EDPluginExecProcessScript.__init__(self) EDFactoryPluginStatic.loadModule("XSDataMXv1") EDFactoryPluginStatic.loadModule("XSDataMXv2") from XSDataMXv2 import XSDataCollection self.setXSDataInputClass(XSDataCollection, "dataCollection") self.__pyStrBCMDEF = None
def __init__(self, _strNameOfPlugin): EDPlugin.__init__(self) self.__strNameOfPlugin = _strNameOfPlugin EDFactoryPluginStatic.loadModule(_strNameOfPlugin) self.__dictXMLDataInput = {} self.__dictXMLDataOutput = {} self.__strPythonWrapperScriptName = "pluginWrapperForJobScheduler.py" self.__strPathToPythonWrapper = None self.__edServerXMLRCP = EDServerXMLRCP.getInstance() self.__edServerXMLRCP.registerPlugin(self) self.__bFinished = False
def __init__(self): """ """ EDPluginSTACv2_0.__init__(self) EDFactoryPluginStatic.loadModule("XSDataMXv1") EDFactoryPluginStatic.loadModule("XSDataBestv1_2") from XSDataMXv1 import XSDataIndexingResult from XSDataBestv1_2 import XSDataInputBest self.setXSDataInputClass(XSDataInputBest, "inputBest") self.setXSDataInputClass(XSDataIndexingResult, "indexingResult") from XSDataMXv1 import XSDataString self.setXSDataInputClass(XSDataString, "KappaStrategyOption")
def testGenerateXSDataInputISPyB(self): """ This method is testing the generation of the XSDataInputISPyB object given a XSDataIndexingInput object. """ strReferenceInputControlISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputControlISPyB_reference.xml") strPath = os.path.join(self.strDataPath, strReferenceInputControlISPyBFile) strXMLIndexingInput = EDUtilsFile.readFileAndParseVariables(strPath, self.dictReplace) xsDataInputControlISPyB = XSDataInputControlISPyB.parseString(strXMLIndexingInput) xsDataInputISPyB = EDHandlerXSDataISPyBv1_4.generateXSDataInputISPyBStoreScreening(xsDataInputControlISPyB) strReferenceInputISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputISPyB_reference.xml") strReferencePath = os.path.join(self.strDataPath, strReferenceInputISPyBFile) strXMLInputISPyBReference = EDUtilsFile.readFileAndParseVariables(strReferencePath, self.dictReplace) EDFactoryPluginStatic.loadModule("XSDataISPyBv1_4")
def testGetXSDataResultCharacterisation(self): strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(), "XSDataResultCCP4i_reference.xml") strXML = self.readAndParseFile(strPathToCCP4iResult) EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1") from XSDataCCP4iv1_1 import XSDataResultCCP4i xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML) strListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles().getValue() pluginMXCuBE = self.createPlugin() xsDataResultCharacterisation = pluginMXCuBE.getXSDataResultCharacterisation(strListOfOutputFiles) strPathToResultCharacterisationReference = os.path.join(self.getPluginTestsDataHome(), "EDPluginControlCharacterisationv1_1_dataOutput.xml") xsDataResultCharacterisationReference = XSDataResultCharacterisation.parseFile(strPathToResultCharacterisationReference) EDAssert.equal(xsDataResultCharacterisationReference.marshal(), xsDataResultCharacterisation.marshal())
def testGenerateXSDataInputISPyB(self): """ This method is testing the generation of the XSDataInputISPyB object given a XSDataIndexingInput object. """ strReferenceInputControlISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputControlISPyB_reference.xml") strPath = os.path.join(self.strDataPath, strReferenceInputControlISPyBFile) strXMLIndexingInput = EDUtilsFile.readFileAndParseVariables(strPath, self.dictReplace) xsDataInputControlISPyB = XSDataInputControlISPyB.parseString(strXMLIndexingInput) xsDataInputISPyB = EDHandlerXSDataISPyBv1_3.generateXSDataInputISPyBStoreScreening(xsDataInputControlISPyB) print xsDataInputISPyB.marshal() strReferenceInputISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputISPyB_reference.xml") strReferencePath = os.path.join(self.strDataPath, strReferenceInputISPyBFile) strXMLInputISPyBReference = EDUtilsFile.readFileAndParseVariables(strReferencePath, self.dictReplace) EDFactoryPluginStatic.loadModule("XSDataISPyBv1_3")
def testGenerateXSDataMOSFLMInputIntegration(self): strFilename = "XSDataIntegrationInput_reference.xml" strPath = os.path.join(self.m_strDataPath, strFilename) strXMLIntegrationInput = EDUtilsTest.readAndParseFile(strPath) from XSDataMXv1 import XSDataIntegrationInput xsDataIntegrationInput = XSDataIntegrationInput.parseString(strXMLIntegrationInput) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataMOSFLMInputIntegration = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIntegration(xsDataIntegrationInput) strReferenceFilename = "XSDataMOSFLMInputIntegration_reference.xml" strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename) strXMLIntegrationInputReference = EDUtilsTest.readAndParseFile(strReferencePath) EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10") from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration xsDataMOSFLMInputIntegrationReference = XSDataMOSFLMInputIntegration.parseString(strXMLIntegrationInputReference) EDAssert.equal(xsDataMOSFLMInputIntegrationReference.marshal(), xsDataMOSFLMInputIntegration.marshal())
def testGenerateXSDataIndexingResult(self): """ This method tests the generation of an XSDataIndexingResult object given an XSDataResultLabelit object. """ strPath = os.path.join(self.strDataPath, self.strReferenceOutputFile) strXMLResultLabelit = EDUtilsTest.readAndParseFile(strPath) EDFactoryPluginStatic.loadModule("XSDataLabelitv10") from XSDataLabelitv10 import XSDataResultLabelit xsDataResultLabelit = XSDataResultLabelit.parseString(strXMLResultLabelit) from EDHandlerXSDataLabelitv10 import EDHandlerXSDataLabelitv10 xsDataIndexingResult = EDHandlerXSDataLabelitv10.generateXSDataIndexingResult(xsDataResultLabelit) strReferencePath = os.path.join(self.strDataPath, "XSDataIndexingResult_reference.xml") strIndexingResultReferenceXML = EDUtilsTest.readAndParseFile(strReferencePath) from XSDataMXv1 import XSDataIndexingResult xsDataIndexingResultReference = XSDataIndexingResult.parseString(strIndexingResultReferenceXML) EDAssert.equal(xsDataIndexingResultReference.marshal(), xsDataIndexingResult.marshal())
def testGenerateXSDataInputLabelit(self, _strFileNameXSDataIndexingInput_reference, _strFileNameXSDataLabelitInput_reference): """ This method is testing the generation of the XSDataInputLabelit object given a XSDataIndexingInput object. """ strPath = os.path.join(self.strDataPath, _strFileNameXSDataIndexingInput_reference) strXMLIndexingInput = EDUtilsTest.readAndParseFile(strPath) from XSDataMXv1 import XSDataIndexingInput xsDataIndexingInput = XSDataIndexingInput.parseString(strXMLIndexingInput) from EDHandlerXSDataLabelitv10 import EDHandlerXSDataLabelitv10 xsDataInputLabelit = EDHandlerXSDataLabelitv10.generateXSDataInputLabelit(xsDataIndexingInput) strReferencePath = os.path.join(self.strDataPath, _strFileNameXSDataLabelitInput_reference) strXMLInputLabelitReference = EDUtilsTest.readAndParseFile(strReferencePath) EDFactoryPluginStatic.loadModule("XSDataLabelitv10") from XSDataLabelitv10 import XSDataInputLabelit xsDataInputLabelitReference = XSDataInputLabelit.parseString(strXMLInputLabelitReference) EDAssert.equal(xsDataInputLabelitReference.marshal(), xsDataInputLabelit.marshal())
def __init__(self): EDPluginControl.__init__(self) 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 __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 testGenerateXSDataInputBestv1_2(self, _strFileNameXSDataInputStrategy_reference, _strFileNameXSDataInputBest_reference): """ This method is testing the generation of the XSDataInputBest object given a XSDataIndexingStrategy object. """ strReferenceInputFile = os.path.join(self.strDataPath, _strFileNameXSDataInputStrategy_reference) strPath = os.path.join(self.strDataPath, strReferenceInputFile) from XSDataMXv1 import XSDataInputStrategy xsDataInputStrategy = XSDataInputStrategy.parseFile(strPath) from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2 edHandlerXSDataBestv1_2 = EDHandlerXSDataBestv1_2() xsDataInputBestv1_2 = edHandlerXSDataBestv1_2.getXSDataInputBest(xsDataInputStrategy) strReferencePath = os.path.join(self.strDataPath, _strFileNameXSDataInputBest_reference) strXMLInputBestReference = EDUtilsTest.readAndParseFile(strReferencePath) EDFactoryPluginStatic.loadModule("XSDataBestv1_2") from XSDataBestv1_2 import XSDataInputBest xsDataInputBestReference = XSDataInputBest.parseString(strXMLInputBestReference) EDAssert.equal(xsDataInputBestReference.marshal(), xsDataInputBestv1_2.marshal())
def mergeStrategyToNewOrientation(_xsDataResultStrategy, _xsDataCollection, _fOmega, _fKappa, _fPhi): ''' _xsDataResultStrategy: reference strategy results as the template for the new strategy _xsDataCollection: The data collection that will be merged in result: suggestedStrategy(XSDataResultStrategy): the strategy resulted from the merge ''' # suggestedStrategy = None # try: # newpossibleOrientations=XSDataSTACv01.kappa_alignment_response.parseString(_possible_orientation.marshal()) # except: # newpossibleOrientations=None #so we will copy the strategy of collecting the reference images inputed to here but at the new orientation #get the full strategy from the Reference EDFactoryPluginStatic.loadModule("XSDataMXv1") from XSDataMXv1 import XSDataResultStrategy suggestedStrategy = XSDataResultStrategy.parseString(_xsDataResultStrategy.marshal()) #take only the first CollectionPlan if len(suggestedStrategy.getCollectionPlan()) > 0: suggestedStrategy.setCollectionPlan([suggestedStrategy.getCollectionPlan()[0]]) #modify the DC part taking it from the input suggestedStrategy.getCollectionPlan()[0].setCollectionStrategy(_xsDataCollection) #and modify the Orientation # dc = XSDataMXv2.XSDataCollection() # dc = self.getDataInput("mxv2DataCollection_Reference")[0] # Orients = _possible_orientation.getPossible_orientation() # omega = Orients[0].getOmega() # kappa = Orients[0].getKappa() # phi = Orients[0].getPhi() suggestedStrategy = EDHandlerXSDataMXv1v1_0.copyStrategyToNewOrientation(suggestedStrategy, _fOmega, _fKappa, _fPhi, "MERGED") # for dcplan in suggestedStrategy.getCollectionPlan(): # dcplan.setComment(EDHandlerXSDataMXv1v1_0().replaceElements(dcplan.getComment(), "OMEGA=", omega)) # dcplan.setComment(EDHandlerXSDataMXv1v1_0().replaceElements(dcplan.getComment(), "KAPPA=", kappa)) # dcplan.setComment(EDHandlerXSDataMXv1v1_0().replaceElements(dcplan.getComment(), "PHI=", phi)) #finally take the suggested new orientation out of the list of further possible ones # if newpossibleOrientations is not None: # newpossibleOrientations.setPossible_orientation([]) # for i in range(1, Orients.__len__()): # if (math.fabs(float(Orients[i].getKappa())-float(kappa))<tol and math.fabs(float(Orients[i].getPhi())-float(phi))<tol): # newpossibleOrientations.addPossible_orientation(Orients[i]) # return [suggestedStrategy,newpossibleOrientations] return suggestedStrategy
def testGetXSDataResultCharacterisation(self): strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(), "XSDataResultCCP4i_reference.xml") strXML = self.readAndParseFile(strPathToCCP4iResult) EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1") from XSDataCCP4iv1_1 import XSDataResultCCP4i xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML) strListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles( ).getValue() pluginMXCuBE = self.createPlugin() xsDataResultCharacterisation = pluginMXCuBE.getXSDataResultCharacterisation( strListOfOutputFiles) strPathToResultCharacterisationReference = os.path.join( self.getPluginTestsDataHome(), "EDPluginControlCharacterisationv1_1_dataOutput.xml") xsDataResultCharacterisationReference = XSDataResultCharacterisation.parseFile( strPathToResultCharacterisationReference) EDAssert.equal(xsDataResultCharacterisationReference.marshal(), xsDataResultCharacterisation.marshal())
def generateXSDataInputLabelitIndexing(_xsDataIndexingInput): EDFactoryPluginStatic.loadModule("XSDataPhenixv1_1") from XSDataPhenixv1_1 import XSDataInputLabelitIndexing inputLabelitIndexing = XSDataInputLabelitIndexing() listXSDataImageReference = [] dataCollection = _xsDataIndexingInput.dataCollection for subWedge in dataCollection.subWedge: for image in subWedge.image: inputLabelitIndexing.image.append(image.copy()) xsDataCrystal = _xsDataIndexingInput.getCrystal() if xsDataCrystal is not None: xsDataSpaceGroup = xsDataCrystal.getSpaceGroup() if xsDataSpaceGroup is not None: xsDataStringName = xsDataSpaceGroup.getName() if xsDataStringName is not None: inputLabelitIndexing.forcedSpaceGroup = xsDataStringName return inputLabelitIndexing
def getXSDataMOSFLMDetector(_xsDataDetector): """ Translates an XSDataDetector object to XSDataMOSFLMv10. """ EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10") from XSDataMOSFLMv10 import XSDataMOSFLMDetector xsDataMOSFLMDetector = XSDataMOSFLMDetector() strDetectorType = _xsDataDetector.getType().getValue() if (strDetectorType == "q4") or \ (strDetectorType == "q4-2x") or \ (strDetectorType == "q210") or \ (strDetectorType == "q210-2x") or \ (strDetectorType == "q315") or \ (strDetectorType == "q315-2x"): xsDataMOSFLMDetector.setType(XSDataString("ADSC")) elif (strDetectorType == "mar165") or \ (strDetectorType == "mar225"): xsDataMOSFLMDetector.setType(XSDataString("MARCCD")) elif (strDetectorType == "pilatus6m" or strDetectorType == "pilatus2m"): xsDataMOSFLMDetector.setType(XSDataString("PILATUS")) elif strDetectorType.startswith("eiger2"): xsDataMOSFLMDetector.setType(XSDataString("EIGER2")) elif strDetectorType.startswith("eiger"): xsDataMOSFLMDetector.setType(XSDataString("EIGER")) elif (strDetectorType == "raxis4"): xsDataMOSFLMDetector.setType(XSDataString("RAXISIV")) else: # This is a temporary solution for the exception problem pointed out in bug #43. # Instead of raising an exception with a known type we send the error message as a string. strErrorMessage = "EDHandlerXSDataMOSFLMv10.getXSDataMOSFLMDetector: Unknown detector type : " + strDetectorType raise BaseException(strErrorMessage) if (_xsDataDetector.getNumberPixelX() is not None): xsDataMOSFLMDetector.setNumberPixelX( _xsDataDetector.getNumberPixelX()) if (_xsDataDetector.getNumberPixelY() is not None): xsDataMOSFLMDetector.setNumberPixelY( _xsDataDetector.getNumberPixelY()) if (_xsDataDetector.getPixelSizeX() is not None): xsDataMOSFLMDetector.setPixelSizeX(_xsDataDetector.getPixelSizeX()) if (_xsDataDetector.getPixelSizeY() is not None): xsDataMOSFLMDetector.setPixelSizeY(_xsDataDetector.getPixelSizeY()) return xsDataMOSFLMDetector
def testCreateOutputFileDictionary(self): strPathToCCP4iResult = os.path.join(self.getPluginTestsDataHome(), "XSDataResultCCP4i_reference.xml") strXML = self.readAndParseFile(strPathToCCP4iResult) EDFactoryPluginStatic.loadModule("XSDataCCP4iv1_1") from XSDataCCP4iv1_1 import XSDataResultCCP4i xsDataResultCCP4i = XSDataResultCCP4i.parseString(strXML) xsDataStringListOfOutputFiles = xsDataResultCCP4i.getListOfOutputFiles() pluginMXCuBE = self.createPlugin() pluginMXCuBE.configure() strResultCharacterisationFileName = "XSDataResultCharacterisation_reference.xml" strPathToReferenceFile = os.path.join(self.getPluginTestsDataHome(), strResultCharacterisationFileName) strXML = self.readAndParseFile(strPathToReferenceFile) xsDataResultCharacterisation = XSDataResultCharacterisation.parseString(strXML) strDNAFileDirectoryPath = pluginMXCuBE.createDNAFileDirectoryPath(xsDataResultCharacterisation) pluginMXCuBE.createDNAFileDirectory(strDNAFileDirectoryPath) xsDataDictionary = pluginMXCuBE.createOutputFileDictionary(xsDataResultCharacterisation, strDNAFileDirectoryPath) EDAssert.equal(False, xsDataDictionary is None) shutil.rmtree(strDNAFileDirectoryPath)
def __init__(self): EDPluginControl.__init__(self) 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.xsDataSampleCopy = None # For default chemical composition self.fAverageAminoAcidVolume = 135.49 self.fAverageCrystalSolventContent = 0.47 self.fAverageSulfurContentPerAminoacid = 0.05 self.fAverageSulfurConcentration = 314
def testGenerateXSDataMOSFLMInputIntegration(self): strFilename = "XSDataIntegrationInput_reference.xml" strPath = os.path.join(self.m_strDataPath, strFilename) strXMLIntegrationInput = EDUtilsTest.readAndParseFile(strPath) from XSDataMXv1 import XSDataIntegrationInput xsDataIntegrationInput = XSDataIntegrationInput.parseString( strXMLIntegrationInput) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataMOSFLMInputIntegration = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIntegration( xsDataIntegrationInput) strReferenceFilename = "XSDataMOSFLMInputIntegration_reference.xml" strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename) strXMLIntegrationInputReference = EDUtilsTest.readAndParseFile( strReferencePath) EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10") from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration xsDataMOSFLMInputIntegrationReference = XSDataMOSFLMInputIntegration.parseString( strXMLIntegrationInputReference) EDAssert.equal(xsDataMOSFLMInputIntegrationReference.marshal(), xsDataMOSFLMInputIntegration.marshal())
def copyStrategyToNewOrientation(_xsDataResultStrategy, _fOmega, _fKappa, _fPhi, _strategy = "COPIED"): ''' _xsDataResultStrategy: the strategy results in which the orientation should be changed omega,kappa,phi: the new orientation result: suggestedStrategy(XSDataResultStrategy): the strategy in which the orientation is changed ''' #we suggest the currently calculated strategy EDFactoryPluginStatic.loadModule("XSDataMXv1") from XSDataMXv1 import XSDataResultStrategy suggestedStrategy = XSDataResultStrategy.parseString(_xsDataResultStrategy.marshal()) #and we have to add the actual orientation EDFactoryPluginStatic.loadModule("EDHandlerXSDataCommon") from EDHandlerXSDataCommon import EDHandlerXSDataCommon for dcplan in suggestedStrategy.getCollectionPlan(): dcplan.setComment(EDHandlerXSDataCommon.replaceElements(dcplan.getComment(), "OMEGA=", str(_fOmega))) dcplan.setComment(EDHandlerXSDataCommon.replaceElements(dcplan.getComment(), "KAPPA=", str(_fKappa))) dcplan.setComment(EDHandlerXSDataCommon.replaceElements(dcplan.getComment(), "PHI=", str(_fPhi))) dcplan.setComment(EDHandlerXSDataCommon.replaceElements(dcplan.getComment(), "STRATEGY=", str(_strategy))) return suggestedStrategy
def testGenerateXSDataInputISPyB(self): """ This method is testing the generation of the XSDataInputISPyB object given a XSDataIndexingInput object. """ strReferenceInputControlISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputControlISPyB_reference.xml") strPath = os.path.join(self.strDataPath, strReferenceInputControlISPyBFile) strXMLIndexingInput = self.readAndParseFile(strPath) from XSDataMXv1 import XSDataInputControlISPyB xsDataInputControlISPyB = XSDataInputControlISPyB.parseString(strXMLIndexingInput) from EDHandlerXSDataISPyBv1_1 import EDHandlerXSDataISPyBv1_1 xsDataInputISPyB = EDHandlerXSDataISPyBv1_1.generateXSDataInputISPyB(xsDataInputControlISPyB) strReferenceInputISPyBFile = EDUtilsPath.mergePath(self.strDataPath, "XSDataInputISPyB_reference.xml") strReferencePath = os.path.join(self.strDataPath, strReferenceInputISPyBFile) strXMLInputISPyBReference = self.readAndParseFile(strReferencePath) EDFactoryPluginStatic.loadModule("XSDataISPyBv1_1") from XSDataISPyBv1_1 import XSDataInputISPyB xsDataInputISPyBReference = XSDataInputISPyB.parseString(strXMLInputISPyBReference) # Remove the time strings since they otherwise make the test fail xsDataInputISPyBReference.getScreening().setTimeStamp(None) xsDataInputISPyB.getScreening().setTimeStamp(None) EDAssert.equal(xsDataInputISPyBReference.marshal(), xsDataInputISPyB.marshal())
def getXSDataMOSFLMDetector(_xsDataDetector): """ Translates an XSDataDetector object to XSDataMOSFLMv10. """ EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10") from XSDataMOSFLMv10 import XSDataMOSFLMDetector xsDataMOSFLMDetector = XSDataMOSFLMDetector() strDetectorType = _xsDataDetector.getType().getValue() if (strDetectorType == "q4") or \ (strDetectorType == "q4-2x") or \ (strDetectorType == "q210") or \ (strDetectorType == "q210-2x") or \ (strDetectorType == "q315") or \ (strDetectorType == "q315-2x"): xsDataMOSFLMDetector.setType(XSDataString("ADSC")) elif (strDetectorType == "mar165") or \ (strDetectorType == "mar225"): xsDataMOSFLMDetector.setType(XSDataString("MARCCD")) elif (strDetectorType == "pilatus6m" or strDetectorType == "pilatus2m"): xsDataMOSFLMDetector.setType(XSDataString("PILATUS")) elif strDetectorType.startswith("eiger"): xsDataMOSFLMDetector.setType(XSDataString("EIGER")) elif (strDetectorType == "raxis4"): xsDataMOSFLMDetector.setType(XSDataString("RAXISIV")) else: # This is a temporary solution for the exception problem pointed out in bug #43. # Instead of raising an exception with a known type we send the error message as a string. strErrorMessage = "EDHandlerXSDataMOSFLMv10.getXSDataMOSFLMDetector: Unknown detector type : " + strDetectorType raise BaseException(strErrorMessage) if (_xsDataDetector.getNumberPixelX() is not None): xsDataMOSFLMDetector.setNumberPixelX(_xsDataDetector.getNumberPixelX()) if (_xsDataDetector.getNumberPixelY() is not None): xsDataMOSFLMDetector.setNumberPixelY(_xsDataDetector.getNumberPixelY()) if (_xsDataDetector.getPixelSizeX() is not None): xsDataMOSFLMDetector.setPixelSizeX(_xsDataDetector.getPixelSizeX()) if (_xsDataDetector.getPixelSizeY() is not None): xsDataMOSFLMDetector.setPixelSizeY(_xsDataDetector.getPixelSizeY()) return xsDataMOSFLMDetector
def __init__( self ): """ """ EDPluginSTACv2_0.__init__( self ) EDFactoryPluginStatic.loadModule( "XSDataMXv1" ) EDFactoryPluginStatic.loadModule( "XSDataMXv2" ) EDFactoryPluginStatic.loadModule( "XSDataSTACv2_0" ) EDFactoryPluginStatic.loadModule( "XSDataBestv1_2" ) from XSDataMXv1 import XSDataIndexingResult from XSDataMXv1 import XSDataInputStrategy from XSDataBestv1_2 import XSDataInputBest self.setXSDataInputClass( kappa_strategy_request, "kappa_strategy_request" ) import XSDataMXv2 self.setXSDataInputClass( XSDataMXv2.XSDataCollection, "mxv2DataCollection" ) # not used: self.setXSDataInputClass( XSDataIndexingResult, "indexingResult" ) self.setXSDataInputClass( XSDataInputStrategy, "inputBest" )
def generateXSDataInputLabelit(_xsDataIndexingInput): EDFactoryPluginStatic.loadModule("XSDataLabelitv10") from XSDataLabelitv10 import XSDataInputLabelit xsDataInputLabelit = XSDataInputLabelit() xsDataCollection = _xsDataIndexingInput.getDataCollection() xsDataSubWedgeList = xsDataCollection.getSubWedge() xsDataInputLabelit.addImage(xsDataSubWedgeList[0].getImage()[0]) fPhiStartFirst = xsDataSubWedgeList[0].getExperimentalCondition().getGoniostat().getRotationAxisStart().getValue() if (len(xsDataSubWedgeList) > 1): xsDataImageSecond = xsDataSubWedgeList[-1].getImage()[0] fPhiStartSecond = xsDataSubWedgeList[-1].getExperimentalCondition().getGoniostat().getRotationAxisStart().getValue() # Add modulus! if (abs(fPhiStartSecond - fPhiStartFirst) > 4): xsDataInputLabelit.addImage(xsDataImageSecond) return xsDataInputLabelit
def generateXSDataISPyBScreening(_xsDataInputControlISPyB, _strShortComments=None, _strComments=None): """ """ EDFactoryPluginStatic.loadModule("XSDataISPyBv1_2") from XSDataISPyBv1_2 import XSDataString from XSDataISPyBv1_2 import XSDataISPyBScreening xsDataIntegerDataCollectionId = _xsDataInputControlISPyB.getDataCollectionId() # General information xsDataISPyBScreening = XSDataISPyBScreening() xsDataISPyBScreening.setProgramVersion(XSDataString("EDNA MXv1")) pyStrTimeStamp = time.strftime("%Y-%m-%d %H:%M:%S") xsDataISPyBScreening.setTimeStamp(XSDataString(pyStrTimeStamp)) if (not _strShortComments is None): xsDataISPyBScreening.setShortComments(XSDataString(_strShortComments)) if (not _strComments is None): xsDataISPyBScreening.setComments(XSDataString(_strComments)) # Use dataCollectionId if provided in the input if (xsDataIntegerDataCollectionId is not None): xsDataISPyBScreening.setDataCollectionId(xsDataIntegerDataCollectionId) return xsDataISPyBScreening
def __init__(self): """ """ EDPluginSTACv2_0.__init__(self) EDFactoryPluginStatic.loadModule("XSDataMXv1") EDFactoryPluginStatic.loadModule("XSDataBestv1_2") from XSDataMXv1 import XSDataIndexingResult from XSDataBestv1_2 import XSDataInputBest self.setXSDataInputClass(XSDataInputBest, "inputBest") self.setXSDataInputClass(XSDataIndexingResult, "indexingResult") EDFactoryPluginStatic.loadModule( "XSDataSTACv2_0" ) from XSDataSTACv2_0 import kappa_alignment_request self.setXSDataInputClass(kappa_alignment_request, "kappa_alignment_request")
# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # __author__ = "Jérôme Kieffer" __license__ = "GPLv3+" __copyright__ = "2011, ESRF Grenoble" import os, tempfile from EDVerbose import EDVerbose from EDAssert import EDAssert from EDTestCasePluginExecute import EDTestCasePluginExecute from EDFactoryPluginStatic import EDFactoryPluginStatic EDFactoryPluginStatic.loadModule("XSDataEdnaSaxs") EDFactoryPluginStatic.loadModule("XSDataBioSaxsv1_0") from XSDataBioSaxsv1_0 import XSDataResultBioSaxsSmartMergev1_0 class EDTestCasePluginExecuteBioSaxsSmartMergev1_0(EDTestCasePluginExecute): def __init__(self, _strTestName=None): EDTestCasePluginExecute.__init__(self, "EDPluginBioSaxsSmartMergev1_0") # self.setConfigurationFile(os.path.join(self.getPluginTestsDataHome(), # "XSConfiguration_BioSaxsSmartMerge.xml")) self.setDataInputFile(os.path.join(self.getPluginTestsDataHome(), \ "XSDataInputBioSaxsSmartMerge_reference.xml")) self.setReferenceDataOutputFile(os.path.join(self.getPluginTestsDataHome(), \ "XSDataResultBioSaxsSmartMerge_reference.xml")) self.destFile = os.path.join(tempfile.gettempdir(),
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" import threading, time, os from EDVerbose import EDVerbose from EDFactoryPluginStatic import EDFactoryPluginStatic from EDFactoryPlugin import EDFactoryPlugin from EDObject import EDObject from EDSlot import EDSlot from EDPluginWrapperForJobScheduler import EDPluginWrapperForJobScheduler #asizeof does not work with Jython if os.name == "java": asizeof = None else: asizeof = EDFactoryPluginStatic.loadModule("asizeof") class EDJob(EDObject): PLUGIN_STATE_UNITIALIZED = "uninitialized" PLUGIN_STATE_RUNNING = "running" PLUGIN_STATE_SUCCESS = "success" PLUGIN_STATE_FAILURE = "failure" __edFactoryPlugin = EDFactoryPlugin() __dictJobs = {} __semaphore = threading.Semaphore() __dictPluginLastId = {} __fStartTime = time.time() def __init__(self, _strPluginName):
# __author__ = "Jérôme Kieffer" __license__ = "GPLv3+" __copyright__ = "ESRF" __date__ = "2011-02-25" import os, sys from EDVerbose import EDVerbose from EDTestCasePluginUnit import EDTestCasePluginUnit from XSDataBioSaxsv1_0 import XSDataInputBioSaxsNormalizev1_0, XSDataBioSaxsSample, XSDataBioSaxsExperimentSetup from XSDataCommon import XSDataInteger, XSDataDouble, XSDataImage, XSDataFile, XSDataString, \ XSDataLength, XSDataWavelength from EDFactoryPluginStatic import EDFactoryPluginStatic # Needed for loading the plugin... EDFactoryPluginStatic.loadModule("EDInstallNumpyv1_3") EDFactoryPluginStatic.loadModule("EDInstallPILv1_1_7") EDFactoryPluginStatic.loadModule("EDInstallFabio_v0_0_7") class EDTestCasePluginUnitBioSaxsNormalizev1_1(EDTestCasePluginUnit): def __init__(self, _edStringTestName=None): EDTestCasePluginUnit.__init__(self, "EDPluginBioSaxsNormalizev1_1") def testCheckParameters(self): xsDataInput = XSDataInputBioSaxsNormalizev1_0() xsDataInput.setRawImage(XSDataImage()) # xsDataInput.setLogFile(XSDataFile()) xsDataInput.setNormalizedImage(XSDataImage()) xsDataInput.setRawImageSize(XSDataInteger()) xsDataInput.setExperimentSetup(XSDataBioSaxsExperimentSetup())
__authors__ = ["Olof Svensson", "Karl Levik"] __contact__ = "*****@*****.**" __license__ = "GPLv3+" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" import os, tempfile from EDAssert import EDAssert from EDTestCase import EDTestCase from EDUtilsTest import EDUtilsTest from EDUtilsPath import EDUtilsPath from EDUtilsFile import EDUtilsFile from EDFactoryPluginStatic import EDFactoryPluginStatic EDFactoryPluginStatic.loadModule("EDHandlerXSDataISPyBv1_4") from EDHandlerXSDataISPyBv1_4 import EDHandlerXSDataISPyBv1_4 from XSDataMXv1 import XSDataInputControlISPyB class EDTestCaseEDHandlerISPyBv1_4(EDTestCase): def __init__(self, _pyStrTestName=None): EDTestCase.__init__(self, _pyStrTestName) strMXv1DataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName()) strDataDir = "EDHandlerISPyBv1_4" self.strDataPath = os.path.join(strMXv1DataHome, strDataDir) self.dictReplace = { "${EDNA_TESTIMAGES}": EDUtilsPath.EDNA_TESTIMAGES, "${EDNA_HOME}": EDUtilsPath.getEdnaHome(), "${USER}": os.getenv("USER", "UndefindedUser"),
from EDFactoryPluginStatic import EDFactoryPluginStatic EDFactoryPluginStatic.loadModule("XSDataMXv1") from XSDataMXv1 import XSDataResultStrategy xsDataResultStrategy = XSDataResultStrategy.parseString(mxv1StrategyResult) xsDataCollectionPlan = xsDataResultStrategy.getCollectionPlan()[0] xsDataCollectionStrategy = xsDataCollectionPlan.getCollectionStrategy() xsDataSubWedge = xsDataCollectionStrategy.getSubWedge()[0] xsDataExperimentalCondition = xsDataSubWedge.getExperimentalCondition() exposureTime = xsDataExperimentalCondition.getBeam().getExposureTime( ).getValue() detectorDistance = xsDataExperimentalCondition.getDetector().getDistance( ).getValue() oscillationWidth = xsDataExperimentalCondition.getGoniostat( ).getOscillationWidth().getValue() rotationAxisStart = xsDataExperimentalCondition.getGoniostat( ).getRotationAxisStart().getValue() rotationAxisEnd = xsDataExperimentalCondition.getGoniostat( ).getRotationAxisEnd().getValue() noImages = int((rotationAxisEnd - rotationAxisStart) / oscillationWidth) runNumberDataCollection = run_number print "Suggested strategy:" print "Oscillation start: %.2f" % rotationAxisStart print "Oscillation width: %.2f" % oscillationWidth print "No images: %d" % noImages print "Exposure time: %.2f" % exposureTime print "Detector distance: %.2f" % detectorDistance print "Run number: %d " % runNumberDataCollection
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # from EDVerbose import EDVerbose from EDFactoryPluginStatic import EDFactoryPluginStatic from EDPluginControl import EDPluginControl import XSDataMXv2 EDFactoryPluginStatic.loadModule("XSDataSTACv2_0") import XSDataSTACv2_0 EDFactoryPluginStatic.loadModule("EDHandlerXSDataMXv1v1_0") from EDHandlerXSDataMXv1v1_0 import EDHandlerXSDataMXv1v1_0 EDFactoryPluginStatic.loadModule("EDHandlerXSDataSTACv2_0") from EDHandlerXSDataSTACv2_0 import EDHandlerXSDataSTACv2_0 EDFactoryPluginStatic.loadModule("XSDataMXv1") from XSDataMXv1 import XSDataInputCharacterisation from XSDataMXv1 import XSDataResultCharacterisation from XSDataMXv2 import XSDataInputCharacterisationv2_0 from XSDataMXv2 import XSDataResultCharacterisationv2_0 from XSDataMXv2 import XSDataCollection from XSDataMXv2 import kappa_alignment_response
# __author__ = "Olof Svensson" __contact__ = "*****@*****.**" __license__ = "LGPLv3+" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" __date__ = "20120712" __status__ = "production" import os, datetime from EDPluginExec import EDPluginExec from EDFactoryPluginStatic import EDFactoryPluginStatic EDFactoryPluginStatic.loadModule("EDInstallSudsv0_4") from suds.client import Client from suds.transport.http import HttpAuthenticated from suds.sax.date import DateTime from XSDataCommon import XSDataInteger from XSDataISPyBv1_4 import XSDataInputStoreListOfImageQualityIndicators from XSDataISPyBv1_4 import XSDataResultStoreListOfImageQualityIndicators class EDPluginISPyBStoreListOfImageQualityIndicatorsv1_4(EDPluginExec): """ Plugin to store results in an ISPyB database using web services """
__license__ = "GPLv3+" __copyright__ = "ESRF" __status__ = "deprecated" import os, shutil from EDVerbose import EDVerbose from EDPluginControl import EDPluginControl from EDFactoryPluginStatic import EDFactoryPluginStatic from XSDataCommon import XSDataString, XSDataInteger, XSDataFile from XSDataBioSaxsv1_0 import ( XSDataInputBioSaxsAsciiExportv1_0, XSDataResultBioSaxsAsciiExportv1_0, XSDataInputBioSaxsMetadatav1_0, ) EDFactoryPluginStatic.loadModule("XSDataWaitFilev1_0") EDFactoryPluginStatic.loadModule("XSDataSaxsv1_0") from XSDataWaitFilev1_0 import XSDataInputWaitFile from XSDataSaxsv1_0 import XSDataInputSaxsCurvesv1_0 class EDPluginBioSaxsAsciiExportv1_0(EDPluginControl): """ Control for Bio Saxs ascii export of integrated data : * Wait for the file to arrive * Retrieve metadata from the header * export as 3-column ascii file (EDPluginSaxsCurvesv1_0) * rewrite metadata """ def __init__(self):
from EDVerbose import EDVerbose from EDPluginControl import EDPluginControl from EDFactoryPluginStatic import EDFactoryPluginStatic from EDConfiguration import EDConfiguration from XSDataCommon import XSDataFile from XSDataCommon import XSDataInteger from XSDataCommon import XSDataTime from XSDataMXv1 import XSDataImageQualityIndicators from XSDataMXv1 import XSDataInputControlImageQualityIndicators from XSDataMXv1 import XSDataResultControlImageQualityIndicators EDFactoryPluginStatic.loadModule("XSDataWaitFilev1_0") from XSDataWaitFilev1_0 import XSDataInputWaitMultiFile EDFactoryPluginStatic.loadModule("XSDataLabelitv1_1") from XSDataLabelitv1_1 import XSDataInputDistlSignalStrength class EDPluginControlImageQualityIndicatorsv1_1(EDPluginControl): """ This plugin that control the plugin that generates the image quality indicators. """ def __init__(self): EDPluginControl.__init__(self) self.strPluginExecWaitMultiFileName = "EDPluginWaitMultiFile" self.strPluginExecImageQualityIndicatorName = "EDPluginDistlSignalStrengthv1_1" self.setXSDataInputClass(XSDataInputControlImageQualityIndicators)
# If not, see <http://www.gnu.org/licenses/>. # __author__ = "Olof Svensson" __contact__ = "*****@*****.**" __license__ = "LGPLv3+" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" __date__ = "20120712" __status__ = "production" import os, datetime from EDPluginExec import EDPluginExec from EDFactoryPluginStatic import EDFactoryPluginStatic EDFactoryPluginStatic.loadModule("EDInstallSudsv0_4") from suds.client import Client from suds.transport.http import HttpAuthenticated from suds.sax.date import DateTime from XSDataCommon import XSDataInteger from XSDataISPyBv1_4 import XSDataISPyBScreeningStrategy from XSDataISPyBv1_4 import XSDataInputISPyBStoreScreening from XSDataISPyBv1_4 import XSDataResultISPyBStoreScreening class EDPluginISPyBStoreScreeningv1_4(EDPluginExec): """ Plugin to store results in an ISPyB database using web services """