Cleanup old code, conform comments to pep8
This commit is contained in:
parent
07ba7be2a4
commit
c6f1d2df94
@ -1682,46 +1682,27 @@ def downsample(data, n, axis=0, xvals='subsample'):
|
|||||||
|
|
||||||
|
|
||||||
def arrayToQPath(x, y, connect='all', finiteCheck=True):
|
def arrayToQPath(x, y, connect='all', finiteCheck=True):
|
||||||
"""Convert an array of x,y coordinats to QPainterPath as efficiently as possible.
|
"""Convert an array of x,y coordinates to QPainterPath as efficiently as
|
||||||
The *connect* argument may be 'all', indicating that each point should be
|
possible. The *connect* argument may be 'all', indicating that each point
|
||||||
connected to the next; 'pairs', indicating that each pair of points
|
should be connected to the next; 'pairs', indicating that each pair of
|
||||||
should be connected, or an array of int32 values (0 or 1) indicating
|
points should be connected, or an array of int32 values (0 or 1) indicating
|
||||||
connections.
|
connections.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
## Create all vertices in path. The method used below creates a binary format so that all
|
# Create all vertices in path. The method used below creates a binary format so that all
|
||||||
## vertices can be read in at once. This binary format may change in future versions of Qt,
|
# vertices can be read in at once. This binary format may change in future versions of Qt,
|
||||||
## so the original (slower) method is left here for emergencies:
|
|
||||||
#path.moveTo(x[0], y[0])
|
|
||||||
#if connect == 'all':
|
|
||||||
#for i in range(1, y.shape[0]):
|
|
||||||
#path.lineTo(x[i], y[i])
|
|
||||||
#elif connect == 'pairs':
|
|
||||||
#for i in range(1, y.shape[0]):
|
|
||||||
#if i%2 == 0:
|
|
||||||
#path.lineTo(x[i], y[i])
|
|
||||||
#else:
|
|
||||||
#path.moveTo(x[i], y[i])
|
|
||||||
#elif isinstance(connect, np.ndarray):
|
|
||||||
#for i in range(1, y.shape[0]):
|
|
||||||
#if connect[i] == 1:
|
|
||||||
#path.lineTo(x[i], y[i])
|
|
||||||
#else:
|
|
||||||
#path.moveTo(x[i], y[i])
|
|
||||||
#else:
|
|
||||||
#raise Exception('connect argument must be "all", "pairs", or array')
|
|
||||||
|
|
||||||
## Speed this up using >> operator
|
# Speed this up using >> operator
|
||||||
## Format is:
|
# Format is:
|
||||||
## numVerts(i4)
|
# numVerts(i4)
|
||||||
## 0(i4) x(f8) y(f8) <-- 0 means this vertex does not connect
|
# 0(i4) x(f8) y(f8) <-- 0 means this vertex does not connect
|
||||||
## 1(i4) x(f8) y(f8) <-- 1 means this vertex connects to the previous vertex
|
# 1(i4) x(f8) y(f8) <-- 1 means this vertex connects to the previous vertex
|
||||||
## ...
|
# ...
|
||||||
## cStart(i4) fillRule(i4)
|
# cStart(i4) fillRule(i4)
|
||||||
##
|
#
|
||||||
## see: https://github.com/qt/qtbase/blob/dev/src/gui/painting/qpainterpath.cpp
|
# see: https://github.com/qt/qtbase/blob/dev/src/gui/painting/qpainterpath.cpp
|
||||||
|
|
||||||
## All values are big endian--pack using struct.pack('>d') or struct.pack('>i')
|
# All values are big endian--pack using struct.pack('>d') or struct.pack('>i')
|
||||||
path = QtGui.QPainterPath()
|
path = QtGui.QPainterPath()
|
||||||
n = x.shape[0]
|
n = x.shape[0]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user