本文整理汇总了Python中XSDataCommon.XSDataFile类的典型用法代码示例。如果您正苦于以下问题:Python XSDataFile类的具体用法?Python XSDataFile怎么用?Python XSDataFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XSDataFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: characteriseWithXmlInput
def characteriseWithXmlInput(self, data_collection_id, sampleCharacteriseIndex, beamsize):
if data_collection_id is not None:
self.ednaInput.setDataCollectionId(XSDataInteger(data_collection_id))
else:
self.ednaInput.setDataCollectionId(None)
logging.getLogger().warning("The data collection ID is not known for this characterisation. Therefore the EDNA results cannot be put into the database")
# build data set
imageSuffix = self.beamlinePars["BCM_PARS"].getProperty("FileSuffix")
dataSetObj = XSDataMXCuBEDataSet()
self.ednaInput.setDataSet([])
methodDCNo = len(self.current_method[1])
for methodIndex in range(methodDCNo):
number_of_images = self.current_method[1][methodIndex]['number_of_images']
imageNameIdx = self.current_method[0]
listIndex = sampleCharacteriseIndex * methodDCNo + methodIndex
for imageno in range(int(number_of_images)):
imageFileObj = XSDataFile()
pathStrObj = XSDataString()
pathStrObj.setValue(('%s/%s_%d_%04d.%s' % (self.collectSeqList[listIndex]['fileinfo']['directory'],\
self.collectSeqList[listIndex]['fileinfo']['prefix'],\
int(self.collectSeqList[listIndex]['fileinfo']['run_number']),\
imageno+1,imageSuffix)))
imageFileObj.setPath(pathStrObj)
dataSetObj.addImageFile(imageFileObj)
self.ednaInput.addDataSet(dataSetObj)
if TEST:
self.ednaInput.getDataSet()[0].getImageFile()[0].getPath().setValue("/opt/pxsoft/DNA/TestCase/ref-testscale_1_001.img")
self.ednaInput.getDataSet()[0].getImageFile()[1].getPath().setValue("/opt/pxsoft/DNA/TestCase/ref-testscale_1_002.img")
path = self.process_dir
suffix = '_%s.xml' % (self.ednaInput.getDataCollectionId().getValue() or id(self.ednaInput))
ednaResultsFile = os.path.join(path, 'EDNAOutput%s' % suffix)
ednaInputXMLFile = os.path.join(path, 'EDNAInput%s' % suffix)
if not os.path.isdir(path):
os.makedirs(path)
beamObj = self.ednaInput.getExperimentalCondition().getBeam()
beamObj.setSize(XSDataSize(x=XSDataLength(float(beamsize[0])),y=XSDataLength(float(beamsize[1]))))
""" create an edna input file using the ednainput model """
ednaInputXML = self.ednaInput.exportToFile(ednaInputXMLFile)
logging.getLogger().info("Starting Edna using xml file, %s" % ednaInputXMLFile)
# use an intermediate script to run edna with its command line options
edna_args = "%s %s %s" % (ednaInputXMLFile,ednaResultsFile,path)
edna_cmd=self.StartEdnaCommand+" "+edna_args
if self.ednaPollTimer is None:
self.ednaPollTimer = qt.QTimer()
qt.QObject.connect(self.ednaPollTimer,qt.SIGNAL("timeout()"), self.pollEDNA)
logging.getLogger().debug(edna_cmd)
EDNA_PROCESSES.append(EnhancedPopen.Popen(edna_cmd,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True,universal_newlines=True))
self.EDNAResultsFiles[id(EDNA_PROCESSES[-1])]=ednaResultsFile
# save image prefix,etc. for next step
# only take first image, since we just want to have image prefix, run number, etc. :
# it is the same within the whole collectSeqList (hopefully)
imagePrefix = self.collectSeqList[0]['fileinfo']['prefix'][4:] #remove ref-
self.imagePathProperties[id(EDNA_PROCESSES[-1])]={"imagePrefix":imagePrefix, "imageDir": self.collectSeqList[0]['fileinfo']['directory'], "lRunN": int(self.collectSeqList[0]['fileinfo']['run_number'])}
self.ednaPollTimer.start(100)
示例2: buildChildren
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'inputMatrixFile':
obj_ = XSDataFile()
obj_.build(child_)
self.setInputMatrixFile(obj_)
XSDataInput.buildChildren(self, child_, nodeName_)
示例3: buildChildren
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'hklfile':
obj_ = XSDataFile()
obj_.build(child_)
self.setHklfile(obj_)
XSDataResult.buildChildren(self, child_, nodeName_)
示例4: doSuccessSaxsMac
def doSuccessSaxsMac(self, _edPlugin=None):
EDVerbose.DEBUG("EDPluginBioSaxsAveragev1_0.doSuccessSaxsMac")
self.retrieveSuccessMessages(_edPlugin, "EDPluginBioSaxsAveragev1_0.doSuccessSaxsMac")
strEdnaLogFile = os.path.join(_edPlugin.getWorkingDirectory(), _edPlugin.getScriptLogFileName())
EDVerbose.DEBUG("ExecPlugin log file is in: %s" % strEdnaLogFile)
if os.path.isfile(strEdnaLogFile):
shutil.copy(strEdnaLogFile, self.strLogFile)
xsLogFile = XSDataFile()
xsLogFile.setPath(XSDataString(self.strLogFile))
self.xsdResult.setLogFile(xsLogFile)
xsdiMetadata = XSDataInputBioSaxsMetadatav1_0()
xsdiMetadata.setInputImage(self.dataInput.getAveragedImage())
xsdiMetadata.setOutputImage(self.dataInput.getAveragedImage())
xsdiMetadata.setConcentration(self.xsdMetadata.concentration)
xsdiMetadata.setComments(self.xsdMetadata.comments)
xsdiMetadata.setCode(self.xsdMetadata.code)
xsdiMetadata.setDetector(self.xsdMetadata.getDetector())
xsdiMetadata.setDetectorDistance(self.xsdMetadata.detectorDistance)
xsdiMetadata.setPixelSize_1(self.xsdMetadata.pixelSize_1)
xsdiMetadata.setPixelSize_2(self.xsdMetadata.pixelSize_2)
xsdiMetadata.setBeamCenter_1(self.xsdMetadata.beamCenter_1)
xsdiMetadata.setBeamCenter_2(self.xsdMetadata.beamCenter_2)
xsdiMetadata.setWavelength(self.xsdMetadata.wavelength)
xsdiMetadata.setMachineCurrent(self.xsdMetadata.machineCurrent)
xsdiMetadata.setMaskFile(self.xsdMetadata.maskFile)
xsdiMetadata.setNormalizationFactor(self.xsdMetadata.normalizationFactor)
self.__edPluginSaxsSetMetadata.setDataInput(xsdiMetadata)
self.__edPluginSaxsSetMetadata.connectSUCCESS(self.doSuccessSetMetadata)
self.__edPluginSaxsSetMetadata.connectFAILURE(self.doFailureSetMetadata)
self.__edPluginSaxsSetMetadata.executeSynchronous()
示例5: postProcess
def postProcess(self, _edObject=None):
"""
postProcess of the plugin EDPluginSPDCorrectv10.py:
- convert to HDF if needed (to be implemented)
- move images (if needed)
- set result XML
"""
EDPluginExecProcess.postProcess(self)
self.DEBUG("EDPluginSPDCorrectv10.postProcess")
EDUtilsPath.createFolder(self.dictGeometry["OutputDir"])
if self.getClassName() == "EDPluginSPDCorrectv10":
strInputImagePathNoSfx = os.path.splitext(os.path.basename(self.pathToInputFile))[0]
destFileBaseName = strInputImagePathNoSfx + self.dictGeometry["OutputFileType"]
strOutputFilePath = os.path.join(self.dictGeometry["OutputDir"], destFileBaseName)
if not self._bFireAndForget:
if "corrected" in self.dictRes:
strTempFilePath = self.dictRes["corrected"]
else:
strTempFilePath = os.path.join(self.getWorkingDirectory(), destFileBaseName)
if self.dictGeometry["OutputFileType"].lower() in [".hdf5", ".nexus", ".h5", ".nx"]:
self.WARNING("HDF5/Nexus output is not yet implemented in the SPD plugin.")
if os.path.exists(strOutputFilePath):
self.WARNING("Destination file exists, I will leave result file in %s." % strTempFilePath)
strOutputFilePath = strTempFilePath
else:
shutil.move(strTempFilePath, strOutputFilePath)
# # Create the output data
xsDataFile = XSDataFile()
xsDataFile.setPath(XSDataString(strOutputFilePath))
xsDataResultSPD = XSDataResultSPD()
xsDataResultSPD.setCorrectedFile(xsDataFile)
self.setDataOutput(xsDataResultSPD)
示例6: doSuccessExecSPDCake
def doSuccessExecSPDCake(self, _edPlugin=None):
self.synchronizeOn()
self.DEBUG("EDPluginControlID11v1_0.doSuccessExecSPDCake")
self.retrieveSuccessMessages(_edPlugin, "EDPluginControlID11v1_0.doSuccessExecSPDCake")
xsdOut = _edPlugin.getDataOutput()
xsdAzimFile = xsdOut.getCakedFile()
xsdIn = XSDataInput1DPowderEDF()
xsdIn.setEdfFile(xsdAzimFile)
strInputFile = os.path.basename(_edPlugin.getDataInput().getInputFile().getPath().getValue())
xsdFile = XSDataFile()
xsdFile.setPath(XSDataString(
os.path.join(self.__dictID11["output_dir"], os.path.splitext(strInputFile)[0] + "." + self.__dictID11["output_extn"])
))
xsdIn.setOutputFile(xsdFile)
xsdIn.setEdfFile(xsdOut.getCakedFile())
xsdIn.setOutputFormat(XSDataString(self.__dictID11["output_extn"]))
xsdIn.setNumberOfBins(XSDataInteger(int(self.__dictID11["RADIAL BINS"])))
# EDF Launch
edPluginEDF = self.loadPlugin(self.__strControlledPluginEDF)
edPluginEDF.setDataInput(xsdIn)
edPluginEDF.connectSUCCESS(self.doSuccessExec1DPowderEDF)
edPluginEDF.connectFAILURE(self.doFailureExec1DPowderEDF)
edPluginEDF.execute()
self.synchronizeOff()
示例7: doSuccessExecSaxsMac
def doSuccessExecSaxsMac(self, _edPlugin=None):
self.DEBUG("EDPluginBioSaxsNormalizev1_0.doSuccessExecSaxsMac")
self.retrieveSuccessMessages(_edPlugin, "EDPluginBioSaxsNormalizev1_0.doSuccessExecSaxsMac")
strEdnaLogFile = os.path.join(
self.__edPluginExecSaxsMac.getWorkingDirectory(), self.__edPluginExecSaxsMac.getScriptLogFileName()
)
self.DEBUG("ExecPlugin log file is in: %s" % strEdnaLogFile)
if os.path.isfile(self.strNormalizedImage) and self.isVerboseDebug():
shutil.copy(self.strNormalizedImage, self.strNormalizedImage + ".bak")
if os.path.isfile(strEdnaLogFile):
shutil.copy(strEdnaLogFile, self.strLogFile)
xsLogFile = XSDataFile()
xsLogFile.setPath(XSDataString(self.strLogFile))
self.xsdResult.setLogFile(xsLogFile)
xsdiMetadata = XSDataInputBioSaxsMetadatav1_0()
xsdiMetadata.setInputImage(self.xsdInput.normalizedImage)
xsdiMetadata.setOutputImage(self.xsdInput.normalizedImage)
xsdiMetadata.setBeamStopDiode(self.xsdInput.experimentSetup.beamStopDiode)
xsdiMetadata.setNormalizationFactor(self.xsdInput.experimentSetup.normalizationFactor)
xsdiMetadata.setDetector(self.xsdInput.experimentSetup.getDetector())
xsdiMetadata.setMachineCurrent(self.xsdInput.experimentSetup.machineCurrent)
xsdiMetadata.setMaskFile(self.xsdInput.experimentSetup.maskFile)
xsdiMetadata.setDetectorDistance(self.xsdInput.experimentSetup.detectorDistance)
xsdiMetadata.setWavelength(self.xsdInput.experimentSetup.wavelength)
xsdiMetadata.setPixelSize_1(self.xsdInput.experimentSetup.pixelSize_1)
xsdiMetadata.setPixelSize_2(self.xsdInput.experimentSetup.pixelSize_2)
xsdiMetadata.setBeamCenter_1(self.xsdInput.experimentSetup.beamCenter_1)
xsdiMetadata.setBeamCenter_2(self.xsdInput.experimentSetup.beamCenter_2)
xsdiMetadata.setConcentration(self.xsdInput.sample.concentration)
xsdiMetadata.setComments(self.xsdInput.sample.comments)
xsdiMetadata.setCode(self.xsdInput.sample.code)
self.__edPluginExecMetadata.setDataInput(xsdiMetadata)
示例8: buildChildren
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'image':
obj_ = XSDataFile()
obj_.build(child_)
self.image.append(obj_)
XSDataInput.buildChildren(self, child_, nodeName_)
示例9: buildChildren
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'outputFilePath':
obj_ = XSDataFile()
obj_.build(child_)
self.setOutputFilePath(obj_)
XSDataResult.buildChildren(self, child_, nodeName_)
示例10: buildChildren
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'fileGraph':
obj_ = XSDataFile()
obj_.build(child_)
self.fileGraph.append(obj_)
XSDataResult.buildChildren(self, child_, nodeName_)
示例11: functionXMLin
def functionXMLin(_strFilename):
"""Here we create the XML string to be passed to the EDNA plugin from the input strFilename
This can / should be modified by the final user
@param _strFilename: full path of the input file
@type _strFilename: python string representing the path
@return: string
"""
EDVerbose.screen("Starting processing of image %s" % (_strFilename))
# First check if the filename end with .img or .mccd:
strXML = None
if _strFilename.endswith(".img") or _strFilename.endswith(".mccd") or _strFilename.endswith(".cbf"):
xsDataInputGridScreening = XSDataInputGridScreening()
xsDataDiffractionPlan = XSDataDiffractionPlan()
xsDataDiffractionPlan.setMaxExposureTimePerDataCollection(
XSDataTime(EDParallelExecuteGridScreening.fMaxExposureTime)
)
xsDataInputGridScreening.setDiffractionPlan(xsDataDiffractionPlan)
xsDataFile = XSDataFile()
xsDataFile.setPath(XSDataString(_strFilename))
xsDataInputGridScreening.setImageFile(xsDataFile)
if EDParallelExecuteGridScreening.bOnlyImageQualityIndicators:
xsDataInputGridScreening.setDoOnlyImageQualityIndicators(XSDataBoolean(True))
if EDParallelExecuteGridScreening.bStoreInISPyB:
xsDataInputGridScreening.setStoreImageQualityIndicatorsInISPyB(XSDataBoolean(True))
if EDParallelExecuteGridScreening.bDoOnlyIntegrationWithXMLOutput:
xsDataInputGridScreening.setDoOnlyIntegrationWithXMLOutput(XSDataBoolean(True))
strXML = xsDataInputGridScreening.marshal()
else:
EDVerbose.screen("File name not ending with .img or .mccd - ignored : %s" % _strFilename)
return strXML
示例12: createInputCharacterisationFromImageHeaders
def createInputCharacterisationFromImageHeaders(self, _edPlugin):
self.DEBUG("EDPluginControlInterfacev1_3.createInputCharacterisationFromImageHeaders")
xsDataInputSubWedgeAssemble = XSDataInputSubWedgeAssemble()
for xsDataStringImagePath in self.listImagePaths:
xsDataFile = XSDataFile()
xsDataFile.setPath(xsDataStringImagePath)
xsDataInputSubWedgeAssemble.addFile(xsDataFile)
_edPlugin.setDataInput(xsDataInputSubWedgeAssemble)
_edPlugin.executeSynchronous()
示例13: postProcess
def postProcess(self, _edObject=None):
EDPluginExecProcessScript.postProcess(self)
EDVerbose.DEBUG("*** EDPluginFIT2DCakev1_0.postProcess")
# Create the output data
xsDataResultFIT2DCake = XSDataResultFIT2DCake()
if (self.m_strOutputFilePath is not None):
xsDataFile = XSDataFile()
xsDataFile.setPath(XSDataString(self.m_strOutputFilePath))
xsDataResultFIT2DCake.setResultFile(xsDataFile)
self.setDataOutput(xsDataResultFIT2DCake)
示例14: postProcess
def postProcess(self, _edObject=None):
EDPluginExecProcessScript.postProcess(self)
self.DEBUG("EDPluginExecSiftDescriptorv1_0.postProcess")
# Create some output data
xsDataResult = XSDataResultSiftDescriptor()
if os.path.isfile(self.strKeys):
xsdFile = XSDataFile()
xsdFile.setPath(XSDataString(self.strKeys))
xsDataResult.setDescriptorFile(xsdFile)
self.setDataOutput(xsDataResult)
示例15: postProcess
def postProcess(self, _edObject=None):
EDPluginExecProcessScript.postProcess(self)
EDVerbose.DEBUG("EDPluginExecVideov10.postProcess")
# Create some output data
xsDataResult = XSDataResultExecVideo()
xsDataFile = XSDataFile()
xsDataFile.setPath(XSDataString(self.videoFile))
xsDataResult.setVideoPath(xsDataFile)
xsDataResult.setVideoPath(xsDataFile)
xsDataResult.setVideoCodec(XSDataString(self.codec))
self.setDataOutput(xsDataResult)