[add] origin/mag to eventBox

This commit is contained in:
Marcel Paffrath 2018-04-24 15:37:15 +02:00
parent d3de33a12b
commit 073a71e150
2 changed files with 28 additions and 5 deletions

View File

@ -1250,6 +1250,17 @@ class MainWindow(QMainWindow):
event_ref = event.isRefEvent() event_ref = event.isRefEvent()
event_test = event.isTestEvent() event_test = event.isTestEvent()
time = lat = lon = depth = mag = None
if len(event.origins) == 1:
origin = event.origins[0]
time = origin.time + 0 # add 0 because there was an exception for time = 0s
lat = origin.latitude
lon = origin.longitude
depth = origin.depth
if len(event.magnitudes) == 1:
magnitude = event.magnitudes[0]
mag = magnitude.mag
# text = '{path:{plen}} | manual: [{p:3d}] | auto: [{a:3d}]' # text = '{path:{plen}} | manual: [{p:3d}] | auto: [{a:3d}]'
# text = text.format(path=event_path, # text = text.format(path=event_path,
# plen=plmax, # plen=plmax,
@ -1257,6 +1268,11 @@ class MainWindow(QMainWindow):
# a=event_nautopicks) # a=event_nautopicks)
item_path = QtGui.QStandardItem('{path:{plen}}'.format(path=event_path, plen=plmax)) item_path = QtGui.QStandardItem('{path:{plen}}'.format(path=event_path, plen=plmax))
item_time = QtGui.QStandardItem('{}'.format(time))
item_lat = QtGui.QStandardItem('{}'.format(lat))
item_lon = QtGui.QStandardItem('{}'.format(lon))
item_depth = QtGui.QStandardItem('{}'.format(depth))
item_mag = QtGui.QStandardItem('{}'.format(mag))
item_nmp = QtGui.QStandardItem(str(ma_count['manual'])) item_nmp = QtGui.QStandardItem(str(ma_count['manual']))
item_nmp.setIcon(self.manupicksicon_small) item_nmp.setIcon(self.manupicksicon_small)
item_nap = QtGui.QStandardItem(str(ma_count['auto'])) item_nap = QtGui.QStandardItem(str(ma_count['auto']))
@ -1282,7 +1298,10 @@ class MainWindow(QMainWindow):
# item.setFont(font) # item.setFont(font)
# item2.setForeground(QtGui.QColor('black')) # item2.setForeground(QtGui.QColor('black'))
# item2.setFont(font) # item2.setFont(font)
itemlist = [item_path, item_nmp, item_nap, item_ref, item_test, item_notes] itemlist = [item_path, item_time, item_lat, item_lon, item_depth,
item_mag, item_nmp, item_nap, item_ref, item_test, item_notes]
for item in itemlist:
item.setTextAlignment(Qt.AlignCenter)
if event_test and select_events == 'ref': if event_test and select_events == 'ref':
for item in itemlist: for item in itemlist:
item.setEnabled(False) item.setEnabled(False)
@ -2935,7 +2954,7 @@ class MainWindow(QMainWindow):
if hasattr(event, 'origins'): if hasattr(event, 'origins'):
if event.origins: if event.origins:
origin = event.origins[0] origin = event.origins[0]
item_time.setText(str(origin.time).split('.')[0]) item_time.setText(str(origin.time + 0).split('.')[0]) # +0 as workaround in case time=0s
item_lon.setText(str(origin.longitude)) item_lon.setText(str(origin.longitude))
item_lat.setText(str(origin.latitude)) item_lat.setText(str(origin.latitude))
item_depth.setText(str(origin.depth)) item_depth.setText(str(origin.depth))

View File

@ -576,6 +576,8 @@ class WaveformWidgetPG(QtGui.QWidget):
st_syn = wfsyn.select(network=network, station=station, channel=channel) st_syn = wfsyn.select(network=network, station=station, channel=channel)
if st_syn: if st_syn:
trace_syn = st_syn[0].copy() trace_syn = st_syn[0].copy()
else:
trace_syn = Trace()
if mapping: if mapping:
comp = channel[-1] comp = channel[-1]
n = compclass.getPlotPosition(str(comp)) n = compclass.getPlotPosition(str(comp))
@ -593,6 +595,8 @@ class WaveformWidgetPG(QtGui.QWidget):
if method == 'fast': if method == 'fast':
trace.data, time_ax = self.minMax(trace, time_ax) trace.data, time_ax = self.minMax(trace, time_ax)
if trace_syn:
trace_syn.data, time_ax_syn = self.minMax(trace_syn, time_ax_syn)
if time_ax not in [None, []]: if time_ax not in [None, []]:
if not scaleddata: if not scaleddata:
@ -605,10 +609,10 @@ class WaveformWidgetPG(QtGui.QWidget):
times = np.array([time for index, time in enumerate(time_ax) if not index % nth_sample]) times = np.array([time for index, time in enumerate(time_ax) if not index % nth_sample])
times_syn = np.array([time for index, time in enumerate(time_ax_syn) if not index % nth_sample] if st_syn else []) times_syn = np.array([time for index, time in enumerate(time_ax_syn) if not index % nth_sample] if st_syn else [])
trace.data = np.array([datum + n for index, datum in enumerate(trace.data) if not index % nth_sample]) trace.data = np.array([datum + n for index, datum in enumerate(trace.data) if not index % nth_sample])
trace.data_syn = np.array([datum + n for index, datum in enumerate(trace.data_syn) trace_syn.data = np.array([datum + n for index, datum in enumerate(trace_syn.data)
if not index % nth_sample] if st_syn else []) if not index % nth_sample] if st_syn else [])
plots.append((times, trace.data, plots.append((times, trace.data,
times_syn, trace.data_syn)) times_syn, trace_syn.data))
self.setPlotDict(n, (station, channel, network)) self.setPlotDict(n, (station, channel, network))
self.xlabel = 'seconds since {0}'.format(self.wfstart) self.xlabel = 'seconds since {0}'.format(self.wfstart)
self.ylabel = '' self.ylabel = ''