From cee48146d05dc0fc2b0cb40a9694a389900fe6ef Mon Sep 17 00:00:00 2001 From: Sebastian Wehling-Benatelli Date: Tue, 29 Mar 2016 07:58:20 +0200 Subject: [PATCH 1/2] [closes #178] makes use of the new status variable pick_block introduced as filter_block to solve #174 --- pylot/core/util/widgets.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 9d76be58..a4f42063 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -64,7 +64,7 @@ class MPLWidget(FigureCanvas): # clear axes each time plot is called self.axes.hold(True) # initialize super class - FigureCanvas.__init__(self, self.figure) + super(MPLWidget, self).__init__(self.figure) # add an cursor for station selection self.multiCursor = MultiCursor(self.figure.canvas, (self.axes,), horizOn=True, @@ -182,7 +182,7 @@ class PickDlg(QDialog): else: self.picks = {} self.filteroptions = FILTERDEFAULTS - self.filt_block = False + self.pick_block = False # initialize panning attributes self.press = None @@ -356,7 +356,7 @@ class PickDlg(QDialog): self.disconnectPressEvent() self.cidpress = self.connectPressEvent(self.setIniPick) self.filterWFData() - self.filt_block = self.toggleFilterBlocker() + self.pick_block = self.togglePickBlocker() else: self.disconnectPressEvent() self.cidpress = self.connectPressEvent(self.panPress) @@ -708,11 +708,11 @@ class PickDlg(QDialog): ax.figure.canvas.draw() - def toggleFilterBlocker(self): - return not self.filt_block + def togglePickBlocker(self): + return not self.pick_block def filterWFData(self): - if self.filt_block: + if self.pick_block: return self.updateCurrentLimits() data = self.getWFData().copy() @@ -768,7 +768,9 @@ class PickDlg(QDialog): self.getPlotWidget().setYLims(self.getYLims()) def zoom(self): - if self.zoomAction.isChecked(): + if self.zoomAction.isChecked() and self.pick_block: + self.zoomAction.setChecked(False) + elif self.zoomAction.isChecked(): self.disconnectPressEvent() self.disconnectMotionEvent() self.disconnectReleaseEvent() From 4c5b58dbf1198aae661239da70565ee8875db9f9 Mon Sep 17 00:00:00 2001 From: Sebastianw Wehling-Benatelli Date: Tue, 29 Mar 2016 08:24:32 +0200 Subject: [PATCH 2/2] [addresses #190, closes #192] handles unknown picker information pick tag is set to 'Unknown' for loaded data that do not provide picker information when saved with PyLoT prior to revision 06576586c6aac90360f9e9eb675e6d6f9dbf6d1d --- pylot/core/read/data.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pylot/core/read/data.py b/pylot/core/read/data.py index fcbc3565..e59e69f1 100644 --- a/pylot/core/read/data.py +++ b/pylot/core/read/data.py @@ -3,6 +3,7 @@ import os import glob +import warnings from obspy.io.xseed import Parser from obspy.core import read, Stream, UTCDateTime from obspy import read_events, read_inventory @@ -421,7 +422,11 @@ class Data(object): epp = phase['epp'] lpp = phase['lpp'] error = phase['spe'] - picker = phase['picker'] + try: + picker = phase['picker'] + except KeyError as e: + warnings.warn(str(e), Warning) + picker = 'Unknown' pick = Pick() pick.time = onset pick.time_errors.lower_uncertainty = onset - epp