fixed error message in Qt.py
made scipy optional in functions and ImageItem
This commit is contained in:
parent
27c90c5dd5
commit
ced5583ae1
2
Qt.py
2
Qt.py
@ -44,5 +44,5 @@ QtVersion = PySide.QtCore.__version__ if USE_PYSIDE else QtCore.QT_VERSION_STR
|
||||
m = re.match(r'(\d+)\.(\d+).*', QtVersion)
|
||||
if m is not None and map(int, m.groups()) < versionReq:
|
||||
print map(int, m.groups())
|
||||
raise Exception('pyqtgraph requires Qt version >= %d.%d (your version is %s)' % (versionReq + (QtVersion,)))
|
||||
raise Exception('pyqtgraph requires Qt version >= %d.%d (your version is %s)' % (versionReq[0], versionReq[1], QtVersion))
|
||||
|
||||
|
16
functions.py
16
functions.py
@ -24,13 +24,18 @@ SI_PREFIXES_ASCII = 'yzafpnum kMGTPEZY'
|
||||
|
||||
from .Qt import QtGui, QtCore
|
||||
import numpy as np
|
||||
import scipy.ndimage
|
||||
import decimal, re
|
||||
|
||||
try:
|
||||
import scipy.ndimage
|
||||
HAVE_SCIPY = True
|
||||
try:
|
||||
import scipy.weave
|
||||
USE_WEAVE = True
|
||||
except:
|
||||
USE_WEAVE = False
|
||||
except ImportError:
|
||||
HAVE_SCIPY = False
|
||||
|
||||
from . import debug
|
||||
|
||||
@ -401,6 +406,8 @@ def affineSlice(data, shape, origin, vectors, axes, order=1, returnCoords=False,
|
||||
affineSlice(data, shape=(20,20), origin=(40,0,0), vectors=((-1, 1, 0), (-1, 0, 1)), axes=(1,2,3))
|
||||
|
||||
"""
|
||||
if not HAVE_SCIPY:
|
||||
raise Exception("This function requires the scipy library, but it does not appear to be importable.")
|
||||
|
||||
# sanity check
|
||||
if len(shape) != len(vectors):
|
||||
@ -469,6 +476,8 @@ def solve3DTransform(points1, points2):
|
||||
Find a 3D transformation matrix that maps points1 onto points2
|
||||
points must be specified as a list of 4 Vectors.
|
||||
"""
|
||||
if not HAVE_SCIPY:
|
||||
raise Exception("This function depends on the scipy library, but it does not appear to be importable.")
|
||||
A = np.array([[points1[i].x(), points1[i].y(), points1[i].z(), 1] for i in range(4)])
|
||||
B = np.array([[points2[i].x(), points2[i].y(), points2[i].z(), 1] for i in range(4)])
|
||||
|
||||
@ -488,6 +497,8 @@ def solveBilinearTransform(points1, points2):
|
||||
|
||||
mapped = np.dot(matrix, [x*y, x, y, 1])
|
||||
"""
|
||||
if not HAVE_SCIPY:
|
||||
raise Exception("This function depends on the scipy library, but it does not appear to be importable.")
|
||||
## A is 4 rows (points) x 4 columns (xy, x, y, 1)
|
||||
## B is 4 rows (points) x 2 columns (x, y)
|
||||
A = np.array([[points1[i].x()*points1[i].y(), points1[i].x(), points1[i].y(), 1] for i in range(4)])
|
||||
@ -1299,6 +1310,9 @@ def invertQTransform(tr):
|
||||
bugs in that method. (specifically, Qt has floating-point precision issues
|
||||
when determining whether a matrix is invertible)
|
||||
"""
|
||||
if not USE_WEAVE:
|
||||
raise Exception("This function depends on scipy.weave library, but it does not appear to be usable.")
|
||||
|
||||
#return tr.inverted()[0]
|
||||
arr = np.array([[tr.m11(), tr.m12(), tr.m13()], [tr.m21(), tr.m22(), tr.m23()], [tr.m31(), tr.m32(), tr.m33()]])
|
||||
inv = scipy.linalg.inv(arr)
|
||||
|
@ -1,11 +1,6 @@
|
||||
from pyqtgraph.Qt import QtGui, QtCore
|
||||
import numpy as np
|
||||
import collections
|
||||
try:
|
||||
import scipy.weave as weave
|
||||
from scipy.weave import converters
|
||||
except:
|
||||
pass
|
||||
import pyqtgraph.functions as fn
|
||||
import pyqtgraph.debug as debug
|
||||
from .GraphicsObject import GraphicsObject
|
||||
|
Loading…
Reference in New Issue
Block a user