From 4f634cc43a679e1a8fb58ea6892cfb8767e1403d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Wed, 12 Aug 2015 16:48:55 +0200 Subject: [PATCH] Debuged getDataArray: Reliable cutting of waveforms independetn from actual waveform lengths. --- pylot/core/pick/CharFuns.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pylot/core/pick/CharFuns.py b/pylot/core/pick/CharFuns.py index b6fb2f41..b3ad1f07 100644 --- a/pylot/core/pick/CharFuns.py +++ b/pylot/core/pick/CharFuns.py @@ -15,6 +15,8 @@ autoregressive prediction: application ot local and regional distances, Geophys. :author: MAGS2 EP3 working group """ + +import matplotlib.pyplot as plt import numpy as np from obspy.core import Stream @@ -162,10 +164,12 @@ class CharacteristicFunction(object): stop = min([len(self.orig_data[0]), len(self.orig_data[1])]) elif self.cut[0] == 0 and self.cut[1] is not 0: start = 0 - stop = self.cut[1] / self.dt + stop = min([self.cut[1] / self.dt, len(self.orig_data[0]), \ + len(self.orig_data[1])]) else: - start = self.cut[0] / self.dt - stop = self.cut[1] / self.dt + start = max([0, self.cut[0] / self.dt]) + stop = min([self.cut[1] / self.dt, len(self.orig_data[0]), \ + len(self.orig_data[1])]) hh = self.orig_data.copy() h1 = hh[0].copy() h2 = hh[1].copy() @@ -176,13 +180,15 @@ class CharacteristicFunction(object): elif len(self.orig_data) == 3: if self.cut[0] == 0 and self.cut[1] == 0: start = 0 - stop = min([len(self.orig_data[0]), len(self.orig_data[1]), len(self.orig_data[2])]) + stop = min([self.cut[1] / self.dt, len(self.orig_data[0]), \ + len(self.orig_data[1]), len(self.orig_data[2])]) elif self.cut[0] == 0 and self.cut[1] is not 0: start = 0 stop = self.cut[1] / self.dt else: - start = self.cut[0] / self.dt - stop = self.cut[1] / self.dt + start = max([0, self.cut[0] / self.dt]) + stop = min([self.cut[1] / self.dt, len(self.orig_data[0]), \ + len(self.orig_data[1]), len(self.orig_data[2])]) hh = self.orig_data.copy() h1 = hh[0].copy() h2 = hh[1].copy()