Skip to content

Commit

Permalink
copy overlay_df resolves modifying original label df in overlay init #…
Browse files Browse the repository at this point in the history
…953

avoid modifying original overlay_df object passed to Overlay.__init__()
  • Loading branch information
sammlapp committed May 2, 2024
1 parent 2d2e3d2 commit 8f383df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion opensoundscape/preprocess/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
See the preprocessor module and Preprocessing tutorial
for details on how to use and create your own actions.
"""

import random
import warnings
import numpy as np
Expand Down Expand Up @@ -506,7 +507,7 @@ def __init__(self, is_augmentation=True, **kwargs):

self.returns_labels = True

overlay_df = kwargs["overlay_df"]
overlay_df = kwargs["overlay_df"].copy() # copy to avoid modifying original
overlay_df = overlay_df[~overlay_df.index.duplicated()] # remove duplicates

# warn the user if using "different" as overlay_class
Expand Down

0 comments on commit 8f383df

Please sign in to comment.