本文整理汇总了Python中Transform.getMaxQ方法的典型用法代码示例。如果您正苦于以下问题:Python Transform.getMaxQ方法的具体用法?Python Transform.getMaxQ怎么用?Python Transform.getMaxQ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform.getMaxQ方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: integrate
# 需要导入模块: import Transform [as 别名]
# 或者: from Transform import getMaxQ [as 别名]
def integrate(self,diffractionData,calibrationData,lower,
upper,num,constraintLower,constraintUpper,doConstraint,
doPolarizationCorrection,P,
typeOfIntegration,typeOfConstraint,maskedPixelInfo):
if typeOfIntegration == 'Q':
if lower >= upper:
raise Exception("Unable to integrate the intensity. The lower Q value must be less then the upper Q value")
if lower < 0:
raise Exception("Unable to integrate intensity. The lower Q value must be larger then 0.")
if upper > Transform.getMaxQ(calibrationData):
raise Exception("Unable to integrate intensity. The upper Q value must be less then the largest possible Q value.")
if num < 1:
raise Exception("Unable to integrate intensity. The number of Q must be at least 1.")
elif typeOfIntegration == '2theta':
if lower >= upper:
raise Exception("Unable to integrate the intensity. The lower 2theta value must be less then the upper 2theta value")
if lower < 0:
raise Exception("Unable to integrate intensity. The lower 2theta value must be larger then 0.")
if upper > 90:
raise Exception("Unable to integrate intensity. The upper 2theta value must be smaller then 90.")
if num < 1:
raise Exception("Unable to integrate intensity. The number of 2theta must be at least 1.")
elif typeOfIntegration == 'chi':
if lower >= upper:
raise Exception("Unable to integrate the intensity. The lower chi value must be less then the upper chi value")
if lower < -360:
raise Exception("Unable to integrate intensity. The lower chi value must be larger then -360 degrees.")
if upper > +360:
raise Exception("Unable to integrate intensity. The upper chi value must be lower then 360 degrees.")
if upper - lower > 360:
raise Exception("Unable to integrate intensity. The chi range can be at most 360 degrees.")
if num < 1:
raise Exception("Unable to integrate intensity. The number of chi must be at least 1.")
else:
raise Exception("Unable to integrate intensity. The function integrate must be passed for the parameter typeOfIntegration either 'Q', '2theta', or 'chi'")
if doConstraint:
if (typeOfIntegration == 'Q' or typeOfIntegration == '2theta') and \
typeOfConstraint == 'chi':
if constraintLower >= constraintUpper:
raise Exception("Unable to integrate the intensity. The constraint lower chi value must be less then the upper chi value")
if constraintLower < -360:
raise Exception("Unable to integrate intensity. The constraint lower chi value must be larger then -360 degrees.")
if constraintUpper > +360:
raise Exception("Unable to integrate intensity. The constraint upper chi value must be lower then 360 degrees.")
if constraintUpper - constraintLower > 360:
raise Exception("Unable to integrate intensity. The constraint chi range can be at most 360 degrees.")
elif (typeOfIntegration == 'chi' and typeOfConstraint == 'Q'):
if constraintLower >= constraintUpper:
raise Exception("Unable to integrate the intensity. The constraint lower Q value must be less then the upper Q value")
if constraintLower < 0:
raise Exception("Unable to integrate intensity. The constraint lower Q value must be larger then 0.")
if constraintUpper > Transform.getMaxQ(calibrationData):
raise Exception("Unable to integrate intensity. The constraint upper Q value must be less then the largest possible Q value.")
elif (typeOfIntegration == 'chi' and typeOfConstraint == '2theta'):
if constraintLower >= constraintUpper:
raise Exception("Unable to integrate the intensity. The constraint lower 2theta value must be less then the upper 2theta value")
if constraintLower < 0:
raise Exception("Unable to integrate intensity. The constraint lower 2theta value must be larger then 0.")
if constraintUpper > 90:
raise Exception("Unable to integrate intensity. The constraint upper 2theta value must be smaller then 90.")
else:
raise Exception("Constraint must be of the from chi, 2theta, or Q. Also, the constraint must be different from the type of integration.")
if maskedPixelInfo.doLessThanMask:
lessThanMask = maskedPixelInfo.lessThanMask
else:
# We can just send the function a bunch of junk since it won't be used
lessThanMask = -1
if maskedPixelInfo.doGreaterThanMask:
greaterThanMask = maskedPixelInfo.greaterThanMask
else:
greaterThanMask = -1
#.........这里部分代码省略.........
示例2: cake
# 需要导入模块: import Transform [as 别名]
# 或者: from Transform import getMaxQ [as 别名]
def cake(self,diffractionData,calibrationData,qLower,qUpper,numQ,
chiLower,chiUpper,numChi,doPolarizationCorrection,P,
maskedPixelInfo):
if chiLower >= chiUpper:
raise Exception("Unable to cake. The lower chi value must be less then the upper chi value.")
if (chiUpper - chiLower) > 360:
raise Exception("The chi values must have a range no larger then 360 degrees.")
if qLower >= qUpper:
raise Exception("Unable to cake. The lower q value must be less then the upper q value.")
if qLower < 0:
raise Exception("Unable to cake. The lower q value must be larger then 0.")
if qUpper > Transform.getMaxQ(calibrationData):
raise Exception("Unable to cake. The upper q value must be less then the largest possible Q value.")
if maskedPixelInfo.doLessThanMask:
lessThanMask = maskedPixelInfo.lessThanMask
else:
# We can just send the function a bunch of junk since it won't be used
lessThanMask = -1
if maskedPixelInfo.doGreaterThanMask:
greaterThanMask = maskedPixelInfo.greaterThanMask
else:
greaterThanMask = -1
if maskedPixelInfo.doPolygonMask:
polygonsX = maskedPixelInfo.polygonsX
polygonsY = maskedPixelInfo.polygonsY
polygonBeginningsIndex = maskedPixelInfo.polygonBeginningsIndex
polygonNumberOfItems = maskedPixelInfo.polygonNumberOfItems
else:
polygonsX = Numeric.array([])
polygonsY = Numeric.array([])
polygonBeginningsIndex = Numeric.array([])
polygonNumberOfItems = Numeric.array([])
# use the wraped C code to do the caking
self.cakeData = DiffractionAnalysisWrap.cake(
diffractionData,
calibrationData.getCenterX()['val'],
calibrationData.getCenterY()['val'],
calibrationData.getDistance()['val'],
calibrationData.getEnergy()['val'],
calibrationData.getAlpha()['val'],
calibrationData.getBeta()['val'],
calibrationData.getRotation()['val'],
qLower, qUpper,
numQ,
chiLower, chiUpper,
numChi,
doPolarizationCorrection, P,
maskedPixelInfo.doGreaterThanMask, greaterThanMask,
maskedPixelInfo.doLessThanMask, lessThanMask,
maskedPixelInfo.doPolygonMask,
polygonsX, polygonsY,
polygonBeginningsIndex,
polygonNumberOfItems,
calibrationData.getPixelLength()['val'],
calibrationData.getPixelHeight()['val'])
if type(self.cakeData) == type(None):
raise Exception("Error occured while caking the data.")
# store the values for later
self.qLower=qLower
self.qUpper=qUpper
self.numQ=numQ
self.chiLower=chiLower
self.chiUpper=chiUpper
self.numChi=numChi
self.doPolarizationCorrection=doPolarizationCorrection
self.P=P
# We should make a shallow copy so that the widget dose
# not get copied over. Nevertheless, all the stuff we
# care about are single values so they will get really copied over
self.maskedPixelInfo = copy.copy(maskedPixelInfo)
self.calibrationData = copy.deepcopy(calibrationData)
self.diffractionData = diffractionData