[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._eventChanged[1]:
self.refresh_array_map()
self.fill_eventbox()
if not plotted and self._eventChanged[0]:
# newWF(plot=False) = load data without plotting
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 ...')
x = X[0].data
t = np.arange(0, X[0].stats.npts / X[0].stats.sampling_rate,
X[0].stats.delta)
t = np.linspace(0, X[0].stats.npts / X[0].stats.sampling_rate,
X[0].stats.npts)
inoise = getnoisewin(t, Pick1, TSNR[0], TSNR[1])
# get signal window
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
xfilt = Xfilt[0].data
t = np.arange(0, Xraw[0].stats.npts / Xraw[0].stats.sampling_rate,
Xraw[0].stats.delta)
t = np.linspace(0, Xraw[0].stats.npts / Xraw[0].stats.sampling_rate,
Xraw[0].stats.npts)
# get pick window
ipick = np.where((t <= min([Pick + pickwin, len(Xraw[0])])) & (t >= Pick))
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']):
rms = rms_dict[key]
trace = traces_dict[key]
t = np.arange(diff_dict[key], trace.stats.npts / trace.stats.sampling_rate + diff_dict[key],
trace.stats.delta)
t = np.linspace(diff_dict[key], trace.stats.npts / trace.stats.sampling_rate + diff_dict[key],
trace.stats.npts)
if i == 0:
if real_None(fig) is None:
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)
self._warn(message)
print(message, e)
print(traceback.format_exc())
def connectSignals(self):
self.comboBox_phase.currentIndexChanged.connect(self._refresh_drawings)
@ -486,8 +487,11 @@ class Array_map(QtGui.QWidget):
def remove_drawings(self):
self.remove_annotations()
if hasattr(self, 'cbar'):
try:
self.cbar.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)
if hasattr(self, 'sc_picked'):
self.sc_picked.remove()