def testGenerateXSDataInputXDSIndexing(self): filename = "XSDataIndexingInput_reference.xml" path = os.path.join(self.dataPath, filename) xmlIndexingInput = EDUtilsTest.readAndParseFile(path) from XSDataMXv1 import XSDataIndexingInput xsDataIndexingInput = XSDataIndexingInput.parseString(xmlIndexingInput) from EDHandlerXSDataXDSv1_0 import EDHandlerXSDataXDSv1_0 xsDataInputXDSIndexing = EDHandlerXSDataXDSv1_0.generateXSDataInputXDSIndexing(xsDataIndexingInput) referenceFilename = "XSDataInputXDSIndexing_reference.xml" referencePath = os.path.join(self.dataPath, referenceFilename) xmlInputXDSIndexingReference = EDUtilsTest.readAndParseFile(referencePath) EDAssert.equal(xmlInputXDSIndexingReference, xsDataInputXDSIndexing.marshal())
def testGenerateXSDataIndexingResult(self): strFilename = "XSDataMOSFLMOutputIndexing_reference.xml" strPath = os.path.join(self.m_strDataPath, strFilename) strXMLMOSFLMOutputIndexing = EDUtilsTest.readAndParseFile(strPath) from XSDataMOSFLMv10 import XSDataMOSFLMOutputIndexing xsDataMOSFLMOutputIndexing = XSDataMOSFLMOutputIndexing.parseString(strXMLMOSFLMOutputIndexing) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult(xsDataMOSFLMOutputIndexing) strReferenceFilename = "XSDataIndexingResult_reference.xml" strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename) strXMLIndexingOutputReference = EDUtilsTest.readAndParseFile(strReferencePath) from XSDataMXv1 import XSDataIndexingResult xsdataIndexingResultReference = XSDataIndexingResult.parseString(strXMLIndexingOutputReference) EDAssert.equal(xsdataIndexingResultReference.marshal(), xsDataIndexingResult.marshal())
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 testGenerateXSDataResultPowderIntegration(self): strReferenceInputFile = os.path.join(self.m_strDataPath, "XSDataResultFIT2DCake_reference.xml") strXMLInput = EDUtilsTest.readAndParseFile(strReferenceInputFile) EDApplication.loadModule("XSDataFIT2Dv1_0") from XSDataFIT2Dv1_0 import XSDataResultFIT2DCake xsDataResultFIT2DCake = XSDataResultFIT2DCake.parseString(strXMLInput) from EDHandlerXSDataFIT2Dv1_0 import EDHandlerXSDataFIT2Dv1_0 edHandlerXSDataFIT2Dv1_0 = EDHandlerXSDataFIT2Dv1_0() xsDataResultPowderDiffraction = edHandlerXSDataFIT2Dv1_0.getXSDataResultPowderIntegration(xsDataResultFIT2DCake) strReferencePath = os.path.join(self.m_strDataPath, "XSDataResultPowderIntegration_reference.xml") strXMLResultReference = EDUtilsTest.readAndParseFile(strReferencePath) EDApplication.loadModule("XSDataDiffractionCTv1") from XSDataDiffractionCTv1 import XSDataResultPowderIntegration xsDataResultPowderIntegrationReference = XSDataResultPowderIntegration.parseString(strXMLResultReference) EDAssert.equal(xsDataResultPowderIntegrationReference.marshal(), xsDataResultPowderDiffraction.marshal())
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 testCheckParameters(self): edPluginSPD = self.createPlugin() edStringXMLInput = EDUtilsTest.readAndParseFile( self.m_edStringReferenceInputFileName) xsDataInputSPDCake = XSDataInputSPDCake.parseString(edStringXMLInput) edPluginSPD.setDataInput(xsDataInputSPDCake) edPluginSPD.checkParameters()
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 testSetDataInput(self): """ This method test the setDataInput method of the Labelit plugin by providing an XML string and then retriving an XSDataInputLabelit object. """ #Create the plugin instance edPluginControlDLSArchiver = self.createPlugin() # create an object which contains the test information edStringInputPluginControlDLSArchiverv10XML = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile) # gives the data to the plugin edPluginControlDLSArchiver.setDataInput( edStringInputPluginControlDLSArchiverv10XML) # get the data from the plugin xsDataInputPluginControlDLSArchiver = edPluginControlDLSArchiver.getDataInput( ) # get the string of the path edStringPath = EDString(xsDataInputPluginControlDLSArchiver. getDropZonePath().getPath().getValue()) # create the test path edStringPathReference = EDString("../data/test/ingest/") # Actually test the data. EDAssert.equal(edStringPath, edStringPathReference) #check out that the list is getting read in properly #FIXME, add in some proper test code here print xsDataInputPluginControlDLSArchiver.getDropZonePath().getPath( ).getValue() print xsDataInputPluginControlDLSArchiver.getIgnoreList()[1].getValue()
def testSpatialDistortion(self): strRefX = "spline-3-18x.edf" strRefY = "spline-3-18y.edf" self.loadTestImage([strRefX, strRefY]) edPluginSPD = self.createPlugin() strXMLInput = EDUtilsTest.readAndParseFile(self.strReferenceInputFileName) xsDataInputSPDCake = XSDataInputSPDCake.parseString(strXMLInput) edPluginSPD.setDataInput(xsDataInputSPDCake) edPluginSPD.configure() edPluginSPD.getInputParameter() ######################################################################## # Enforce some values ######################################################################## edPluginSPD.dictGeometry["SpatialDistortionFile"] = os.path.join(self.getPluginTestsDataHome(), "frelon_spline_file_to_correct_SPD.spline") edPluginSPD.dictGeometry["TiltRotation"] = 18 edPluginSPD.dictGeometry["AngleOfTilt"] = 3 spline = Spline() spline.read(edPluginSPD.dictGeometry["SpatialDistortionFile"]) edPluginSPD.dictGeometry["PixelSizeX"], edPluginSPD.dictGeometry["PixelSizeY"] = spline.getPixelSize() edPluginSPD.createDisplacementMatrix(spline) edPluginSPD.cleanDispMat(edPluginSPD.getWorkingDirectory()) refX = fabio.openimage.openimage(os.path.join(self.getTestsDataImagesHome(), strRefX)).data obtX = fabio.openimage.openimage(os.path.join(edPluginSPD.getWorkingDirectory(), "frelon_spline_file_to_correct_SPD-tilted-x.edf")).data refY = fabio.openimage.openimage(os.path.join(self.getTestsDataImagesHome(), strRefY)).data obtY = fabio.openimage.openimage(os.path.join(edPluginSPD.getWorkingDirectory(), "frelon_spline_file_to_correct_SPD-tilted-y.edf")).data # print edPluginSPD.dictGeometry EDAssert.arraySimilar(obtX, refX , _fAbsMaxDelta=0.1, _strComment="X displacement Matrix is the same") EDAssert.arraySimilar(obtY, refY , _fAbsMaxDelta=0.1, _strComment="Y displacement Matrix is the same")
def testSetDataInput( self ): """ This method test the setDataInput method of the SRBRegister plugin by providing an XML string and then retriving an XSDataInputLabelit object. It checks both inputs """ #Create the plugin instance edPluginExecSRBRegister = self.createPlugin() # create an object which contains the test information edStringInputExecSRBRegisterv10XML = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile ) # gives the data to the plugin edPluginExecSRBRegister.setDataInput( edStringInputExecSRBRegisterv10XML ) # get the data from the plugin xsDataInputPluginExecSRBRegister = edPluginExecSRBRegister.getDataInput() # get the string of the path edStringPath = EDString( xsDataInputPluginExecSRBRegister.getSrbDropFileName().getPath().getValue() ) # create the test path edStringPathReference = EDString( "../data/out/test2.drop" ) # Actually test the data. EDAssert.equal( edStringPathReference, edStringPath ) # test the reading of the other data edStringPath = EDString( xsDataInputPluginExecSRBRegister.getXmlIngestFileName().getPath().getValue() ) # create the test path edStringPathReference = EDString( "../data/create-ds.xml" ) # Actually test the data. EDAssert.equal( edStringPathReference, edStringPath )
def testFileNameExtraction( self ): """ This method should test to make sure that the plugin is extracting the correct file list from the xml ingest file """ try : os.rename("../data/create-ds.xml.icat","../data/create-ds.xml") except : print "nothing to delete" # Create the plugin instance edPluginExecSRBRegister = self.createPlugin() # Read in the data from the XML edStringInputExecSRBRegisterv10XML = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile ) # gives the data to the plugin edPluginExecSRBRegister.setDataInput( edStringInputExecSRBRegisterv10XML ) edPluginExecSRBRegister.openXMLTree() edFilelist = edPluginExecSRBRegister.processFileList() # assert that the filelist is correct edTestlist = ["EDPluginExecSRBRegisterv10_output.xml\n"] EDAssert.equal(edFilelist,edTestlist)
def testDropFileCreation( self ): """ This test will check to make sure the dropfile is created correctly and saved properly """ try : os.remove("../data/out/test2.drop") except : print "nothing to delete" try : os.rename("../data/create-ds.xml.icat","../data/create-ds.xml") except : print "nothing to delete" # Create the plugin instance edPluginExecSRBRegister = self.createPlugin() # Read in the data from the XML, for the big xml edStringInputExecSRBRegisterv10XML = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile ) # gives the data to the plugin edPluginExecSRBRegister.setDataInput( edStringInputExecSRBRegisterv10XML ) # call the method edPluginExecSRBRegister.createDropFile(); # finalise the process edPluginExecSRBRegister.moveGeneratedFiles() # check that the file has been created EDAssert.equal(True, os.path.isfile("../data/out/test2.drop")) EDAssert.equal(True, os.path.isfile("../data/create-ds.xml.icat"))
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 testGenerateXSDataInputXDSIndexing(self): filename = "XSDataIndexingInput_reference.xml" path = os.path.join(self.dataPath, filename) xmlIndexingInput = EDUtilsTest.readAndParseFile(path) from XSDataMXv1 import XSDataIndexingInput xsDataIndexingInput = XSDataIndexingInput.parseString(xmlIndexingInput) from EDHandlerXSDataXDSv1_0 import EDHandlerXSDataXDSv1_0 xsDataInputXDSIndexing = EDHandlerXSDataXDSv1_0.generateXSDataInputXDSIndexing( xsDataIndexingInput) referenceFilename = "XSDataInputXDSIndexing_reference.xml" referencePath = os.path.join(self.dataPath, referenceFilename) xmlInputXDSIndexingReference = EDUtilsTest.readAndParseFile( referencePath) EDAssert.equal(xmlInputXDSIndexingReference, xsDataInputXDSIndexing.marshal())
def testCleanDispMat(self): edPluginSPD = self.createPlugin() strXMLInput = EDUtilsTest.readAndParseFile(self.strReferenceInputFileName) xsDataInputSPDCake = XSDataInputSPDCake.parseString(strXMLInput) edPluginSPD.setDataInput(xsDataInputSPDCake) if EDVerbose.isVerboseDebug(): edPluginSPD.cleanDispMat(edPluginSPD.getWorkingDirectory()) else: edPluginSPD.cleanDispMat()
def testGenerateXSDataResultPowderIntegration(self): strReferenceInputFile = os.path.join( self.m_strDataPath, "XSDataResultFIT2DCake_reference.xml") strXMLInput = EDUtilsTest.readAndParseFile(strReferenceInputFile) EDApplication.loadModule("XSDataFIT2Dv1_0") from XSDataFIT2Dv1_0 import XSDataResultFIT2DCake xsDataResultFIT2DCake = XSDataResultFIT2DCake.parseString(strXMLInput) from EDHandlerXSDataFIT2Dv1_0 import EDHandlerXSDataFIT2Dv1_0 edHandlerXSDataFIT2Dv1_0 = EDHandlerXSDataFIT2Dv1_0() xsDataResultPowderDiffraction = edHandlerXSDataFIT2Dv1_0.getXSDataResultPowderIntegration( xsDataResultFIT2DCake) strReferencePath = os.path.join( self.m_strDataPath, "XSDataResultPowderIntegration_reference.xml") strXMLResultReference = EDUtilsTest.readAndParseFile(strReferencePath) EDApplication.loadModule("XSDataDiffractionCTv1") from XSDataDiffractionCTv1 import XSDataResultPowderIntegration xsDataResultPowderIntegrationReference = XSDataResultPowderIntegration.parseString( strXMLResultReference) EDAssert.equal(xsDataResultPowderIntegrationReference.marshal(), xsDataResultPowderDiffraction.marshal())
def testGenerateXSDataIndexingResult(self): strFilename = "XSDataMOSFLMOutputIndexing_reference.xml" strPath = os.path.join(self.m_strDataPath, strFilename) strXMLMOSFLMOutputIndexing = EDUtilsTest.readAndParseFile(strPath) from XSDataMOSFLMv10 import XSDataMOSFLMOutputIndexing xsDataMOSFLMOutputIndexing = XSDataMOSFLMOutputIndexing.parseString( strXMLMOSFLMOutputIndexing) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult( xsDataMOSFLMOutputIndexing) strReferenceFilename = "XSDataIndexingResult_reference.xml" strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename) strXMLIndexingOutputReference = EDUtilsTest.readAndParseFile( strReferencePath) from XSDataMXv1 import XSDataIndexingResult xsdataIndexingResultReference = XSDataIndexingResult.parseString( strXMLIndexingOutputReference) EDAssert.equal(xsdataIndexingResultReference.marshal(), xsDataIndexingResult.marshal())
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 testIgnoreFile(self): # Create the plugin instance edPluginExecSRBRegister = self.createPlugin() # Read in the data from the XML, for the big xml edStringInputExecSRBRegisterv10XML = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile3) # gives the data to the plugin edPluginExecSRBRegister.setDataInput( edStringInputExecSRBRegisterv10XML ) # first load the tree edPluginExecSRBRegister.openXMLTree() edPluginExecSRBRegister.checkAgainstIgnoreList() EDAssert.equal(False,edPluginExecSRBRegister.forArchiving)
def testGenerateSPDCommand(self): edPluginSPD = self.createPlugin() strXMLInput = EDUtilsTest.readAndParseFile(self.strReferenceInputFileName) xsDataInputSPDCake = XSDataInputSPDCake.parseString(strXMLInput) edPluginSPD.setDataInput(xsDataInputSPDCake) edPluginSPD.configure() edPluginSPD.getInputParameter() #edPluginSPD.preProcess() edPluginSPD.generateSPDCommand() EDVerbose.screen("SPD configuration:\n%s" % edPluginSPD.getSPDConfig()) if EDVerbose.isVerboseDebug(): expected = """off_1=0 off_2=0 verbose=2 src_ext=.edf cor_ext=.cor wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_distortion=0 do_dark=0""" #"do_distortion=2 off_1=0 off_2=0 verbose=2 src_ext=.edf cor_ext=.cor wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_dark=0" else: expected = """off_1=0 off_2=0 verbose=0 src_ext=.edf cor_ext=.cor wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_distortion=0 do_dark=0""" #do_distortion=2 off_1=0 off_2=0 verbose=0 src_ext=.edf cor_ext=.cor wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_dark=0" EDAssert.equal(edPluginSPD.getSPDConfig(), expected)
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 testGenerateSPDCommand(self): edPluginSPD = self.createPlugin() edStringXMLInput = EDUtilsTest.readAndParseFile(self.m_edStringReferenceInputFileName) xsDataInputSPDCake = XSDataInputSPDCake.parseString(edStringXMLInput) edPluginSPD.setDataInput(xsDataInputSPDCake) edPluginSPD.configure() edPluginSPD.getInputParameter() #edPluginSPD.preProcess() edPluginSPD.generateSPDCommand() EDVerbose.screen("SPD configuration:\n %s" % edPluginSPD.getSPDConfig()) if EDVerbose.isVerboseDebug(): expected = """off_1=0 off_2=0 verbose=2 src_ext=.edf wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_distortion=0 do_dark=0 cor_ext=.cor azim_int=1 azim_pass=0 azim_ext=.cor azim_r_num=1489""" # """do_distortion=2 off_1=0 off_2=0 verbose=2 src_ext=.edf wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_dark=0 cor_ext=.cor azim_int=1 azim_pass=0 azim_ext=.cor azim_r_num=1489""" else: expected = """off_1=0 off_2=0 verbose=0 src_ext=.edf wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_distortion=0 do_dark=0 cor_ext=.cor azim_int=1 azim_pass=0 azim_ext=.cor azim_r_num=1489""" # """do_distortion=2 off_1=0 off_2=0 verbose=0 src_ext=.edf wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_dark=0 cor_ext=.cor azim_int=1 azim_pass=0 azim_ext=.cor azim_r_num=1489""" EDAssert.equal(edPluginSPD.getSPDConfig(), expected)
def testSetDataInput( self ): """ This method test the setDataInput method of the Labelit plugin by providing an XML string and then retriving an XSDataInputLabelit object. """ #Create the plugin instance edPluginExecICATIngester = self.createPlugin() # create an object which contains the test information edStringInputExecICATIngesterv10XML = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile ) # gives the data to the plugin edPluginExecICATIngester.setDataInput( edStringInputExecICATIngesterv10XML ) # get the data from the plugin xsDataInputPluginExecICATIngester = edPluginExecICATIngester.getDataInput() # get the string of the path edStringPath = EDString( xsDataInputPluginExecICATIngester.getXmlIngestFileName().getPath().getValue() ) # create the test path edStringPathReference = EDString( "/tmp/xmlingest/" ) # Actualy test the data. EDAssert.equal( edStringPathReference, edStringPath )
def testSetDataInput(self): """ This method test the setDataInput method of the Labelit plugin by providing an XML string and then retriving an XSDataInputLabelit object. """ #Create the plugin instance edPluginExecICATIngester = self.createPlugin() # create an object which contains the test information edStringInputExecICATIngesterv10XML = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile) # gives the data to the plugin edPluginExecICATIngester.setDataInput( edStringInputExecICATIngesterv10XML) # get the data from the plugin xsDataInputPluginExecICATIngester = edPluginExecICATIngester.getDataInput( ) # get the string of the path edStringPath = EDString(xsDataInputPluginExecICATIngester. getXmlIngestFileName().getPath().getValue()) # create the test path edStringPathReference = EDString("/tmp/xmlingest/") # Actualy test the data. EDAssert.equal(edStringPathReference, edStringPath)
def testSetDataInput( self ): """ This method test the setDataInput method of the Labelit plugin by providing an XML string and then retriving an XSDataInputLabelit object. """ #Create the plugin instance edPluginControlDLSArchiver = self.createPlugin() # create an object which contains the test information edStringInputPluginControlDLSArchiverv10XML = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile ) # gives the data to the plugin edPluginControlDLSArchiver.setDataInput( edStringInputPluginControlDLSArchiverv10XML ) # get the data from the plugin xsDataInputPluginControlDLSArchiver = edPluginControlDLSArchiver.getDataInput() # get the string of the path edStringPath = EDString( xsDataInputPluginControlDLSArchiver.getDropZonePath().getPath().getValue() ) # create the test path edStringPathReference = EDString( "../data/test/ingest/" ) # Actually test the data. EDAssert.equal( edStringPath, edStringPathReference) #check out that the list is getting read in properly #FIXME, add in some proper test code here print xsDataInputPluginControlDLSArchiver.getDropZonePath().getPath().getValue() print xsDataInputPluginControlDLSArchiver.getIgnoreList()[1].getValue()
def testCleanDispMat(self): edPluginSPD = self.createPlugin() edStringXMLInput = EDUtilsTest.readAndParseFile(self.m_edStringReferenceInputFileName) xsDataInputSPDCake = XSDataInputSPDCake.parseString(edStringXMLInput) edPluginSPD.setDataInput(xsDataInputSPDCake) edPluginSPD.cleanDispMat()
def testKillAllWorkers(self): edPluginSPD = self.createPlugin() edStringXMLInput = EDUtilsTest.readAndParseFile(self.m_edStringReferenceInputFileName) xsDataInputSPDCake = XSDataInputSPDCake.parseString(edStringXMLInput) edPluginSPD.setDataInput(xsDataInputSPDCake) edPluginSPD.killAllWorkers()
def testCheckParameters(self): edPluginFIT2D = self.createPlugin() edStringXMLInput = EDUtilsTest.readAndParseFile(self.m_edStringReferenceInputFileName) xsDataInputFIT2DCake = XSDataInputFIT2DCake.parseString(edStringXMLInput) edPluginFIT2D.setDataInput(xsDataInputFIT2DCake) edPluginFIT2D.checkParameters()
def testCheckParameters(self): edPluginSPD = self.createPlugin() strXMLInput = EDUtilsTest.readAndParseFile(self.strReferenceInputFileName) xsDataInputSPDCake = XSDataInputSPDCake.parseString(strXMLInput) edPluginSPD.setDataInput(xsDataInputSPDCake) edPluginSPD.checkParameters()
def testGetXSDataRaddoseInput(self): """ """ from XSDataCommon import XSDataLength from XSDataCommon import XSDataWavelength from XSDataCommon import XSDataFlux from XSDataCommon import XSDataSize from XSDataCommon import XSDataDouble from XSDataCommon import XSDataString from XSDataCommon import XSDataAngle from XSDataCommon import XSDataTime from XSDataCommon import XSDataInteger from XSDataMXv1 import XSDataBeam from XSDataMXv1 import XSDataStructure from XSDataMXv1 import XSDataChain from XSDataMXv1 import XSDataAtom from XSDataMXv1 import XSDataLigand from XSDataMXv1 import XSDataCrystal from XSDataMXv1 import XSDataSpaceGroup from XSDataMXv1 import XSDataSampleCrystalMM from XSDataMXv1 import XSDataChemicalCompositionMM from XSDataMXv1 import XSDataAtomicComposition from XSDataMXv1 import XSDataSolvent from XSDataMXv1 import XSDataCell from EDHandlerXSDataRaddosev10 import EDHandlerXSDataRaddosev10 EDFactoryPluginStatic.loadModule("XSDataRaddosev10") from XSDataRaddosev10 import XSDataRaddoseInput xsDataBeam = XSDataBeam() xsDataBeam.setSize(XSDataSize(x=XSDataLength(0.1), y=XSDataLength(0.1))) xsDataBeam.setWavelength(XSDataWavelength(2.41)) xsDataBeam.setFlux(XSDataFlux(1e+12)) xsDataSample = XSDataSampleCrystalMM() xsDataStructure = XSDataStructure() xsDataComposition = XSDataChemicalCompositionMM() xsDataChain = XSDataChain() xsDataChain.setType(XSDataString("protein")) xsDataChain.setNumberOfCopies(XSDataDouble(2)) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtom1 = XSDataAtom() xsDataAtom1.setSymbol(XSDataString("Se")) xsDataAtom1.setNumberOf(XSDataDouble(4)) xsDataAtomicComposition.addAtom(xsDataAtom1) xsDataAtom2 = XSDataAtom() xsDataAtom2.setSymbol(XSDataString("S")) xsDataAtom2.setNumberOf(XSDataDouble(5)) xsDataAtomicComposition.addAtom(xsDataAtom2) xsDataChain.setHeavyAtoms(xsDataAtomicComposition) xsDataChain.setNumberOfMonomers(XSDataDouble(100)) xsDataStructure.addChain(xsDataChain) xsDataChain2 = XSDataChain() xsDataChain2.setType(XSDataString("rna")) xsDataChain2.setNumberOfCopies(XSDataDouble(1)) xsDataChain2.setNumberOfMonomers(XSDataDouble(60)) xsDataStructure.addChain(xsDataChain2) xsDataLigand = XSDataLigand() xsDataLigand.setNumberOfCopies(XSDataDouble(2)) xsDataLigand.setNumberOfLightAtoms(XSDataDouble(42)) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtom3 = XSDataAtom() xsDataAtom3.setSymbol(XSDataString("Fe")) xsDataAtom3.setNumberOf(XSDataDouble(1)) xsDataAtomicComposition.addAtom(xsDataAtom3) xsDataLigand.setHeavyAtoms(xsDataAtomicComposition) xsDataStructure.addLigand(xsDataLigand) xsDataStructure.setNumberOfCopiesInAsymmetricUnit(XSDataDouble(0.25)) xsDataSolvent = XSDataSolvent() xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtomNa = XSDataAtom() xsDataAtomNa.setSymbol(XSDataString("Na")) xsDataAtomNa.setConcentration(XSDataDouble(1000)) xsDataAtomicComposition.addAtom(xsDataAtomNa) xsDataAtomCl = XSDataAtom() xsDataAtomCl.setSymbol(XSDataString("Cl")) xsDataAtomCl.setConcentration(XSDataDouble(1000)) xsDataAtomicComposition.addAtom(xsDataAtomCl) xsDataSolvent.setAtoms(xsDataAtomicComposition) xsDataComposition.setStructure(xsDataStructure) xsDataComposition.setSolvent(xsDataSolvent) xsDataSample.setChemicalComposition(xsDataComposition) xsDataSample.setSize(XSDataSize(XSDataLength(0.1), XSDataLength(0.1), XSDataLength(0.1))) 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 = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataCrystal.setCell(xsDataCell) xsDataSpaceGroup.setITNumber(XSDataInteger(16)) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataSample.setCrystal(xsDataCrystal) iNumSymOperators = 4 xsDataRaddosev01Input = EDHandlerXSDataRaddosev10().getXSDataRaddoseInput(xsDataBeam, xsDataSample, iNumSymOperators) xsDataRaddosev01Input.exportToFile(self.strObtainedInputFile2) strExpectedInput = EDUtilsTest.readAndParseFile (self.strReferenceInputFile2) strObtainedInput = EDUtilsTest.readAndParseFile (self.strObtainedInputFile2) xsDataInputExpected = XSDataRaddoseInput.parseString(strExpectedInput) xsDataInputObtained = XSDataRaddoseInput.parseString(strObtainedInput) EDAssert.equal(xsDataInputExpected.marshal(), xsDataInputObtained.marshal())
def testCheckParameters(self): pyStrXMLInput = EDUtilsTest.readAndParseFile(self.m_pyStrReferenceInputFile) edPluginControlCopyUnitCellMTZtoPDB = self.createPlugin() edPluginControlCopyUnitCellMTZtoPDB.setDataInput(pyStrXMLInput) edPluginControlCopyUnitCellMTZtoPDB.checkParameters()
def testCheckParameters(self): pyStrXMLInput = EDUtilsTest.readAndParseFile(self.m_pyStrReferenceInputFile) edPluginExecPDBSETUnitCell = self.createPlugin() edPluginExecPDBSETUnitCell.setDataInput(pyStrXMLInput) edPluginExecPDBSETUnitCell.checkParameters()
def testGetXSDataRaddoseInput(self): """ """ from XSDataCommon import XSDataLength from XSDataCommon import XSDataWavelength from XSDataCommon import XSDataFlux from XSDataCommon import XSDataSize from XSDataCommon import XSDataDouble from XSDataCommon import XSDataString from XSDataCommon import XSDataAngle from XSDataCommon import XSDataTime from XSDataCommon import XSDataInteger from XSDataMXv1 import XSDataBeam from XSDataMXv1 import XSDataStructure from XSDataMXv1 import XSDataChain from XSDataMXv1 import XSDataAtom from XSDataMXv1 import XSDataLigand from XSDataMXv1 import XSDataCrystal from XSDataMXv1 import XSDataSpaceGroup from XSDataMXv1 import XSDataSampleCrystalMM from XSDataMXv1 import XSDataChemicalCompositionMM from XSDataMXv1 import XSDataAtomicComposition from XSDataMXv1 import XSDataSolvent from XSDataMXv1 import XSDataCell from EDHandlerXSDataRaddosev10 import EDHandlerXSDataRaddosev10 EDFactoryPluginStatic.loadModule("XSDataRaddosev10") from XSDataRaddosev10 import XSDataRaddoseInput xsDataBeam = XSDataBeam() xsDataBeam.setSize(XSDataSize(x=XSDataLength(0.1), y=XSDataLength(0.1))) xsDataBeam.setWavelength(XSDataWavelength(2.41)) xsDataBeam.setFlux(XSDataFlux(1e+12)) xsDataBeam.setExposureTime(XSDataTime(0.037)) xsDataSample = XSDataSampleCrystalMM() xsDataStructure = XSDataStructure() xsDataComposition = XSDataChemicalCompositionMM() xsDataChain = XSDataChain() xsDataChain.setType(XSDataString("protein")) xsDataChain.setNumberOfCopies(XSDataDouble(2)) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtom1 = XSDataAtom() xsDataAtom1.setSymbol(XSDataString("Se")) xsDataAtom1.setNumberOf(XSDataDouble(4)) xsDataAtomicComposition.addAtom(xsDataAtom1) xsDataAtom2 = XSDataAtom() xsDataAtom2.setSymbol(XSDataString("S")) xsDataAtom2.setNumberOf(XSDataDouble(5)) xsDataAtomicComposition.addAtom(xsDataAtom2) xsDataChain.setHeavyAtoms(xsDataAtomicComposition) xsDataChain.setNumberOfMonomers(XSDataDouble(100)) xsDataStructure.addChain(xsDataChain) xsDataChain2 = XSDataChain() xsDataChain2.setType(XSDataString("rna")) xsDataChain2.setNumberOfCopies(XSDataDouble(1)) xsDataChain2.setNumberOfMonomers(XSDataDouble(60)) xsDataStructure.addChain(xsDataChain2) xsDataLigand = XSDataLigand() xsDataLigand.setNumberOfCopies(XSDataDouble(2)) xsDataLigand.setNumberOfLightAtoms(XSDataDouble(42)) xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtom3 = XSDataAtom() xsDataAtom3.setSymbol(XSDataString("Fe")) xsDataAtom3.setNumberOf(XSDataDouble(1)) xsDataAtomicComposition.addAtom(xsDataAtom3) xsDataLigand.setHeavyAtoms(xsDataAtomicComposition) xsDataStructure.addLigand(xsDataLigand) xsDataStructure.setNumberOfCopiesInAsymmetricUnit(XSDataDouble(0.25)) xsDataSolvent = XSDataSolvent() xsDataAtomicComposition = XSDataAtomicComposition() xsDataAtomNa = XSDataAtom() xsDataAtomNa.setSymbol(XSDataString("Na")) xsDataAtomNa.setConcentration(XSDataDouble(1000)) xsDataAtomicComposition.addAtom(xsDataAtomNa) xsDataAtomCl = XSDataAtom() xsDataAtomCl.setSymbol(XSDataString("Cl")) xsDataAtomCl.setConcentration(XSDataDouble(1000)) xsDataAtomicComposition.addAtom(xsDataAtomCl) xsDataSolvent.setAtoms(xsDataAtomicComposition) xsDataComposition.setStructure(xsDataStructure) xsDataComposition.setSolvent(xsDataSolvent) xsDataSample.setChemicalComposition(xsDataComposition) xsDataSample.setSize( XSDataSize(XSDataLength(0.1), XSDataLength(0.1), XSDataLength(0.1))) 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 = XSDataCrystal() xsDataSpaceGroup = XSDataSpaceGroup() xsDataCrystal.setCell(xsDataCell) xsDataSpaceGroup.setITNumber(XSDataInteger(16)) xsDataCrystal.setSpaceGroup(xsDataSpaceGroup) xsDataSample.setCrystal(xsDataCrystal) iNumSymOperators = 4 iNumberOfImages = 2 xsDataRaddosev01Input = EDHandlerXSDataRaddosev10( ).getXSDataRaddoseInput(xsDataBeam, xsDataSample, iNumSymOperators, iNumberOfImages) xsDataRaddosev01Input.exportToFile(self.strObtainedInputFile2) strExpectedInput = EDUtilsTest.readAndParseFile( self.strReferenceInputFile2) strObtainedInput = EDUtilsTest.readAndParseFile( self.strObtainedInputFile2) xsDataInputExpected = XSDataRaddoseInput.parseString(strExpectedInput) xsDataInputObtained = XSDataRaddoseInput.parseString(strObtainedInput) EDAssert.equal(xsDataInputExpected.marshal(), xsDataInputObtained.marshal())