From a8544dfb93c2d3ccb3ed54ad6b1ab42192f87c13 Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Tue, 20 Jun 2017 10:35:31 +0200 Subject: [PATCH 1/6] [bugfix] save XML does not set project clean --- QtPyLoT.py | 1 - 1 file changed, 1 deletion(-) diff --git a/QtPyLoT.py b/QtPyLoT.py index 7afd2991..4a3bcd07 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -985,7 +985,6 @@ class MainWindow(QMainWindow): # export to given path self.get_data().exportEvent(fbasename, exform) # all files save (ui clean) - self.setDirty(False) self.update_status('Picks saved as %s' % (fbasename + exform)) self.disableSaveManualPicksAction() return True From 62a7d94816da6e50852b79e6d784f47b292b5894 Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Tue, 20 Jun 2017 12:10:17 +0200 Subject: [PATCH 2/6] [bugfix] expecting deprecated return parameter of autoPyLoT --- autoPyLoT.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/autoPyLoT.py b/autoPyLoT.py index dc597110..b83f78af 100755 --- a/autoPyLoT.py +++ b/autoPyLoT.py @@ -385,9 +385,5 @@ if __name__ == "__main__": cla = parser.parse_args() - try: - picks, mainFig = autoPyLoT(inputfile=str(cla.inputfile), fnames=str(cla.fnames), - eventid=str(cla.eventid), savepath=str(cla.spath)) - except ValueError: - print("autoPyLoT was running in production mode.") - + picks = autoPyLoT(inputfile=str(cla.inputfile), fnames=str(cla.fnames), + eventid=str(cla.eventid), savepath=str(cla.spath)) From 0ff6f78a6cac1192e21daf4270ee2ed8a8095694 Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Tue, 20 Jun 2017 12:10:56 +0200 Subject: [PATCH 3/6] [add] parameter localMag added --- pylot/RELEASE-VERSION | 2 +- pylot/core/io/default_parameters.py | 9 +++++++-- pylot/core/util/widgets.py | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pylot/RELEASE-VERSION b/pylot/RELEASE-VERSION index 85433583..7bb5d74d 100644 --- a/pylot/RELEASE-VERSION +++ b/pylot/RELEASE-VERSION @@ -1 +1 @@ -1b17-dirty +a8544-dirty diff --git a/pylot/core/io/default_parameters.py b/pylot/core/io/default_parameters.py index f304c8e0..1ae7caad 100644 --- a/pylot/core/io/default_parameters.py +++ b/pylot/core/io/default_parameters.py @@ -275,7 +275,11 @@ defaults = {'rootpath': {'type': str, 'wdttolerance': {'type': float, 'tooltip': 'maximum allowed deviation from Wadati-diagram', - 'value': 1.0} + 'value': 1.0}, + + 'localMag': {'type': float, + 'tooltip': 'maximum allowed deviation from Wadati-diagram', + 'value': 1.0} } settings_main={ @@ -297,7 +301,8 @@ settings_main={ 'smoment':[ 'vp', 'rho', - 'Qp'], + 'Qp', + 'localMag'], 'pick':[ 'extent', 'pstart', diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 46984de9..a92a7940 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -2228,6 +2228,8 @@ class AutoPickParaBox(QtGui.QWidget): if type(box) == QtGui.QLineEdit: box.setText(str(value)) elif type(box) == QtGui.QSpinBox or type(box) == QtGui.QDoubleSpinBox: + if not value: + value = 0. box.setValue(value) elif type(box) == QtGui.QCheckBox: if value == 'True': From 0be5c4b694142ff6f25ca810c9dead406a7fae09 Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Tue, 20 Jun 2017 13:22:29 +0200 Subject: [PATCH 4/6] [add] verbosity on import pyqtgraph exception --- QtPyLoT.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/QtPyLoT.py b/QtPyLoT.py index 4a3bcd07..ceab88ef 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -44,8 +44,8 @@ from obspy import UTCDateTime try: import pyqtgraph as pg -except: - print('QtPyLoT: Could not import pyqtgraph.') +except Exception as e: + print('QtPyLoT: Could not import pyqtgraph. {}'.format(e)) pg = None try: From ab979e9b1094e8c9475271e639f4a401a4fb432e Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Tue, 20 Jun 2017 14:32:21 +0200 Subject: [PATCH 5/6] [bugfix] events not properly provided to autoPyLoT by TuneAutopicker, wrong parameter name in plotting routine --- autoPyLoT.py | 38 ++++++++++++++++++++++++++------------ pylot/RELEASE-VERSION | 2 +- pylot/core/pick/picker.py | 4 ++-- pylot/core/util/thread.py | 6 ++++-- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/autoPyLoT.py b/autoPyLoT.py index b83f78af..0df1e2cb 100755 --- a/autoPyLoT.py +++ b/autoPyLoT.py @@ -130,21 +130,35 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even print("!!No source parameter estimation possible!!") print(" !!! ") - datapath = datastructure.expandDataPath() - if fnames == 'None' and not parameter.hasParam('eventID'): - # multiple event processing - # read each event in database - events = [events for events in glob.glob(os.path.join(datapath, '*')) if os.path.isdir(events)] - elif fnames == 'None' and parameter.hasParam('eventID'): - # single event processing - events = glob.glob(os.path.join(datapath, parameter.get('eventID'))) + if not input_dict: + # started in production mode + datapath = datastructure.expandDataPath() + if fnames == 'None' and not parameter['eventID']: + # multiple event processing + # read each event in database + events = [events for events in glob.glob(os.path.join(datapath, '*')) if os.path.isdir(events)] + elif fnames == 'None' and parameter['eventID']: + # single event processing + events = glob.glob(os.path.join(datapath, parameter.get('eventID'))) + else: + # autoPyLoT was initialized from GUI + events = [] + events.append(eventid) + evID = os.path.split(eventid)[-1] + locflag = 2 else: - # autoPyLoT was initialized from GUI + # started in tune mode + datapath = os.path.join(parameter['rootpath'], + parameter['datapath']) events = [] - events.append(eventid) - evID = os.path.split(eventid)[-1] - locflag = 2 + events.append(os.path.join(datapath, + parameter['database'], + parameter['eventID'])) + if not events: + print('autoPyLoT: No events given. Return!') + return + for event in events: if fnames == 'None': data.setWFData(glob.glob(os.path.join(datapath, event, '*'))) diff --git a/pylot/RELEASE-VERSION b/pylot/RELEASE-VERSION index 7bb5d74d..2c8398ed 100644 --- a/pylot/RELEASE-VERSION +++ b/pylot/RELEASE-VERSION @@ -1 +1 @@ -a8544-dirty +0be5-dirty diff --git a/pylot/core/pick/picker.py b/pylot/core/pick/picker.py index 3c27e221..a6cd7452 100644 --- a/pylot/core/pick/picker.py +++ b/pylot/core/pick/picker.py @@ -239,8 +239,8 @@ class AICPicker(AutoPicker): fig = self.fig ax = fig.add_subplot(111) x = self.Data[0].data - ax.plot(self.Tcf, x / max(x), 'k', legend='(HOS-/AR-) Data') - ax.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', legend='Smoothed AIC-CF') + ax.plot(self.Tcf, x / max(x), 'k', label='(HOS-/AR-) Data') + ax.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF') ax.legend() ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime) ax.set_yticks([]) diff --git a/pylot/core/util/thread.py b/pylot/core/util/thread.py index 609cf9df..5928ace3 100644 --- a/pylot/core/util/thread.py +++ b/pylot/core/util/thread.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -import sys +import sys, os from PySide.QtCore import QThread, Signal, Qt from PySide.QtGui import QDialog, QProgressBar, QLabel, QHBoxLayout @@ -64,7 +64,9 @@ class Thread(QThread): except Exception as e: self._executed = False self._executedError = e - print(e) + exc_type, exc_obj, exc_tb = sys.exc_info() + fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] + print('Exception: {}, file: {}, line: {}'.format(exc_type, fname, exc_tb.tb_lineno)) sys.stdout = sys.__stdout__ def __del__(self): From 1b512a0864e2bfe427c390dc39057a2865d31074 Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Tue, 20 Jun 2017 16:23:54 +0200 Subject: [PATCH 6/6] [closes #207, closes #208] when supressing user prompt, applyEVTData to data object was accidently removed --- QtPyLoT.py | 12 ++++++------ pylot/RELEASE-VERSION | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/QtPyLoT.py b/QtPyLoT.py index ceab88ef..8e558b5c 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -943,9 +943,9 @@ class MainWindow(QMainWindow): settings = QSettings() fbasename = self.getEventFileName() exform = settings.value('data/exportFormat', 'QUAKEML') - # try: - # self.get_data().applyEVTData(self.getPicks()) - # except OverwriteError: + try: + self.get_data().applyEVTData(self.getPicks()) + except OverwriteError: # msgBox = QMessageBox() # msgBox.setText("Picks have been modified!") # msgBox.setInformativeText( @@ -955,11 +955,11 @@ class MainWindow(QMainWindow): # msgBox.setDefaultButton(QMessageBox.Save) # ret = msgBox.exec_() # if ret == QMessageBox.Save: - # self.get_data().resetPicks() - # return self.saveData() + self.get_data().resetPicks() + return self.saveData() # elif ret == QMessageBox.Cancel: # return False - # MP MP changed due to new event structure not uniquely refering to data object + # MP MP changed to suppress unnecessary user prompt try: self.get_data().exportEvent(fbasename, exform) except FormatError as e: diff --git a/pylot/RELEASE-VERSION b/pylot/RELEASE-VERSION index 2c8398ed..e1085601 100644 --- a/pylot/RELEASE-VERSION +++ b/pylot/RELEASE-VERSION @@ -1 +1 @@ -0be5-dirty +ab97-dirty