From 8419fc96810efef0dc40a8a76ae0e8a043af5e3c Mon Sep 17 00:00:00 2001 From: ludger Date: Thu, 14 Nov 2019 16:47:16 +0100 Subject: [PATCH] Taper CF before calculating AIC. --- pylot/core/io/data.py | 3 ++- pylot/core/pick/charfuns.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pylot/core/io/data.py b/pylot/core/io/data.py index befae4bc..a52197fb 100644 --- a/pylot/core/io/data.py +++ b/pylot/core/io/data.py @@ -14,7 +14,8 @@ from pylot.core.io.phases import readPILOTEvent, picks_from_picksdict, \ from pylot.core.util.errors import FormatError, OverwriteError from pylot.core.util.event import Event from pylot.core.util.obspyDMT_interface import qml_from_obspyDMT -from pylot.core.util.utils import fnConstructor, full_range, check4rotated, check4gapsAndMerge, trim_station_components +from pylot.core.util.utils import fnConstructor, full_range, check4rotated, \ + check4gapsAndMerge, trim_station_components class Data(object): diff --git a/pylot/core/pick/charfuns.py b/pylot/core/pick/charfuns.py index acb5a335..c589bdea 100644 --- a/pylot/core/pick/charfuns.py +++ b/pylot/core/pick/charfuns.py @@ -18,6 +18,7 @@ autoregressive prediction: application ot local and regional distances, Geophys. """ import numpy as np +from scipy import signal from obspy.core import Stream @@ -225,6 +226,8 @@ class AICcf(CharacteristicFunction): ind = np.where(~np.isnan(xnp))[0] if ind.size: xnp[:ind[0]] = xnp[ind[0]] + xnp = signal.tukey(len(xnp), alpha=0.05) * xnp + xnp = xnp - np.mean(xnp) datlen = len(xnp) k = np.arange(1, datlen) cf = np.zeros(datlen) @@ -238,7 +241,7 @@ class AICcf(CharacteristicFunction): ff = np.where(inf is True) if len(ff) >= 1: cf[ff] = 0 - + self.cf = cf - np.mean(cf) self.xcf = x @@ -302,6 +305,7 @@ class HOScf(CharacteristicFunction): if ind.size: first = ind[0] LTA[:first] = LTA[first] + self.cf = LTA self.xcf = x