Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding option to overwrite while doing correct_motion and saving to a folder #3088

Merged
merged 15 commits into from
Jul 2, 2024
Merged
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
Loading