Skip to content

Commit

Permalink
Merge pull request #3088 from yger/overwrite_motion
Browse files Browse the repository at this point in the history
Adding option to overwrite while doing correct_motion and saving to a folder
  • Loading branch information
alejoe91 authored Jul 2, 2024
2 parents 6bcd2e6 + 7b26657 commit 6dbf7c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/spikeinterface/preprocessing/motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@ def correct_motion(
job_kwargs = fix_job_kwargs(job_kwargs)
noise_levels = get_noise_levels(recording, return_scaled=False)

if folder is not None:
folder = Path(folder)
if overwrite:
if folder.is_dir():
import shutil

shutil.rmtree(folder)
else:
assert not folder.is_dir(), f"Folder {folder} already exists"

if not do_selection:
# maybe do this directly in the folder when not None, but might be slow on external storage
gather_mode = "memory"
Expand Down

0 comments on commit 6dbf7c6

Please sign in to comment.