本文整理汇总了Python中Transform.convertWavelengthToEnergy方法的典型用法代码示例。如果您正苦于以下问题:Python Transform.convertWavelengthToEnergy方法的具体用法?Python Transform.convertWavelengthToEnergy怎么用?Python Transform.convertWavelengthToEnergy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform.convertWavelengthToEnergy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setWavelength
# 需要导入模块: import Transform [as 别名]
# 或者: from Transform import convertWavelengthToEnergy [as 别名]
def setWavelength(self,val,fixed=0,lower=None,upper=None):
if fixed != 0 and fixed != 1:
raise UserInputException("Cannot set the wavelength because fixed must be set to 0 or 1.")
if lower != None and lower >= val:
raise UserInputException("Cannot set the wavelength because the lower bound on wavelength must be less then the value.")
if upper != None and upper <= val:
raise UserInputException("Cannot set the wavelength because the upper bound on wavelength must be greater then the value.")
if val <= 0:
raise UserInputException("Cannot set the wavelength because it must be a positive quantity.")
val = Transform.convertWavelengthToEnergy(val)
if lower != None: lower=hc/upper
if upper != None: upper=hc/lower
# note that a low wavelength is the same as a high energy and vice versa!
self.energy = {'val':val,'fixed':fixed,'lower':upper,'upper':lower}