Skip to content

Commit

Permalink
resolve signal_to_ffts
Browse files Browse the repository at this point in the history
  • Loading branch information
Erikpostt committed Sep 20, 2024
1 parent 0f5c553 commit 4cda54e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/paradigma/feature_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,13 @@ def signal_to_ffts(
tuple
Lists of FFT values and corresponding frequencies which can be concatenated as column to the dataframe.
"""
results = [compute_fft(row, window_type, sampling_frequency) for row in sensor_col]
l_freqs_total, l_values_total = map(list, zip(*results))

return l_freqs_total, l_values_total
# Compute the frequencies just once (as they should be identical for all rows)
_, l_freqs = compute_fft(sensor_col.iloc[0], window_type, sampling_frequency)

# Compute FFT values for all rows
l_values_total = [compute_fft(row, window_type, sampling_frequency)[0] for row in sensor_col]

return l_freqs, l_values_total

def compute_power_in_bandwidth(
sensor_col: list,
Expand Down

0 comments on commit 4cda54e

Please sign in to comment.