Skip to content

Commit

Permalink
PR changes: added assertions to make sure the df contains only a sing…
Browse files Browse the repository at this point in the history
…le call type.
  • Loading branch information
danielle-hausler committed Oct 5, 2024
1 parent 53a6b3f commit e00256a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions soundbay/utils/metadata_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ def merge_calls(sorted_df: pd.DataFrame, overlap_pct_th: float = 0) -> List[pd.S
19 27
]
"""
if 'call_type' in sorted_df.columns:
assert sorted_df.call_type.nunique() == 1, 'The function is designed for a single call type.'
if 'label' in sorted_df.columns:
assert sorted_df.label.nunique() <= 2, 'The function is designed for a binary label.'

merged = [sorted_df.iloc[0].copy()]
for _, higher in sorted_df.iterrows():
lower = merged[-1].copy()
Expand Down

0 comments on commit e00256a

Please sign in to comment.