def testSetDataModelInput(self): """ """ edPluginStrategy = self.createPlugin() xsPluginItemGood01 = self.getPluginConfiguration(os.path.join(self.strDataPath, "XSConfiguration_ESRF.xml")) edPluginStrategy.setConfiguration(xsPluginItemGood01) edPluginStrategy.configure() from XSDataMXv1 import XSDataStrategyInput xSDataStrategy = XSDataStrategyInput() # Beam from XSDataCommon import XSDataFlux from XSDataCommon import XSDataWavelength from XSDataCommon import XSDataSize from XSDataCommon import XSDataLength from XSDataCommon import XSDataTime from XSDataMXv1 import XSDataBeam from XSDataMXv1 import XSDataExperimentalCondition xsExperimentalCondition = XSDataExperimentalCondition() xsBeam = XSDataBeam() xsBeam.setFlux(XSDataFlux(1e+12)) xsBeam.setWavelength(XSDataWavelength(2.41)) xsBeam.setSize(XSDataSize(x=XSDataLength(0.1), y=XSDataLength(0.1))) xsBeam.setExposureTime(XSDataTime(1)) xsExperimentalCondition.setBeam(xsBeam) # Detector and Exposure Time from XSDataMXv1 import XSDataDetector from XSDataCommon import XSDataString from XSDataMXv1 import XSDataGoniostat xsDataDetector = XSDataDetector() xsDataDetector.setType(XSDataString("q210-2x")) xsExperimentalCondition.setDetector(xsDataDetector) xsDataGoniostat = XSDataGoniostat() xsDataGoniostat.setRotationAxis(XSDataString("phi")) xsExperimentalCondition.setGoniostat(xsDataGoniostat) xSDataStrategy.setExperimentalCondition(xsExperimentalCondition) # Best Files bestFileContentDat = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile.dat")) xSDataStrategy.setBestFileContentDat(XSDataString(bestFileContentDat)) bestFileContentPar = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile.par")) xSDataStrategy.setBestFileContentPar(XSDataString(bestFileContentPar)) bestFileContentHKL = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile1.hkl")) listBestFileContentHKL = [] listBestFileContentHKL.append(XSDataString(bestFileContentHKL)) xSDataStrategy.setBestFileContentHKL(listBestFileContentHKL) # Crystal from XSDataCommon import XSDataFloat from XSDataCommon import XSDataAngle from XSDataCommon import XSDataInteger from XSDataMXv1 import XSDataCrystal from XSDataMXv1 import XSDataStructure from XSDataMXv1 import XSDataChain from XSDataMXv1 import XSDataAtom from XSDataMXv1 import XSDataLigand from XSDataMXv1 import XSDataSampleCrystalMM from XSDataMXv1 import XSDataChemicalCompositionMM from XSDataMXv1 import XSDataAtomicComposition from XSDataMXv1 import XSDataSolvent from XSDataMXv1 import XSDataCell from XSDataMXv1 import XSDataSpaceGroup xsDataSampleCrystalMM = XSDataSampleCrystalMM() xsDataStructure = XSDataStructure() xsDataComposition = XSDataChemicalCompositionMM() xsDataChain = XSDataChain() xsDataChain.setType(XSDataString("protein")) xsDataChain.setNumberOfCopies(XSDataFloat(2)) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtom1 = XSDataAtom() xsDataAtom1.setSymbol(XSDataString("Se")) xsDataAtom1.setNumberOf(XSDataFloat(4)) xsDataAtomicComposition.addAtom(xsDataAtom1) xsDataChain.setHeavyAtoms(xsDataAtomicComposition) xsDataChain.setNumberOfMonomers(XSDataFloat(100)) xsDataStructure.addChain(xsDataChain) xsDataChain2 = XSDataChain() xsDataChain2.setType(XSDataString("rna")) xsDataChain2.setNumberOfCopies(XSDataFloat(1)) xsDataChain2.setNumberOfMonomers(XSDataFloat(60)) xsDataStructure.addChain(xsDataChain2) xsDataLigand = XSDataLigand() xsDataLigand.setNumberOfCopies(XSDataFloat(2)) xsDataLigand.setNumberOfLightAtoms(XSDataFloat(42)) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtom2 = XSDataAtom() xsDataAtom2.setSymbol(XSDataString("Fe")) xsDataAtom2.setNumberOf(XSDataFloat(1)) xsDataAtomicComposition.addAtom(xsDataAtom2) xsDataLigand.setHeavyAtoms(xsDataAtomicComposition) xsDataStructure.addLigand(xsDataLigand) xsDataStructure.setNumberOfCopiesInAsymmetricUnit(XSDataFloat(0.25)) xsDataSolvent = XSDataSolvent() xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtom3 = XSDataAtom() xsDataAtom3.setSymbol(XSDataString("Na")) xsDataAtom3.setConcentration(XSDataFloat(1000)) xsDataAtom4 = XSDataAtom() xsDataAtom4.setSymbol(XSDataString("Cl")) xsDataAtom4.setConcentration(XSDataFloat(1000)) xsDataAtomicComposition.addAtom(xsDataAtom3) xsDataAtomicComposition.addAtom(xsDataAtom4) xsDataSolvent.setAtoms(xsDataAtomicComposition) xsDataComposition.setStructure(xsDataStructure) xsDataComposition.setSolvent(xsDataSolvent) xsDataSampleCrystalMM.setChemicalComposition(xsDataComposition) xsDataSampleCrystalMM.setSize(XSDataSize(XSDataLength(0.1), XSDataLength(0.1), XSDataLength(0.1))) xsDataCrystal = XSDataCrystal() xsDataCell = XSDataCell(angle_alpha=XSDataAngle(90.0), angle_beta=XSDataAngle(90.0), angle_gamma=XSDataAngle(90.0), length_a=XSDataLength(78.9), length_b=XSDataLength(95.162), length_c=XSDataLength(104.087)) xsDataCrystal.setCell(xsDataCell) xsDataSpaceGroup = XSDataSpaceGroup() xsDataSpaceGroup.setITNumber(XSDataInteger(16)) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataSampleCrystalMM.setSusceptibility(XSDataFloat(1.5)) xSDataStrategy.setCrystalRefined(xsDataCrystal) xSDataStrategy.setSample(xsDataSampleCrystalMM) xSDataStrategy.outputFile(self.strObtainedInputFile) strExpectedInput = self.readAndParseFile (self.strReferenceInputFile) strObtainedInput = self.readAndParseFile (self.strObtainedInputFile) xsDataInputExpected = XSDataStrategyInput.parseString(strExpectedInput) xsDataInputObtained = XSDataStrategyInput.parseString(strObtainedInput) EDAssert.equal(xsDataInputExpected.marshal(), xsDataInputObtained.marshal())
def doIntegrationToStrategyTransition(self, _edPlugin=None): EDVerbose.DEBUG("EDPluginControlCharacterisationv10.doIntegrationToStrategyTransition") self.retrieveSuccessMessages(_edPlugin, "EDPluginControlCharacterisationv10.doIntegrationToStrategyTransition") xsDataIntegrationOutput = self.__edPluginIntegration.getDataOutput() self.__xsDataCharacterisation.setIntegrationResult(xsDataIntegrationOutput) #EDVerbose.DEBUG( self.__xsDataExperimentCharacterisation.marshal() ) xsDataStrategyInput = XSDataStrategyInput() xsDataSolutionSelected = self.__xsDataCharacterisation.getIndexingResult().getSelectedSolution() xsDataStrategyInput.setCrystalRefined(xsDataSolutionSelected.getCrystal()) xsDataStrategyInput.setSample(self.__xsDataCharacterisation.getDataCollection().getSample()) xsDataIntegrationSubWedgeResultList = xsDataIntegrationOutput.getIntegrationSubWedgeResult() xsDataStrategyInput.setBestFileContentDat(xsDataIntegrationSubWedgeResultList[0].getBestfileDat()) xsDataStrategyInput.setBestFileContentPar(xsDataIntegrationSubWedgeResultList[0].getBestfilePar()) xsDataStrategyInput.setExperimentalCondition(xsDataIntegrationSubWedgeResultList[0].getExperimentalConditionRefined()) for xsDataIntegrationSubWedgeResult in xsDataIntegrationSubWedgeResultList: xsDataStrategyInput.addBestFileContentHKL(xsDataIntegrationSubWedgeResult.getBestfileHKL()) xsDataStrategyInput.setDiffractionPlan(self.__xsDataCharacterisation.getDataCollection().getDiffractionPlan()) #print xsDataStrategyInput.marshal() self.__edPluginStrategy.setDataInput(xsDataStrategyInput) self.__edPluginStrategy.executeSynchronous()