Merge branch 'develop'
This commit is contained in:
commit
d5a7e1f35f
17
QtPyLoT.py
17
QtPyLoT.py
@ -44,8 +44,8 @@ from obspy import UTCDateTime
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
except:
|
except Exception as e:
|
||||||
print('QtPyLoT: Could not import pyqtgraph.')
|
print('QtPyLoT: Could not import pyqtgraph. {}'.format(e))
|
||||||
pg = None
|
pg = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -943,9 +943,9 @@ class MainWindow(QMainWindow):
|
|||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
fbasename = self.getEventFileName()
|
fbasename = self.getEventFileName()
|
||||||
exform = settings.value('data/exportFormat', 'QUAKEML')
|
exform = settings.value('data/exportFormat', 'QUAKEML')
|
||||||
# try:
|
try:
|
||||||
# self.get_data().applyEVTData(self.getPicks())
|
self.get_data().applyEVTData(self.getPicks())
|
||||||
# except OverwriteError:
|
except OverwriteError:
|
||||||
# msgBox = QMessageBox()
|
# msgBox = QMessageBox()
|
||||||
# msgBox.setText("Picks have been modified!")
|
# msgBox.setText("Picks have been modified!")
|
||||||
# msgBox.setInformativeText(
|
# msgBox.setInformativeText(
|
||||||
@ -955,11 +955,11 @@ class MainWindow(QMainWindow):
|
|||||||
# msgBox.setDefaultButton(QMessageBox.Save)
|
# msgBox.setDefaultButton(QMessageBox.Save)
|
||||||
# ret = msgBox.exec_()
|
# ret = msgBox.exec_()
|
||||||
# if ret == QMessageBox.Save:
|
# if ret == QMessageBox.Save:
|
||||||
# self.get_data().resetPicks()
|
self.get_data().resetPicks()
|
||||||
# return self.saveData()
|
return self.saveData()
|
||||||
# elif ret == QMessageBox.Cancel:
|
# elif ret == QMessageBox.Cancel:
|
||||||
# return False
|
# 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:
|
try:
|
||||||
self.get_data().exportEvent(fbasename, exform)
|
self.get_data().exportEvent(fbasename, exform)
|
||||||
except FormatError as e:
|
except FormatError as e:
|
||||||
@ -985,7 +985,6 @@ class MainWindow(QMainWindow):
|
|||||||
# export to given path
|
# export to given path
|
||||||
self.get_data().exportEvent(fbasename, exform)
|
self.get_data().exportEvent(fbasename, exform)
|
||||||
# all files save (ui clean)
|
# all files save (ui clean)
|
||||||
self.setDirty(False)
|
|
||||||
self.update_status('Picks saved as %s' % (fbasename + exform))
|
self.update_status('Picks saved as %s' % (fbasename + exform))
|
||||||
self.disableSaveManualPicksAction()
|
self.disableSaveManualPicksAction()
|
||||||
return True
|
return True
|
||||||
|
46
autoPyLoT.py
46
autoPyLoT.py
@ -130,20 +130,34 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
|||||||
print("!!No source parameter estimation possible!!")
|
print("!!No source parameter estimation possible!!")
|
||||||
print(" !!! ")
|
print(" !!! ")
|
||||||
|
|
||||||
datapath = datastructure.expandDataPath()
|
if not input_dict:
|
||||||
if fnames == 'None' and not parameter.hasParam('eventID'):
|
# started in production mode
|
||||||
# multiple event processing
|
datapath = datastructure.expandDataPath()
|
||||||
# read each event in database
|
if fnames == 'None' and not parameter['eventID']:
|
||||||
events = [events for events in glob.glob(os.path.join(datapath, '*')) if os.path.isdir(events)]
|
# multiple event processing
|
||||||
elif fnames == 'None' and parameter.hasParam('eventID'):
|
# read each event in database
|
||||||
# single event processing
|
events = [events for events in glob.glob(os.path.join(datapath, '*')) if os.path.isdir(events)]
|
||||||
events = glob.glob(os.path.join(datapath, parameter.get('eventID')))
|
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:
|
else:
|
||||||
# autoPyLoT was initialized from GUI
|
# started in tune mode
|
||||||
|
datapath = os.path.join(parameter['rootpath'],
|
||||||
|
parameter['datapath'])
|
||||||
events = []
|
events = []
|
||||||
events.append(eventid)
|
events.append(os.path.join(datapath,
|
||||||
evID = os.path.split(eventid)[-1]
|
parameter['database'],
|
||||||
locflag = 2
|
parameter['eventID']))
|
||||||
|
|
||||||
|
if not events:
|
||||||
|
print('autoPyLoT: No events given. Return!')
|
||||||
|
return
|
||||||
|
|
||||||
for event in events:
|
for event in events:
|
||||||
if fnames == 'None':
|
if fnames == 'None':
|
||||||
@ -385,9 +399,5 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
cla = parser.parse_args()
|
cla = parser.parse_args()
|
||||||
|
|
||||||
try:
|
picks = autoPyLoT(inputfile=str(cla.inputfile), fnames=str(cla.fnames),
|
||||||
picks, mainFig = autoPyLoT(inputfile=str(cla.inputfile), fnames=str(cla.fnames),
|
eventid=str(cla.eventid), savepath=str(cla.spath))
|
||||||
eventid=str(cla.eventid), savepath=str(cla.spath))
|
|
||||||
except ValueError:
|
|
||||||
print("autoPyLoT was running in production mode.")
|
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
1b17-dirty
|
ab97-dirty
|
||||||
|
@ -275,7 +275,11 @@ defaults = {'rootpath': {'type': str,
|
|||||||
|
|
||||||
'wdttolerance': {'type': float,
|
'wdttolerance': {'type': float,
|
||||||
'tooltip': 'maximum allowed deviation from Wadati-diagram',
|
'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={
|
settings_main={
|
||||||
@ -297,7 +301,8 @@ settings_main={
|
|||||||
'smoment':[
|
'smoment':[
|
||||||
'vp',
|
'vp',
|
||||||
'rho',
|
'rho',
|
||||||
'Qp'],
|
'Qp',
|
||||||
|
'localMag'],
|
||||||
'pick':[
|
'pick':[
|
||||||
'extent',
|
'extent',
|
||||||
'pstart',
|
'pstart',
|
||||||
|
@ -239,8 +239,8 @@ class AICPicker(AutoPicker):
|
|||||||
fig = self.fig
|
fig = self.fig
|
||||||
ax = fig.add_subplot(111)
|
ax = fig.add_subplot(111)
|
||||||
x = self.Data[0].data
|
x = self.Data[0].data
|
||||||
ax.plot(self.Tcf, x / max(x), 'k', legend='(HOS-/AR-) Data')
|
ax.plot(self.Tcf, x / max(x), 'k', label='(HOS-/AR-) Data')
|
||||||
ax.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', legend='Smoothed AIC-CF')
|
ax.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF')
|
||||||
ax.legend()
|
ax.legend()
|
||||||
ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
|
ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
|
||||||
ax.set_yticks([])
|
ax.set_yticks([])
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import sys
|
import sys, os
|
||||||
from PySide.QtCore import QThread, Signal, Qt
|
from PySide.QtCore import QThread, Signal, Qt
|
||||||
from PySide.QtGui import QDialog, QProgressBar, QLabel, QHBoxLayout
|
from PySide.QtGui import QDialog, QProgressBar, QLabel, QHBoxLayout
|
||||||
|
|
||||||
@ -64,7 +64,9 @@ class Thread(QThread):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._executed = False
|
self._executed = False
|
||||||
self._executedError = e
|
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__
|
sys.stdout = sys.__stdout__
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
@ -2228,6 +2228,8 @@ class AutoPickParaBox(QtGui.QWidget):
|
|||||||
if type(box) == QtGui.QLineEdit:
|
if type(box) == QtGui.QLineEdit:
|
||||||
box.setText(str(value))
|
box.setText(str(value))
|
||||||
elif type(box) == QtGui.QSpinBox or type(box) == QtGui.QDoubleSpinBox:
|
elif type(box) == QtGui.QSpinBox or type(box) == QtGui.QDoubleSpinBox:
|
||||||
|
if not value:
|
||||||
|
value = 0.
|
||||||
box.setValue(value)
|
box.setValue(value)
|
||||||
elif type(box) == QtGui.QCheckBox:
|
elif type(box) == QtGui.QCheckBox:
|
||||||
if value == 'True':
|
if value == 'True':
|
||||||
|
Loading…
Reference in New Issue
Block a user