Skip to content

Commit

Permalink
Merge branch 'HLA-810-remove-data' into HLA-812-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob720 committed Jan 9, 2025
2 parents 90bfeb9 + 01fcc4f commit c424e76
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/aa_remove_data/remove_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ def keep_every_nth(samples: list, n: int, block_size: int = 1) -> list:
Returns:
list: Reduced list of samples.
"""
if n <= 0:
raise ValueError(f"n = {n}, must be >= 1")
elif block_size <= 0:
raise ValueError(f"block_size = {block_size}, must be >= 1")
if block_size == 1:
return samples[n - 1 :: n]
else:
Expand All @@ -190,6 +194,10 @@ def remove_every_nth(samples: list, n: int, block_size: int = 1) -> list:
Returns:
list: Reduced list of samples.
"""
if n <= 0:
raise ValueError(f"n = {n}, must be >= 1")
elif block_size <= 0:
raise ValueError(f"block_size = {block_size}, must be >= 1")
if block_size == 1:
return [item for i, item in enumerate(samples) if (i + 1) % n != 0]
else:
Expand Down

0 comments on commit c424e76

Please sign in to comment.