/usr/lib/python2.7/dist-packages/qwt/math.py is in python-qwt 0.5.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | # -*- coding: utf-8 -*-
#
# Licensed under the terms of the Qwt License
# Copyright (c) 2002 Uwe Rathmann, for the original C++ code
# Copyright (c) 2015 Pierre Raybaut, for the Python translation/optimization
# (see LICENSE file for more details)
from qwt.qt.QtCore import qFuzzyCompare
import numpy as np
def qwtFuzzyCompare(value1, value2, intervalSize):
eps = abs(1.e-6*intervalSize)
if value2 - value1 > eps:
return -1
elif value1 - value2 > eps:
return 1
else:
return 0
def qwtFuzzyGreaterOrEqual(d1, d2):
return (d1 >= d2) or qFuzzyCompare(d1, d2)
def qwtFuzzyLessOrEqual(d1, d2):
return (d1 <= d2) or qFuzzyCompare(d1, d2)
def qwtSign(x):
if x > 0.:
return 1
elif x < 0.:
return -1
else:
return 0
def qwtSqr(x):
return x**2
def qwtFastAtan(x):
if x < -1.:
return -.5*np.pi - x/(x**2 + .28)
elif x > 1.:
return .5*np.pi - x/(x**2 + .28)
else:
return x/(1. + x**2*.28)
def qwtFastAtan2(y, x):
if x > 0:
return qwtFastAtan(y/x)
elif x < 0:
d = qwtFastAtan(y/x)
if y >= 0:
return d + np.pi
else:
return d - np.pi
elif y < 0.:
return -.5*np.pi
elif y > 0.:
return .5*np.pi
else:
return 0.
def qwtRadians(degrees):
return degrees * np.pi/180.
def qwtDegrees(radians):
return radians * 180./np.pi
|