From 246dbf1493029f1fe3ad34c53512417e5ef27643 Mon Sep 17 00:00:00 2001 From: millen1m Date: Thu, 5 Apr 2018 18:40:05 +0100 Subject: [PATCH] can get significant range for fourier anplitude --- eqsig/__about__.py | 2 +- eqsig/__init__.py | 2 +- eqsig/single.py | 18 +++++++++++++++++- setup.py | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/eqsig/__about__.py b/eqsig/__about__.py index ce25754..cf5cf7d 100644 --- a/eqsig/__about__.py +++ b/eqsig/__about__.py @@ -1 +1 @@ -__version__ = "0.5.13" +__version__ = "0.5.14" diff --git a/eqsig/__init__.py b/eqsig/__init__.py index 1b64fbb..614ce10 100644 --- a/eqsig/__init__.py +++ b/eqsig/__init__.py @@ -1,2 +1,2 @@ -from eqsig.single import Signal, AccSignal +from eqsig.single import Signal, AccSignal, significant_range from eqsig import design_spectra diff --git a/eqsig/single.py b/eqsig/single.py index 5a34f46..fd91a37 100644 --- a/eqsig/single.py +++ b/eqsig/single.py @@ -604,4 +604,20 @@ def time_indices(npts, dt, start, end, index): e_index = end if e_index > npts: raise exceptions.SignalProcessingWarning("Cut point is greater than time series length") - return s_index, e_index \ No newline at end of file + return s_index, e_index + + +def significant_range(fas1_smooth, ratio=15): # TODO: move to signalpy + max_fas1 = max(fas1_smooth) + lim_fas = max_fas1 / ratio + min_freq_i = 10000 + max_freq_i = 10000 + for i in range(len(fas1_smooth)): + if fas1_smooth[i] > lim_fas: + min_freq_i = i + break + for i in range(len(fas1_smooth)): + if fas1_smooth[-1 - i] > lim_fas: + max_freq_i = len(fas1_smooth) - i + break + return min_freq_i, max_freq_i \ No newline at end of file diff --git a/setup.py b/setup.py index b12dfb7..788a978 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ install_requires=[ "numpy", "scipy", - "matplotlib", + "matplotlib", # to be removed "bwplot", "engformat" ],