本文整理汇总了Python中EDUtilsUnit.EDUtilsUnit.toXSD方法的典型用法代码示例。如果您正苦于以下问题:Python EDUtilsUnit.toXSD方法的具体用法?Python EDUtilsUnit.toXSD怎么用?Python EDUtilsUnit.toXSD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EDUtilsUnit.EDUtilsUnit
的用法示例。
在下文中一共展示了EDUtilsUnit.toXSD方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: unitTestToXSD
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import toXSD [as 别名]
def unitTestToXSD(self):
"""
"""
EDVerbose.DEBUG("EDTestCaseEDUtilsUnit.unitTestToXSD")
xsdObt = EDUtilsUnit.toXSD(XSDataLength, "1.5 mm")
xsdExp = XSDataLength(1.5)
xsdExp.setUnit(XSDataString("mm"))
EDAssert.equal(xsdExp.marshal(), xsdObt.marshal(), "XML representation are the same")
示例2: unitTestGetValueLength
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import toXSD [as 别名]
def unitTestGetValueLength(self):
"""
Test conversion in length
"""
EDVerbose.DEBUG("EDTestCaseEDUtilsUnit.unitTestGetValueLength")
EDAssert.equal(0.0452, EDUtilsUnit.getValue(EDUtilsUnit.toXSD(XSDataLength, "45.2 um"), "mm"), "Length Conversion um -> mm ")
示例3: unitTestGetValueAngle
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import toXSD [as 别名]
def unitTestGetValueAngle(self):
"""
Test conversion in length
"""
EDVerbose.DEBUG("EDTestCaseEDUtilsUnit.unitTestGetValueAngle")
EDAssert.equal(100.0, EDUtilsUnit.getValue(EDUtilsUnit.toXSD(XSDataAngle, "90 deg"), "grad"), "Length Conversion deg -> grad ")
示例4: unitTestGetValueTime
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import toXSD [as 别名]
def unitTestGetValueTime(self):
"""
Test conversion in Time
"""
EDVerbose.DEBUG("EDTestCaseEDUtilsUnit.unitTestGetValueTime")
EDAssert.equal(60.0, EDUtilsUnit.getValue(EDUtilsUnit.toXSD(XSDataTime, "1 h"), "mn"), "Length Conversion h -> mn ")
示例5: doSuccessReadHeader
# 需要导入模块: from EDUtilsUnit import EDUtilsUnit [as 别名]
# 或者: from EDUtilsUnit.EDUtilsUnit import toXSD [as 别名]
def doSuccessReadHeader(self, _edPlugin=None):
EDVerbose.DEBUG("EDPluginControlDiffractionCTv1_1.doSuccessReadHeader")
self.retrieveSuccessMessages(_edPlugin, "EDPluginControlDiffractionCTv1_1.doSuccessReadHeader")
# Translate dictionary to image and instrument objects
xsDataInputPowderIntegration = XSDataInputPowderIntegration()
self.xsDataDiffractionCTInstrument = XSDataDiffractionCTInstrument()
self.xsDataDiffractionCTImage = XSDataDiffractionCTImage()
xsDataDictionaryHeader = self.edPluginReadHeader.getDataOutput().getDictionary()
for xsDataKeyValuePair in xsDataDictionaryHeader.getKeyValuePair():
strKey = str(xsDataKeyValuePair.getKey().getValue())
lstValue = xsDataKeyValuePair.getValue().getValue().split()
if len(lstValue) == 2:
strValue = lstValue[0]
strUnit = lstValue[1]
else:
strValue = xsDataKeyValuePair.getValue().getValue()
strUnit = None
if (strKey == "_diffrn_radiation_wavelength"):
xsd = EDUtilsUnit.toXSD(XSDataWavelength, strValue)
# if strUnit is None: strUnit = "A"
# xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_diffrn_radiation_wavelength(xsd)
elif (strKey == "_pd_instr_dist_spec/detc"):
xsd = EDUtilsUnit.toXSD(XSDataLength, strValue)
# if strUnit is None: strUnit = "mm"
# xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_pd_instr_dist_spec_detc(xsd)
elif (strKey == "_pd_meas_2theta_range_max"):
xsd = XSDataAngle(float(strValue))
if strUnit is None: strUnit = "deg"
xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_pd_meas_2theta_range_max(xsd)
elif (strKey == "_pd_meas_2theta_range_min"):
xsd = XSDataAngle(float(strValue))
if strUnit is None: strUnit = "deg"
xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_pd_meas_2theta_range_min(xsd)
elif (strKey == "_pd_meas_2theta_range_inc"):
xsd = XSDataAngle(float(strValue))
if strUnit is None: strUnit = "deg"
xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_pd_meas_2theta_range_inc(xsd)
elif (strKey == "_synchrotron_photon-flux"):
self.xsDataDiffractionCTInstrument.set_synchrotron_photon_flux(XSDataFlux(float(strValue)))
elif (strKey == "_synchrotron_ring-intensity"):
self.xsDataDiffractionCTInstrument.set_synchrotron_ring_intensity(XSDataDouble(float(strValue)))
elif (strKey == "_tomo_scan_ampl"):
xsd = XSDataAngle(float(strValue))
if strUnit is None: strUnit = "deg"
xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_tomo_scan_ampl(xsd)
elif (strKey == "_tomo_scan_type"):
self.xsDataDiffractionCTInstrument.set_tomo_scan_type(XSDataString(strValue))
elif (strKey == "_tomo_spec_displ_rotation"):
xsd = XSDataAngle(float(strValue))
if strUnit is None: strUnit = "deg"
xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_tomo_spec_displ_rotation(xsd)
elif (strKey == "_tomo_spec_displ_rotation_inc"):
xsd = XSDataAngle(float(strValue))
if strUnit is None: strUnit = "deg"
xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_tomo_spec_displ_rotation_inc(xsd)
elif (strKey == "_tomo_spec_displ_x"):
xsd = EDUtilsUnit.toXSD(XSDataLength, strValue)
# if strUnit is None: strUnit = "mm"
# xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_tomo_spec_displ_x(xsd)
elif (strKey == "_tomo_spec_displ_x_inc"):
xsd = EDUtilsUnit.toXSD(XSDataLength, strValue)
# if strUnit is None: strUnit = "mm"
# xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_tomo_spec_displ_x_inc(xsd)
elif (strKey == "_tomo_spec_displ_x_max"):
xsd = XSDataLength(float(strValue))
if strUnit is None: strUnit = "mm"
xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_tomo_spec_displ_x_max(xsd)
elif (strKey == "_tomo_spec_displ_x_min"):
xsd = XSDataLength(float(strValue))
if strUnit is None: strUnit = "mm"
xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_tomo_spec_displ_x_min(xsd)
elif (strKey == "_tomo_spec_displ_z"):
xsd = XSDataLength(float(strValue))
if strUnit is None: strUnit = "mm"
xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_tomo_spec_displ_z(xsd)
elif (strKey == "_tomo_spec_displ_z_inc"):
xsd = XSDataLength(float(strValue))
if strUnit is None: strUnit = "mm"
xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_tomo_spec_displ_z_inc(xsd)
elif (strKey == "_tomo_spec_displ_z_max"):
xsd = XSDataLength(float(strValue))
if strUnit is None: strUnit = "mm"
xsd.setUnit(XSDataString(strUnit))
self.xsDataDiffractionCTInstrument.set_tomo_spec_displ_z_max(xsd)
elif (strKey == "_tomo_spec_displ_z_min"):
#.........这里部分代码省略.........