suppress numpy futurewarning
cleanups in arraytoqpath
This commit is contained in:
parent
586de3176e
commit
f279988916
@ -6,8 +6,18 @@ Distributed under MIT/X11 license. See license.txt for more infomation.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
import warnings
|
||||||
|
import numpy as np
|
||||||
|
import decimal, re
|
||||||
|
import ctypes
|
||||||
|
import sys, struct
|
||||||
from .python2_3 import asUnicode, basestring
|
from .python2_3 import asUnicode, basestring
|
||||||
from .Qt import QtGui, QtCore, USE_PYSIDE
|
from .Qt import QtGui, QtCore, USE_PYSIDE
|
||||||
|
from . import getConfigOption, setConfigOptions
|
||||||
|
from . import debug
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Colors = {
|
Colors = {
|
||||||
'b': QtGui.QColor(0,0,255,255),
|
'b': QtGui.QColor(0,0,255,255),
|
||||||
'g': QtGui.QColor(0,255,0,255),
|
'g': QtGui.QColor(0,255,0,255),
|
||||||
@ -27,14 +37,6 @@ SI_PREFIXES_ASCII = 'yzafpnum kMGTPEZY'
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
from .Qt import QtGui, QtCore, USE_PYSIDE
|
|
||||||
from . import getConfigOption, setConfigOptions
|
|
||||||
import numpy as np
|
|
||||||
import decimal, re
|
|
||||||
import ctypes
|
|
||||||
import sys, struct
|
|
||||||
|
|
||||||
from . import debug
|
|
||||||
|
|
||||||
def siScale(x, minVal=1e-25, allowUnicode=True):
|
def siScale(x, minVal=1e-25, allowUnicode=True):
|
||||||
"""
|
"""
|
||||||
@ -378,6 +380,7 @@ def eq(a, b):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
with warnings.catch_warnings(np): # ignore numpy futurewarning (numpy v. 1.10)
|
||||||
e = a==b
|
e = a==b
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return False
|
return False
|
||||||
@ -1374,19 +1377,13 @@ def arrayToQPath(x, y, connect='all'):
|
|||||||
arr[1:-1]['y'] = y
|
arr[1:-1]['y'] = y
|
||||||
|
|
||||||
# decide which points are connected by lines
|
# decide which points are connected by lines
|
||||||
if eq(connect, 'pairs'):
|
if eq(connect, 'all'):
|
||||||
connect = np.empty((n/2,2), dtype=np.int32)
|
|
||||||
if connect.size != n:
|
|
||||||
raise Exception("x,y array lengths must be multiple of 2 to use connect='pairs'")
|
|
||||||
connect[:,0] = 1
|
|
||||||
connect[:,1] = 0
|
|
||||||
connect = connect.flatten()
|
|
||||||
arr[1:-1]['c'] = connect
|
|
||||||
elif eq(connect, 'finite'):
|
|
||||||
connect = np.isfinite(x) & np.isfinite(y)
|
|
||||||
arr[1:-1]['c'] = connect
|
|
||||||
elif eq(connect, 'all'):
|
|
||||||
arr[1:-1]['c'] = 1
|
arr[1:-1]['c'] = 1
|
||||||
|
elif eq(connect, 'pairs'):
|
||||||
|
arr[1:-1]['c'][::2] = 1
|
||||||
|
arr[1:-1]['c'][1::2] = 0
|
||||||
|
elif eq(connect, 'finite'):
|
||||||
|
arr[1:-1]['c'] = np.isfinite(x) & np.isfinite(y)
|
||||||
elif isinstance(connect, np.ndarray):
|
elif isinstance(connect, np.ndarray):
|
||||||
arr[1:-1]['c'] = connect
|
arr[1:-1]['c'] = connect
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user