Skip to content

Commit

Permalink
fix band rms docstring and change band rms code
Browse files Browse the repository at this point in the history
  • Loading branch information
SaraPido committed May 15, 2024
1 parent 0b231de commit 3e232aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 2 additions & 5 deletions sigpro/aggregations/frequency/band.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ def band_rms(amplitude_values, frequency_values, min_frequency, max_frequency):
lower_frequency_than = frequency_values <= max_frequency
higher_frequency_than = frequency_values >= min_frequency

selected_idx = np.ravel(np.where(np.ravel(higher_frequency_than & lower_frequency_than)))

selected_idx = [int(x) for x in selected_idx]

selected_values = np.array(amplitude_values)[selected_idx]
selected_idx = np.ravel(np.where(higher_frequency_than & lower_frequency_than))
selected_values = amplitude_values[selected_idx]

return np.sqrt(np.mean(np.square(selected_values)))
5 changes: 3 additions & 2 deletions sigpro/basic_primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ def __init__(self, min_frequency, max_frequency):

class BandRMS(primitive.FrequencyAggregation):
"""
BandMean primitive class.
BandRMS primitive class.
Filters between a high and low band and compute the mean value for this specific band.
Filter between a high and low band (inclusive) and compute the rms value for this
specific band.
Args:
min_frequency (int or float):
Expand Down

0 comments on commit 3e232aa

Please sign in to comment.