Commit 6903886b authored by Luke Campagnola's avatar Luke Campagnola
Browse files

Fixes against previous commits:

 - fixed example testing script
 - Added finer axis ticks back in some instances
 - fixed improper bounds caching in log/fft mode
 - fixed exception handling in remoteproxy
parent 513e904a
......@@ -45,6 +45,9 @@ p5 = win.addPlot(title="Scatter plot, axis labels, log scale")
x = np.random.normal(size=1000) * 1e-5
y = x*1000 + 0.005 * np.random.normal(size=1000)
y -= y.min()-1.0
mask = x > 1e-15
x = x[mask]
y = y[mask]
p5.plot(x, y, pen=None, symbol='t', symbolPen=None, symbolSize=10, symbolBrush=(100, 100, 255, 50))
p5.setLabel('left', "Y Axis", units='A')
p5.setLabel('bottom', "Y Axis", units='s')
......
# -*- coding: utf-8 -*-
import sys, os
## Add path to library (just for examples; you do not need this)
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
import initExample
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
......
......@@ -182,6 +182,7 @@ def testFile(name, f, exe, lib, graphicsSystem=None):
code = """
try:
%s
import initExample
import pyqtgraph as pg
%s
import %s
......
......@@ -16,7 +16,6 @@ if not hasattr(sys, 'frozen'):
sys.path.remove(p)
sys.path.insert(0, p)
## should force example to use PySide instead of PyQt
if 'pyside' in sys.argv:
from PySide import QtGui
......
......@@ -350,9 +350,7 @@ class AxisItem(GraphicsWidget):
## decide optimal minor tick spacing in pixels (this is just aesthetics)
pixelSpacing = np.log(size+10) * 5
optimalTickCount = size / pixelSpacing
if optimalTickCount < 1:
optimalTickCount = 1
optimalTickCount = max(2., size / pixelSpacing)
## optimal minor tick spacing
optimalSpacing = dif / optimalTickCount
......@@ -366,12 +364,21 @@ class AxisItem(GraphicsWidget):
while intervals[minorIndex+1] <= optimalSpacing:
minorIndex += 1
return [
levels = [
(intervals[minorIndex+2], 0),
(intervals[minorIndex+1], 0),
#(intervals[minorIndex], 0) ## Pretty, but eats up CPU
]
## decide whether to include the last level of ticks
minSpacing = min(size / 20., 30.)
maxTickCount = size / minSpacing
if dif / intervals[minorIndex] <= maxTickCount:
levels.append((intervals[minorIndex], 0))
return levels
##### This does not work -- switching between 2/5 confuses the automatic text-level-selection
### Determine major/minor tick spacings which flank the optimal spacing.
#intervals = np.array([1., 2., 5., 10., 20., 50., 100.]) * p10unit
......@@ -587,7 +594,7 @@ class AxisItem(GraphicsWidget):
ticks = tickLevels[i][1]
## length of tick
tickLength = self.tickLength / ((i*1.0)+1.0)
tickLength = self.tickLength / ((i*0.5)+1.0)
lineAlpha = 255 / (i+1)
if self.grid is not False:
......
......@@ -149,39 +149,6 @@ class PlotCurveItem(GraphicsObject):
self.invalidateBounds()
self.update()
#def setColor(self, color):
#self.pen.setColor(color)
#self.update()
#def setAlpha(self, alpha, auto):
#self.opts['alphaHint'] = alpha
#self.opts['alphaMode'] = auto
#self.update()
#def setSpectrumMode(self, mode):
#self.opts['spectrumMode'] = mode
#self.xDisp = self.yDisp = None
#self.path = None
#self.update()
#def setLogMode(self, mode):
#self.opts['logMode'] = mode
#self.xDisp = self.yDisp = None
#self.path = None
#self.update()
#def setPointMode(self, mode):
#self.opts['pointMode'] = mode
#self.update()
#def setDownsampling(self, ds):
#if self.opts['downsample'] != ds:
#self.opts['downsample'] = ds
#self.xDisp = self.yDisp = None
#self.path = None
#self.update()
def setData(self, *args, **kargs):
"""
============== ========================================================
......@@ -483,25 +450,6 @@ class PlotCurveItem(GraphicsObject):
self.path = None
#del self.xData, self.yData, self.xDisp, self.yDisp, self.path
#def mousePressEvent(self, ev):
##GraphicsObject.mousePressEvent(self, ev)
#if not self.clickable:
#ev.ignore()
#if ev.button() != QtCore.Qt.LeftButton:
#ev.ignore()
#self.mousePressPos = ev.pos()
#self.mouseMoved = False
#def mouseMoveEvent(self, ev):
##GraphicsObject.mouseMoveEvent(self, ev)
#self.mouseMoved = True
##print "move"
#def mouseReleaseEvent(self, ev):
##GraphicsObject.mouseReleaseEvent(self, ev)
#if not self.mouseMoved:
#self.sigClicked.emit(self)
def mouseClickEvent(self, ev):
if not self.clickable or ev.button() != QtCore.Qt.LeftButton:
return
......
......@@ -164,6 +164,7 @@ class PlotDataItem(GraphicsObject):
self.opts['fftMode'] = mode
self.xDisp = self.yDisp = None
self.updateItems()
self.informViewBoundsChanged()
def setLogMode(self, xMode, yMode):
if self.opts['logMode'] == [xMode, yMode]:
......@@ -171,6 +172,7 @@ class PlotDataItem(GraphicsObject):
self.opts['logMode'] = [xMode, yMode]
self.xDisp = self.yDisp = None
self.updateItems()
self.informViewBoundsChanged()
def setPointMode(self, mode):
if self.opts['pointMode'] == mode:
......
......@@ -114,7 +114,7 @@ class RemoteEventHandler(object):
result = None
try:
cmd, reqId, nByteMsgs, optStr = self.conn.recv() ## args, kwds are double-pickled to ensure this recv() call never fails
except EOFError, IOError:
except (EOFError, IOError):
## remote process has shut down; end event loop
raise ClosedError()
#print os.getpid(), "received request:", cmd, reqId
......@@ -124,7 +124,7 @@ class RemoteEventHandler(object):
for i in range(nByteMsgs):
try:
byteData.append(self.conn.recv_bytes())
except EOFError, IOError:
except (EOFError, IOError):
raise ClosedError()
......
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