From 1f8482829fef124b03ad7ecfdbce0d3ed7b286d8 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Thu, 11 Jul 2024 12:13:09 -0600 Subject: [PATCH] add relative to provenance (#3165) --- src/spikeinterface/core/base.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/spikeinterface/core/base.py b/src/spikeinterface/core/base.py index 8b037ad10f..b2d147ce4c 100644 --- a/src/spikeinterface/core/base.py +++ b/src/spikeinterface/core/base.py @@ -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.") @@ -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