pyqtgraph/numpy_fix.py
Luke Campagnola 27c90c5dd5 Many minor updates:
- added ability for ScatterPlotItem to use arbitrary symbol shapes
- added scatter plot speed test for evaluating new methods
- added butterworth notch filter to flowchart library
- fixed bugs with ViewBox trying to close itself after python has started cleaning up
- fixed python 2.6 compatibility bug in PlotCurveItem
- fixed support for list-of-dicts and dict-of-lists input for PlotDataItem
- check to ensure Qt version is >= 4.7
- workaround for numpy segmentation fault
- several other minor updates and documentation changes
2012-10-02 21:23:59 -04:00

23 lines
839 B
Python

try:
import numpy as np
## Wrap np.concatenate to catch and avoid a segmentation fault bug
## (numpy trac issue #2084)
if not hasattr(np, 'concatenate_orig'):
np.concatenate_orig = np.concatenate
def concatenate(vals, **kwds):
"""Wrapper around numpy.concatenate (see pyqtgraph/numpy_fix.py)"""
dtypes = [getattr(v, 'dtype', None) for v in vals]
names = [getattr(dt, 'names', None) for dt in dtypes]
if len(dtypes) < 2 or all([n is None for n in names]):
return np.concatenate_orig(vals, **kwds)
if any([dt != dtypes[0] for dt in dtypes[1:]]):
raise TypeError("Cannot concatenate structured arrays of different dtype.")
return np.concatenate_orig(vals, **kwds)
np.concatenate = concatenate
except ImportError:
pass