Commit dac7eb58 authored by Antony Lee's avatar Antony Lee
Browse files

Faster import of PyQtGraph.

* RawImageWidget (and thus OpenGL) isn't imported by default anymore.
* scipy.stats.scoreatpercentile is replaced by numpy.percentile.

This commit has not been tested as the example runner is currently
broken.
parent ef2ffdd8
...@@ -178,7 +178,8 @@ def importAll(path, globals, locals, excludes=()): ...@@ -178,7 +178,8 @@ def importAll(path, globals, locals, excludes=()):
globals[k] = getattr(mod, k) globals[k] = getattr(mod, k)
importAll('graphicsItems', globals(), locals()) importAll('graphicsItems', globals(), locals())
importAll('widgets', globals(), locals(), excludes=['MatplotlibWidget', 'RemoteGraphicsView']) importAll('widgets', globals(), locals(),
excludes=['MatplotlibWidget', 'RawImageWidget', 'RemoteGraphicsView'])
from .imageview import * from .imageview import *
from .WidgetGroup import * from .WidgetGroup import *
......
...@@ -7,7 +7,6 @@ except: ...@@ -7,7 +7,6 @@ except:
from scipy.fftpack import fft from scipy.fftpack import fft
import numpy as np import numpy as np
import scipy.stats
from .GraphicsObject import GraphicsObject from .GraphicsObject import GraphicsObject
import pyqtgraph.functions as fn import pyqtgraph.functions as fn
from pyqtgraph import debug from pyqtgraph import debug
...@@ -126,8 +125,8 @@ class PlotCurveItem(GraphicsObject): ...@@ -126,8 +125,8 @@ class PlotCurveItem(GraphicsObject):
else: else:
mask = np.isfinite(d) mask = np.isfinite(d)
d = d[mask] d = d[mask]
b = (scipy.stats.scoreatpercentile(d, 50 - (frac * 50)), scipy.stats.scoreatpercentile(d, 50 + (frac * 50))) b = np.percentile(d, [50 * (1 - frac), 50 * (1 + frac)])
## adjust for fill level ## adjust for fill level
if ax == 1 and self.opts['fillLevel'] is not None: if ax == 1 and self.opts['fillLevel'] is not None:
b = (min(b[0], self.opts['fillLevel']), max(b[1], self.opts['fillLevel'])) b = (min(b[0], self.opts['fillLevel']), max(b[1], self.opts['fillLevel']))
......
...@@ -4,7 +4,6 @@ import pyqtgraph.functions as fn ...@@ -4,7 +4,6 @@ import pyqtgraph.functions as fn
from .GraphicsItem import GraphicsItem from .GraphicsItem import GraphicsItem
from .GraphicsObject import GraphicsObject from .GraphicsObject import GraphicsObject
import numpy as np import numpy as np
import scipy.stats
import weakref import weakref
import pyqtgraph.debug as debug import pyqtgraph.debug as debug
from pyqtgraph.pgcollections import OrderedDict from pyqtgraph.pgcollections import OrderedDict
...@@ -633,8 +632,8 @@ class ScatterPlotItem(GraphicsObject): ...@@ -633,8 +632,8 @@ class ScatterPlotItem(GraphicsObject):
else: else:
mask = np.isfinite(d) mask = np.isfinite(d)
d = d[mask] d = d[mask]
return (scipy.stats.scoreatpercentile(d, 50 - (frac * 50)), scipy.stats.scoreatpercentile(d, 50 + (frac * 50))) return np.percentile(d, [50 * (1 - frac), 50 * (1 + frac)])
def pixelPadding(self): def pixelPadding(self):
return self._maxSpotPxWidth*0.7072 return self._maxSpotPxWidth*0.7072
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment