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

Saving provenance with paths relative to folder #3165

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/spikeinterface/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,12 +950,12 @@ def save_to_folder(
folder.mkdir(parents=True, exist_ok=False)

# dump provenance
provenance_file_path = folder / f"provenance.json"
if self.check_serializability("json"):
provenance_file = folder / f"provenance.json"
self.dump(provenance_file)
self.dump_to_json(file_path=provenance_file_path, relative_to=folder)
elif self.check_serializability("pickle"):
provenance_file = folder / f"provenance.pkl"
self.dump(provenance_file)
self.dump_to_pickle(provenance_file, relative_to=folder)
else:
warnings.warn("The extractor is not serializable to file. The provenance will not be saved.")

Expand All @@ -967,8 +967,9 @@ def save_to_folder(
# copy properties/
self.copy_metadata(cached)

# dump
cached.dump(folder / f"si_folder.json", relative_to=folder)
# Dump the extractor to json file
si_folder_path = folder / f"si_folder.json"
cached.dump_to_json(file_path=si_folder_path, relative_to=folder)

return cached

Expand Down
Loading