def testSetDataModelInput(self): """ A test for whether we can obtain the expected XML by setting a certain input for the plugin. """ edPluginISPyB = self.createPlugin() xsPluginItemISPyB = self.getPluginConfiguration( os.path.join(self.getPluginTestsDataHome(), "XSConfiguration.xml")) edPluginISPyB.setConfiguration(xsPluginItemISPyB) edPluginISPyB.configure() xsDataInputISPyB = XSDataInputISPyB() xsDataISPyBImage = XSDataISPyBImage() xsDataISPyBImage.setFileName(XSDataString("test.img")) xsDataISPyBImage.setFileLocation(XSDataString("/tmp")) xsDataISPyBScreening = XSDataISPyBScreening() # xsDataISPyBScreening.setDataCollectionId( XSDataInteger ( 1 ) ) xsDataISPyBScreening.setProgramVersion(XSDataString("EDNA Prototype")) xsDataISPyBScreeningInput = XSDataISPyBScreeningInput() xsDataISPyBScreeningInput.setBeamX(XSDataDouble(10.4)) xsDataISPyBScreeningInput.setBeamY(XSDataDouble(2.31)) xsDataISPyBScreeningInput.setRmsErrorLimits(XSDataDouble(0.8)) xsDataISPyBScreeningInput.setMinimumFractionIndexed(XSDataDouble(0.4)) xsDataISPyBScreeningInput.setMaximumFractionRejected( XSDataDouble(0.45)) xsDataISPyBScreeningInput.setMinimumSignalToNoise(XSDataDouble(0.56)) xsDataISPyBScreeningOutput = XSDataISPyBScreeningOutput() xsDataISPyBScreeningOutput.setStatusDescription( XSDataString("It's just fine.")) xsDataISPyBScreeningOutput.setMosaicity(XSDataDouble(0.25)) xsDataISPyBScreeningOutput.setBeamShiftX(XSDataDouble(0.141)) xsDataISPyBScreeningOutput.setBeamShiftY(XSDataDouble(0.156)) xsDataISPyBScreeningOutputLattice = XSDataISPyBScreeningOutputLattice() xsDataISPyBScreeningOutputLattice.setSpaceGroup(XSDataString("P222")) xsDataISPyBScreeningStrategy = XSDataISPyBScreeningStrategy() xsDataISPyBScreeningStrategy.setPhiStart(XSDataDouble(0)) xsDataISPyBScreeningStrategy.setPhiEnd(XSDataDouble(20)) xsDataISPyBScreeningStrategy.setRotation(XSDataDouble(1)) xsDataISPyBScreeningStrategy.setProgram(XSDataString("EDNA")) xsDataISPyBScreeningStrategy.setAnomalous(XSDataBoolean(1)) xsDataISPyBScreeningOutputContainer = XSDataISPyBScreeningOutputContainer( ) xsDataISPyBScreeningOutputContainer.setScreeningOutput( xsDataISPyBScreeningOutput) xsDataISPyBScreeningOutputContainer.getScreeningOutputLattice().append( xsDataISPyBScreeningOutputLattice) xsDataISPyBScreeningOutputContainer.getScreeningStrategy().append( xsDataISPyBScreeningStrategy) xsDataISPyBScreeningRank = XSDataISPyBScreeningRank() xsDataISPyBScreeningRank.setRankValue(XSDataDouble(1.4)) xsDataISPyBScreeningRank.setRankInformation( XSDataString("This is the only one")) xsDataISPyBScreeningRankSet = XSDataISPyBScreeningRankSet() xsDataISPyBScreeningRankSet.setRankEngine(XSDataString("ISPyB")) xsDataInputISPyB.setImage(xsDataISPyBImage) xsDataInputISPyB.setScreening(xsDataISPyBScreening) xsDataInputISPyB.getScreeningInput().append(xsDataISPyBScreeningInput) xsDataInputISPyB.getScreeningOutputContainer().append( xsDataISPyBScreeningOutputContainer) xsDataInputISPyB.getScreeningRank().append(xsDataISPyBScreeningRank) xsDataInputISPyB.setScreeningRankSet(xsDataISPyBScreeningRankSet) xsDataInputISPyB.outputFile(self.m_edObtainedInputFile) pyStrExpectedInput = self.readAndParseFile(self.m_edReferenceInputFile) xsDataScreeningExpected = XSDataInputISPyB.parseString( pyStrExpectedInput) pyStrExpectedXML = xsDataScreeningExpected.marshal() pyStrObtainedInput = self.readAndParseFile(self.m_edObtainedInputFile) xsDataScreeningObtained = XSDataInputISPyB.parseString( pyStrObtainedInput) pyStrObtainedXML = xsDataScreeningObtained.marshal() EDAssert.equal(pyStrExpectedXML, pyStrObtainedXML) self.cleanUp(edPluginISPyB)
def testSetDataModelInput(self): """ A test for whether we can obtain the expected XML by setting a certain input for the plugin. """ edPluginISPyB = self.createPlugin() xsPluginItemISPyB = self.getPluginConfiguration(os.path.join(self.getPluginTestsDataHome(), "XSConfiguration.xml")) edPluginISPyB.setConfiguration(xsPluginItemISPyB) edPluginISPyB.configure() xsDataInputISPyB = XSDataInputISPyB() xsDataISPyBImage = XSDataISPyBImage() xsDataISPyBImage.setFileName(XSDataString("test.img")) xsDataISPyBImage.setFileLocation(XSDataString("/tmp")) xsDataISPyBScreening = XSDataISPyBScreening() # xsDataISPyBScreening.setDataCollectionId( XSDataInteger ( 1 ) ) xsDataISPyBScreening.setProgramVersion(XSDataString("EDNA Prototype")) xsDataISPyBScreeningInput = XSDataISPyBScreeningInput() xsDataISPyBScreeningInput.setBeamX(XSDataDouble(10.4)) xsDataISPyBScreeningInput.setBeamY(XSDataDouble(2.31)) xsDataISPyBScreeningInput.setRmsErrorLimits(XSDataDouble(0.8)) xsDataISPyBScreeningInput.setMinimumFractionIndexed(XSDataDouble(0.4)) xsDataISPyBScreeningInput.setMaximumFractionRejected(XSDataDouble(0.45)) xsDataISPyBScreeningInput.setMinimumSignalToNoise(XSDataDouble(0.56)) xsDataISPyBScreeningOutput = XSDataISPyBScreeningOutput() xsDataISPyBScreeningOutput.setStatusDescription(XSDataString("It's just fine.")) xsDataISPyBScreeningOutput.setMosaicity(XSDataDouble(0.25)) xsDataISPyBScreeningOutput.setBeamShiftX(XSDataDouble (0.141)) xsDataISPyBScreeningOutput.setBeamShiftY(XSDataDouble (0.156)) xsDataISPyBScreeningOutputLattice = XSDataISPyBScreeningOutputLattice() xsDataISPyBScreeningOutputLattice.setSpaceGroup(XSDataString("P222")) xsDataISPyBScreeningStrategy = XSDataISPyBScreeningStrategy() xsDataISPyBScreeningStrategy.setPhiStart(XSDataDouble(0)) xsDataISPyBScreeningStrategy.setPhiEnd(XSDataDouble(20)) xsDataISPyBScreeningStrategy.setRotation(XSDataDouble(1)) xsDataISPyBScreeningStrategy.setProgram(XSDataString("EDNA")) xsDataISPyBScreeningStrategy.setAnomalous(XSDataBoolean(1)) xsDataISPyBScreeningOutputContainer = XSDataISPyBScreeningOutputContainer() xsDataISPyBScreeningOutputContainer.setScreeningOutput(xsDataISPyBScreeningOutput) xsDataISPyBScreeningOutputContainer.getScreeningOutputLattice().append(xsDataISPyBScreeningOutputLattice) xsDataISPyBScreeningOutputContainer.getScreeningStrategy().append(xsDataISPyBScreeningStrategy) xsDataISPyBScreeningRank = XSDataISPyBScreeningRank() xsDataISPyBScreeningRank.setRankValue(XSDataDouble(1.4)) xsDataISPyBScreeningRank.setRankInformation(XSDataString("This is the only one")) xsDataISPyBScreeningRankSet = XSDataISPyBScreeningRankSet() xsDataISPyBScreeningRankSet.setRankEngine(XSDataString("ISPyB")) xsDataInputISPyB.setImage(xsDataISPyBImage) xsDataInputISPyB.setScreening(xsDataISPyBScreening) xsDataInputISPyB.getScreeningInput().append(xsDataISPyBScreeningInput) xsDataInputISPyB.getScreeningOutputContainer().append(xsDataISPyBScreeningOutputContainer) xsDataInputISPyB.getScreeningRank().append(xsDataISPyBScreeningRank) xsDataInputISPyB.setScreeningRankSet(xsDataISPyBScreeningRankSet) xsDataInputISPyB.outputFile(self.m_edObtainedInputFile) pyStrExpectedInput = self.readAndParseFile (self.m_edReferenceInputFile) xsDataScreeningExpected = XSDataInputISPyB.parseString(pyStrExpectedInput) pyStrExpectedXML = xsDataScreeningExpected.marshal() pyStrObtainedInput = self.readAndParseFile (self.m_edObtainedInputFile) xsDataScreeningObtained = XSDataInputISPyB.parseString(pyStrObtainedInput) pyStrObtainedXML = xsDataScreeningObtained.marshal() EDAssert.equal(pyStrExpectedXML, pyStrObtainedXML) self.cleanUp(edPluginISPyB)