def testSetDataModelInput(self): """ """ edPluginBest = self.createPlugin() xsPluginItemGood01 = self.getPluginConfiguration(os.path.join(self.strDataPath, "XSConfiguration.xml")) edPluginBest.setConfiguration(xsPluginItemGood01) edPluginBest.setScriptExecutable("cat") edPluginBest.configure() from XSDataBestv1_1 import XSDataInputBest xsDataInputBest = XSDataInputBest() from XSDataCommon import XSDataAbsorbedDoseRate from XSDataCommon import XSDataDouble from XSDataCommon import XSDataTime from XSDataCommon import XSDataSpeed from XSDataCommon import XSDataString from XSDataCommon import XSDataAngle from XSDataCommon import XSDataBoolean xsDataInputBest.setCrystalAbsorbedDoseRate(XSDataAbsorbedDoseRate(0.22e06)) xsDataInputBest.setCrystalShape(XSDataDouble(1)) xsDataInputBest.setCrystalSusceptibility(XSDataDouble(1.5)) xsDataInputBest.setDetectorType(XSDataString("q210-2x")) xsDataInputBest.setBeamExposureTime(XSDataTime(1)) xsDataInputBest.setBeamMaxExposureTime(XSDataTime(10000)) xsDataInputBest.setBeamMinExposureTime(XSDataTime(0.1)) xsDataInputBest.setGoniostatMinRotationWidth(XSDataAngle(0.1)) xsDataInputBest.setGoniostatMaxRotationSpeed(XSDataSpeed(10)) xsDataInputBest.setAimedResolution(XSDataDouble(2)) xsDataInputBest.setAimedRedundancy(XSDataDouble(6.5)) xsDataInputBest.setAimedCompleteness(XSDataDouble(0.9)) xsDataInputBest.setAimedIOverSigma(XSDataDouble(3)) xsDataInputBest.setComplexity(XSDataString("min")) xsDataInputBest.setAnomalousData(XSDataBoolean(True)) bestFileContentDat = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile.dat")) xsDataInputBest.setBestFileContentDat(XSDataString(bestFileContentDat)) bestFileContentPar = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile.par")) xsDataInputBest.setBestFileContentPar(XSDataString(bestFileContentPar)) bestFileContentHKL = EDUtilsFile.readFile(os.path.join(self.strDataPath, "bestfile1.hkl")) listBestFileContentHKL = [] listBestFileContentHKL.append(XSDataString(bestFileContentHKL)) xsDataInputBest.setBestFileContentHKL(listBestFileContentHKL) xsDataInputBest.outputFile(self.strObtainedInputFile) strExpectedInput = self.readAndParseFile(self.strReferenceInputFile) strObtainedInput = self.readAndParseFile(self.strObtainedInputFile) xsDataInputExpected = XSDataInputBest.parseString(strExpectedInput) xsDataInputObtained = XSDataInputBest.parseString(strObtainedInput) EDAssert.equal(xsDataInputExpected.marshal(), xsDataInputObtained.marshal()) os.remove(self.strObtainedInputFile) self.cleanUp(edPluginBest)
def getXSDataInputBest(self, _xsDataBeam, _xsDataSample, _xsDataDetector, _xsDataGoniostat, _xsDataDiffractionPlan, _edStrBestFileContentDat, _edStrBestFileContentPar, _edListBestFileContentHKL): """ """ xsDataInputBest = XSDataInputBest() # Sample xdDataAbsorbedDose = None xsDataSusceptibility = None # Could be None if sample has not been set # It could be not None in case Raddose has calculated an absorbed dose with default sample values if(_xsDataSample is not None): xdDataAbsorbedDose = _xsDataSample.getAbsorbedDoseRate() xsDataSusceptibility = _xsDataSample.getSusceptibility() # Could be None if Raddose failed to calculate the absorbed dose if(xdDataAbsorbedDose is not None): xsDataInputBest.setCrystalAbsorbedDoseRate(_xsDataSample.getAbsorbedDoseRate()) xsDataInputBest.setCrystalSusceptibility(xsDataSusceptibility) # crystalShape # Default value is 1 (We assume that Xtal is smaller than beam) xsDataFloatCrystalShape = _xsDataSample.getShape() if(xsDataFloatCrystalShape is None): xsDataInputBest.setCrystalShape(XSDataFloat(1)) else: xsDataInputBest.setCrystalShape(xsDataFloatCrystalShape) # Detector xsDataInputBest.setDetectorType(_xsDataDetector.getType()) # Beam xsDataInputBest.setBeamExposureTime(_xsDataBeam.getExposureTime()) xsDataInputBest.setBeamMinExposureTime(_xsDataBeam.getMinExposureTimePerImage()) # Goniostat xsDataInputBest.setGoniostatMaxRotationSpeed(_xsDataGoniostat.getMaxOscillationSpeed()) xsDataInputBest.setGoniostatMinRotationWidth(_xsDataGoniostat.getMinOscillationWidth()) # Diffraction plan xsDataInputBest.setAimedResolution(_xsDataDiffractionPlan.getAimedResolution()) xsDataInputBest.setAimedRedundancy(_xsDataDiffractionPlan.getAimedMultiplicity()) xsDataInputBest.setAimedCompleteness(_xsDataDiffractionPlan.getAimedCompleteness()) xsDataInputBest.setAimedIOverSigma(_xsDataDiffractionPlan.getAimedIOverSigmaAtHighestResolution()) xsDataInputBest.setBeamMaxExposureTime(_xsDataDiffractionPlan.getMaxExposureTimePerDataCollection()) xsDataInputBest.setComplexity(_xsDataDiffractionPlan.getComplexity()) xsDataInputBest.setAnomalousData(_xsDataDiffractionPlan.getAnomalousData()) # Best Files xsDataInputBest.setBestFileContentDat(_edStrBestFileContentDat) xsDataInputBest.setBestFileContentPar(_edStrBestFileContentPar) xsDataInputBest.setBestFileContentHKL(_edListBestFileContentHKL) return xsDataInputBest
def testSetDataModelInput(self): """ """ edPluginBest = self.createPlugin() xsPluginItemGood01 = self.getPluginConfiguration( os.path.join(self.strDataPath, "XSConfiguration.xml")) edPluginBest.setConfiguration(xsPluginItemGood01) edPluginBest.setScriptExecutable("cat") edPluginBest.configure() from XSDataBestv1_1 import XSDataInputBest xsDataInputBest = XSDataInputBest() from XSDataCommon import XSDataAbsorbedDoseRate from XSDataCommon import XSDataDouble from XSDataCommon import XSDataTime from XSDataCommon import XSDataSpeed from XSDataCommon import XSDataString from XSDataCommon import XSDataAngle from XSDataCommon import XSDataBoolean xsDataInputBest.setCrystalAbsorbedDoseRate( XSDataAbsorbedDoseRate(0.22E+06)) xsDataInputBest.setCrystalShape(XSDataDouble(1)) xsDataInputBest.setCrystalSusceptibility(XSDataDouble(1.5)) xsDataInputBest.setDetectorType(XSDataString("q210-2x")) xsDataInputBest.setBeamExposureTime(XSDataTime(1)) xsDataInputBest.setBeamMaxExposureTime(XSDataTime(10000)) xsDataInputBest.setBeamMinExposureTime(XSDataTime(0.1)) xsDataInputBest.setGoniostatMinRotationWidth(XSDataAngle(0.1)) xsDataInputBest.setGoniostatMaxRotationSpeed(XSDataSpeed(10)) xsDataInputBest.setAimedResolution(XSDataDouble(2)) xsDataInputBest.setAimedRedundancy(XSDataDouble(6.5)) xsDataInputBest.setAimedCompleteness(XSDataDouble(0.9)) xsDataInputBest.setAimedIOverSigma(XSDataDouble(3)) xsDataInputBest.setComplexity(XSDataString("min")) xsDataInputBest.setAnomalousData(XSDataBoolean(True)) bestFileContentDat = EDUtilsFile.readFile( os.path.join(self.strDataPath, "bestfile.dat")) xsDataInputBest.setBestFileContentDat(XSDataString(bestFileContentDat)) bestFileContentPar = EDUtilsFile.readFile( os.path.join(self.strDataPath, "bestfile.par")) xsDataInputBest.setBestFileContentPar(XSDataString(bestFileContentPar)) bestFileContentHKL = EDUtilsFile.readFile( os.path.join(self.strDataPath, "bestfile1.hkl")) listBestFileContentHKL = [] listBestFileContentHKL.append(XSDataString(bestFileContentHKL)) xsDataInputBest.setBestFileContentHKL(listBestFileContentHKL) xsDataInputBest.outputFile(self.strObtainedInputFile) strExpectedInput = self.readAndParseFile(self.strReferenceInputFile) strObtainedInput = self.readAndParseFile(self.strObtainedInputFile) xsDataInputExpected = XSDataInputBest.parseString(strExpectedInput) xsDataInputObtained = XSDataInputBest.parseString(strObtainedInput) EDAssert.equal(xsDataInputExpected.marshal(), xsDataInputObtained.marshal()) os.remove(self.strObtainedInputFile) self.cleanUp(edPluginBest)
def getXSDataInputBest(self, _xsDataBeam, _xsDataSample, _xsDataDetector, _xsDataGoniostat, _xsDataDiffractionPlan, _edStrBestFileContentDat, _edStrBestFileContentPar, _edListBestFileContentHKL): """ """ xsDataInputBest = XSDataInputBest() # Sample xdDataAbsorbedDose = None xsDataSusceptibility = None # Could be None if sample has not been set # It could be not None in case Raddose has calculated an absorbed dose with default sample values if (_xsDataSample is not None): xdDataAbsorbedDose = _xsDataSample.getAbsorbedDoseRate() xsDataSusceptibility = _xsDataSample.getSusceptibility() # Could be None if Raddose failed to calculate the absorbed dose if (xdDataAbsorbedDose is not None): xsDataInputBest.setCrystalAbsorbedDoseRate( _xsDataSample.getAbsorbedDoseRate()) xsDataInputBest.setCrystalSusceptibility(xsDataSusceptibility) # crystalShape # Default value is 1 (We assume that Xtal is smaller than beam) xsDataFloatCrystalShape = _xsDataSample.getShape() if (xsDataFloatCrystalShape is None): xsDataInputBest.setCrystalShape(XSDataFloat(1)) else: xsDataInputBest.setCrystalShape(xsDataFloatCrystalShape) # Detector xsDataInputBest.setDetectorType(_xsDataDetector.getType()) # Beam xsDataInputBest.setBeamExposureTime(_xsDataBeam.getExposureTime()) xsDataInputBest.setBeamMinExposureTime( _xsDataBeam.getMinExposureTimePerImage()) # Goniostat xsDataInputBest.setGoniostatMaxRotationSpeed( _xsDataGoniostat.getMaxOscillationSpeed()) xsDataInputBest.setGoniostatMinRotationWidth( _xsDataGoniostat.getMinOscillationWidth()) # Diffraction plan xsDataInputBest.setAimedResolution( _xsDataDiffractionPlan.getAimedResolution()) xsDataInputBest.setAimedRedundancy( _xsDataDiffractionPlan.getAimedMultiplicity()) xsDataInputBest.setAimedCompleteness( _xsDataDiffractionPlan.getAimedCompleteness()) xsDataInputBest.setAimedIOverSigma( _xsDataDiffractionPlan.getAimedIOverSigmaAtHighestResolution()) xsDataInputBest.setBeamMaxExposureTime( _xsDataDiffractionPlan.getMaxExposureTimePerDataCollection()) xsDataInputBest.setComplexity(_xsDataDiffractionPlan.getComplexity()) xsDataInputBest.setAnomalousData( _xsDataDiffractionPlan.getAnomalousData()) # Best Files xsDataInputBest.setBestFileContentDat(_edStrBestFileContentDat) xsDataInputBest.setBestFileContentPar(_edStrBestFileContentPar) xsDataInputBest.setBestFileContentHKL(_edListBestFileContentHKL) return xsDataInputBest