コード例 #1
0
ファイル: log2_scale_engine.py プロジェクト: neojjang/friture
    def autoScale(self, maxSteps, x1, x2):  #, stepSize):
        print "plouf autoScale"
        if (x1 > x2):
            y = x2.copy()
            x2 = x1
            x1 = y

        interval = QwtDoubleInterval(x1 / pow(10.0, lowerMargin()),
                                     x2 * pow(10.0, upperMargin()))

        logRef = 1.0
        if reference() > LOG_MIN / 2:
            logRef = min(reference(), LOG_MAX / 2)

        if testAttribute(QwtScaleEngine.Symmetric):
            delta = max(interval.maxValue() / logRef,
                        logRef / interval.minValue())
            interval.setInterval(logRef / delta, logRef * delta)

        if testAttribute(QwtScaleEngine.IncludeReference):
            interval = interval.extend(logRef)

        interval = interval.limited(LOG_MIN, LOG_MAX)

        if interval.width() == 0.0:
            interval = self.buildInterval(interval.minValue())

        stepSize = self.divideInterval(
            self.log10(interval).width(), max(maxNumSteps, 1))
        stepSize = max(stepSize, 1.0)

        if not testAttribute(QwtScaleEngine.Floating):
            interval = self.align(interval, stepSize)

        x1 = interval.minValue()
        x2 = interval.maxValue()

        if testAttribute(QwtScaleEngine.Inverted):
            y = x2.copy()
            x2 = x1
            x1 = y
            stepSize = -stepSize

        return (x1, x2, stepSize)
コード例 #2
0
ファイル: log2_scale_engine.py プロジェクト: MihailJP/friture
	def autoScale(self, maxSteps, x1, x2):#, stepSize):
		print("plouf autoScale")
		if ( x1 > x2 ):
			y = x2.copy()
			x2 = x1
			x1 = y
		
		interval = QwtDoubleInterval(x1 / pow(10.0, lowerMargin()), x2 * pow(10.0, upperMargin()) )
		
		logRef = 1.0
		if reference() > LOG_MIN / 2:
			logRef = min(reference(), LOG_MAX/2)
		
		if testAttribute(QwtScaleEngine.Symmetric):
			delta = max(interval.maxValue() / logRef, logRef / interval.minValue())
			interval.setInterval(logRef / delta, logRef * delta)
		
		if testAttribute(QwtScaleEngine.IncludeReference):
			interval = interval.extend(logRef)
		
		interval = interval.limited(LOG_MIN, LOG_MAX)
		
		if interval.width() == 0.0:
			interval = self.buildInterval(interval.minValue())
		
		stepSize = self.divideInterval(self.log10(interval).width(), max(maxNumSteps, 1))
		stepSize = max(stepSize, 1.0)
		
		if not testAttribute(QwtScaleEngine.Floating):
			interval = self.align(interval, stepSize)
		
		x1 = interval.minValue()
		x2 = interval.maxValue()
		
		if testAttribute(QwtScaleEngine.Inverted):
			y = x2.copy()
			x2 = x1
			x1 = y
			stepSize = -stepSize
		
		return (x1, x2, stepSize)