Skip to content

Commit

Permalink
added bandwidth calculator.
Browse files Browse the repository at this point in the history
  • Loading branch information
millen1m committed Nov 9, 2018
1 parent 739b880 commit bbeb679
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion eqsig/__about__.py
@@ -1 +1 @@
__version__ = "0.5.28"
__version__ = "0.5.29"
18 changes: 18 additions & 0 deletions eqsig/measures.py
Expand Up @@ -181,3 +181,21 @@ def max_fa_period(asig):
max_index = np.argmax(asig.fa_spectrum)
max_period = 1. / asig.fa_frequencies[max_index]
return max_period


def calc_bandwidth_f_min(asig, ratio=0.707):
fas1_smooth = asig.smooth_fa_spectrum
max_fas1 = max(fas1_smooth)
lim_fas = max_fas1 * ratio
ind2 = np.where(fas1_smooth > lim_fas)
min_freq = asig.smooth_fa_frequencies[ind2[0][0]]
return min_freq


def calc_bandwidth_f_max(asig, ratio=0.707):
fas1_smooth = asig.smooth_fa_spectrum
max_fas1 = max(fas1_smooth)
lim_fas = max_fas1 * ratio
ind2 = np.where(fas1_smooth > lim_fas)
max_freq = asig.smooth_fa_frequencies[ind2[0][-1]]
return max_freq

0 comments on commit bbeb679

Please sign in to comment.