Skip to content

Commit

Permalink
naming convention update
Browse files Browse the repository at this point in the history
  • Loading branch information
Erikpostt committed Sep 23, 2024
1 parent f44583c commit d2e0dac
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/paradigma/windowing.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,20 @@ def discard_segments(df, segment_nr_colname, min_length_segment_s, sampling_freq
return filtered_df


def categorize_segments(df, segment_nr_colname, config):
def categorize_segments(df, segment_nr_colname, sampling_frequency):
# Calculate the number of rows corresponding to 5, 10, and 20 seconds
short_segments_max = 5 * config.sampling_frequency # 5 seconds
moderately_long_segments_max = 10 * config.sampling_frequency # 10 seconds
long_segments_max = 20 * config.sampling_frequency # 20 seconds
short_segments_max_duration = 5 * sampling_frequency # 5 seconds
moderately_long_segments_max_duration = 10 * sampling_frequency # 10 seconds
long_segments_max_duration = 20 * sampling_frequency # 20 seconds

# Group by the segment column and apply the categorization
def categorize(group):
segment_size = len(group)
if segment_size < short_segments_max:
if segment_size < short_segments_max_duration:
return 1
elif segment_size < moderately_long_segments_max:
elif segment_size < moderately_long_segments_max_duration:
return 2
elif segment_size < long_segments_max:
elif segment_size < long_segments_max_duration:
return 3
else:
return 4
Expand Down

0 comments on commit d2e0dac

Please sign in to comment.