From b542f832010d9b06a1d58d06608e25ff04e0f357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Mon, 29 May 2017 12:02:56 +0200 Subject: [PATCH] Bugfix, sligthly changed SNR and noise-level calculation. --- pylot/core/pick/utils.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 76312f83..724997a3 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -365,10 +365,10 @@ def getSNR(X, TSNR, t1, tracenum=0): x = x - np.mean(x[inoise]) # calculate ratios - # noiselevel = np.sqrt(np.mean(np.square(x[inoise]))) - # signallevel = np.sqrt(np.mean(np.square(x[isignal]))) + noiselevel = np.sqrt(np.mean(np.square(x[inoise]))) + #signallevel = np.sqrt(np.mean(np.square(x[isignal]))) - noiselevel = np.abs(x[inoise]).max() + #noiselevel = np.abs(x[inoise]).max() signallevel = np.abs(x[isignal]).max() SNR = signallevel / noiselevel @@ -480,18 +480,21 @@ def select_for_phase(st, phase): :type phase: str :return: ''' - from pylot.core.util.defaults import COMPNAME_MAP + from pylot.core.util.defaults import SetChannelComponents sel_st = Stream() + compclass = SetChannelComponents() if phase.upper() == 'P': comp = 'Z' - alter_comp = COMPNAME_MAP[comp] + alter_comp = compclass.getCompPosition(comp) + alter_comp = str(alter_comp[0]) sel_st += st.select(component=comp) sel_st += st.select(component=alter_comp) elif phase.upper() == 'S': comps = 'NE' for comp in comps: - alter_comp = COMPNAME_MAP[comp] + alter_comp = compclass.getCompPosition(comp) + alter_comp = str(alter_comp[0]) sel_st += st.select(component=comp) sel_st += st.select(component=alter_comp) else: