From 396555b4b4dee8c7df0b7a3296b07f695c7b8334 Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Wed, 31 May 2017 10:28:31 +0200 Subject: [PATCH] changes in resolution window (added parameter for extent), TRIAL: changes in YLims of pickwindow after init Pick --- pylot/RELEASE-VERSION | 2 +- pylot/core/pick/utils.py | 14 ++++++++------ pylot/core/util/widgets.py | 18 ++++++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/pylot/RELEASE-VERSION b/pylot/RELEASE-VERSION index 3bdc5478..e2737ed3 100644 --- a/pylot/RELEASE-VERSION +++ b/pylot/RELEASE-VERSION @@ -1 +1 @@ -ceed1-dirty +f493-dirty diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 5a06de3e..071acedb 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -436,7 +436,7 @@ def getsignalwin(t, t1, tsignal): return isignal -def getResolutionWindow(snr, aperture): +def getResolutionWindow(snr, extent): """ Number -> Float produce the half of the time resolution window width from given SNR @@ -447,6 +447,8 @@ def getResolutionWindow(snr, aperture): 1.5 > SNR -> 15 sec VLRW see also Diehl et al. 2009 + :parameter: extent, can be 'local', 'regional', 'global' + >>> getResolutionWindow(0.5) 7.5 >>> getResolutionWindow(1.8) @@ -466,15 +468,15 @@ def getResolutionWindow(snr, aperture): } if snr < 1.5: - time_resolution = res_wins[aperture]['VLRW'] + time_resolution = res_wins[extent]['VLRW'] elif snr < 2.: - time_resolution = res_wins[aperture]['LRW'] + time_resolution = res_wins[extent]['LRW'] elif snr < 3.: - time_resolution = res_wins[aperture]['MRW'] + time_resolution = res_wins[extent]['MRW'] elif snr >3.: - time_resolution = res_wins[aperture]['HRW'] + time_resolution = res_wins[extent]['HRW'] else: - time_resolution = res_wins[aperture]['VLRW'] + time_resolution = res_wins[extent]['VLRW'] return time_resolution / 2 diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 04d63c78..6a05b411 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -438,11 +438,13 @@ class WaveformWidget(FigureCanvas): nmax = 0 compclass = SetChannelComponents() - alter_comp = compclass.getCompPosition(component) - alter_comp = str(alter_comp[0]) - wfdata = wfdata.select(component=component) - wfdata += wfdata.select(component=alter_comp) + if not component == '*': + alter_comp = compclass.getCompPosition(component) + alter_comp = str(alter_comp[0]) + + wfdata = wfdata.select(component=component) + wfdata += wfdata.select(component=alter_comp) # list containing tuples of network, station, channel (for sorting) nsc = [] @@ -982,7 +984,7 @@ class PickDlg(QDialog): else: noiselevel = nfac - x_res = getResolutionWindow(snr, 'regional') + x_res = getResolutionWindow(snr, parameter.get('extent')) # remove mean noise level from waveforms for trace in data: @@ -991,7 +993,7 @@ class PickDlg(QDialog): trace = demeanTrace(trace=trace, window=inoise) self.setXLims([ini_pick - x_res, ini_pick + x_res]) - self.setYLims(np.array([-noiselevel * 2.5, noiselevel * 2.5]) + + self.setYLims(np.array([-noiselevel * 3.5, noiselevel * 3.5]) + trace_number) self.getPlotWidget().plotWFData(wfdata=data, title=self.getStation() + @@ -1042,12 +1044,12 @@ class PickDlg(QDialog): horiz_comp = find_horizontals(data) data = scaleWFData(data, noiselevel * 2.5, horiz_comp) - x_res = getResolutionWindow(snr, 'regional') + x_res = getResolutionWindow(snr, parameter.get('extent')) self.setXLims(tuple([ini_pick - x_res, ini_pick + x_res])) traces = self.getTraceID(horiz_comp) traces.sort() - self.setYLims(tuple(np.array([-0.5, +0.5]) + + self.setYLims(tuple(np.array([-1.0, +1.0]) + np.array(traces))) noiselevels = [trace + 1 / (2.5 * 2) for trace in traces] + \ [trace - 1 / (2.5 * 2) for trace in traces]