[bugfix] time axis for plots created with linspace instead of arange

[minor] enhanced error output
This commit is contained in:
Marcel Paffrath 2019-03-07 16:30:35 +01:00
parent 9583f9d351
commit 49bcdd2680
3 changed files with 13 additions and 8 deletions

View File

@ -1723,6 +1723,7 @@ class MainWindow(QMainWindow):
if self.tabs.currentIndex() == 1: if self.tabs.currentIndex() == 1:
if self._eventChanged[1]: if self._eventChanged[1]:
self.refresh_array_map() self.refresh_array_map()
self.fill_eventbox()
if not plotted and self._eventChanged[0]: if not plotted and self._eventChanged[0]:
# newWF(plot=False) = load data without plotting # newWF(plot=False) = load data without plotting
self.newWF(plot=False) self.newWF(plot=False)

View File

@ -71,8 +71,8 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None, linecol
' relative to most likely pick ...') ' relative to most likely pick ...')
x = X[0].data x = X[0].data
t = np.arange(0, X[0].stats.npts / X[0].stats.sampling_rate, t = np.linspace(0, X[0].stats.npts / X[0].stats.sampling_rate,
X[0].stats.delta) X[0].stats.npts)
inoise = getnoisewin(t, Pick1, TSNR[0], TSNR[1]) inoise = getnoisewin(t, Pick1, TSNR[0], TSNR[1])
# get signal window # get signal window
isignal = getsignalwin(t, Pick1, TSNR[2]) isignal = getsignalwin(t, Pick1, TSNR[2])
@ -216,8 +216,8 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None, linecolor='k'):
xraw = Xraw[0].data xraw = Xraw[0].data
xfilt = Xfilt[0].data xfilt = Xfilt[0].data
t = np.arange(0, Xraw[0].stats.npts / Xraw[0].stats.sampling_rate, t = np.linspace(0, Xraw[0].stats.npts / Xraw[0].stats.sampling_rate,
Xraw[0].stats.delta) Xraw[0].stats.npts)
# get pick window # get pick window
ipick = np.where((t <= min([Pick + pickwin, len(Xraw[0])])) & (t >= Pick)) ipick = np.where((t <= min([Pick + pickwin, len(Xraw[0])])) & (t >= Pick))
if len(ipick[0]) <= 1: if len(ipick[0]) <= 1:
@ -1148,8 +1148,8 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None, linecolor='k'):
for i, key in enumerate(['Z', 'N', 'E']): for i, key in enumerate(['Z', 'N', 'E']):
rms = rms_dict[key] rms = rms_dict[key]
trace = traces_dict[key] trace = traces_dict[key]
t = np.arange(diff_dict[key], trace.stats.npts / trace.stats.sampling_rate + diff_dict[key], t = np.linspace(diff_dict[key], trace.stats.npts / trace.stats.sampling_rate + diff_dict[key],
trace.stats.delta) trace.stats.npts)
if i == 0: if i == 0:
if real_None(fig) is None: if real_None(fig) is None:
fig = plt.figure() # self.iplot) ### WHY? MP MP fig = plt.figure() # self.iplot) ### WHY? MP MP

View File

@ -146,6 +146,7 @@ class Array_map(QtGui.QWidget):
message = 'Could not save picks for station {st}.\n{er}'.format(st=station, er=e) message = 'Could not save picks for station {st}.\n{er}'.format(st=station, er=e)
self._warn(message) self._warn(message)
print(message, e) print(message, e)
print(traceback.format_exc())
def connectSignals(self): def connectSignals(self):
self.comboBox_phase.currentIndexChanged.connect(self._refresh_drawings) self.comboBox_phase.currentIndexChanged.connect(self._refresh_drawings)
@ -486,8 +487,11 @@ class Array_map(QtGui.QWidget):
def remove_drawings(self): def remove_drawings(self):
self.remove_annotations() self.remove_annotations()
if hasattr(self, 'cbar'): if hasattr(self, 'cbar'):
try:
self.cbar.remove() self.cbar.remove()
self.cbax_bg.remove() self.cbax_bg.remove()
except Exception as e:
print('Warning: could not remove color bar or color bar bg.\nReason: {}'.format(e))
del (self.cbar, self.cbax_bg) del (self.cbar, self.cbax_bg)
if hasattr(self, 'sc_picked'): if hasattr(self, 'sc_picked'):
self.sc_picked.remove() self.sc_picked.remove()