本文整理汇总了Python中EDUtilsTest.EDUtilsTest.readAndParseFile方法的典型用法代码示例。如果您正苦于以下问题:Python EDUtilsTest.readAndParseFile方法的具体用法?Python EDUtilsTest.readAndParseFile怎么用?Python EDUtilsTest.readAndParseFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EDUtilsTest.EDUtilsTest
的用法示例。
在下文中一共展示了EDUtilsTest.readAndParseFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testGenerateXSDataIndexingResult
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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())
示例2: testGenerateXSDataInputXDSIndexing
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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())
示例3: testGenerateXSDataResultPowderIntegration
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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())
示例4: testGenerateXSDataMOSFLMInputIntegration
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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())
示例5: testGenerateXSDataIndexingResult
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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())
示例6: testSpatialDistortion
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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")
示例7: testFileNameExtraction
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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)
示例8: testSetDataInput
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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 )
示例9: testDropFileCreation
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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"))
示例10: testGenerateXSDataInputLabelit
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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())
示例11: testCleanDispMat
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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()
示例12: testIgnoreFile
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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)
示例13: testGenerateSPDCommand
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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)
示例14: testGenerateXSDataInputBestv1_2
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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())
示例15: testSetDataInput
# 需要导入模块: from EDUtilsTest import EDUtilsTest [as 别名]
# 或者: from EDUtilsTest.EDUtilsTest import readAndParseFile [as 别名]
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 )