當前位置: 首頁>>代碼示例>>Python>>正文


Python Transform.getMaxQ方法代碼示例

本文整理匯總了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
#.........這裏部分代碼省略.........
開發者ID:joshualande,項目名稱:AreaDiffractionMachine,代碼行數:103,代碼來源:IntegrateIntensity.py

示例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
開發者ID:joshualande,項目名稱:AreaDiffractionMachine,代碼行數:89,代碼來源:Cake.py


注:本文中的Transform.getMaxQ方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。