Skip to content

Commit

Permalink
Deprecate multicomparison save/load functions in favor of pickle
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoe91 committed Sep 19, 2023
1 parent fc95465 commit 9add5de
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/spikeinterface/comparison/multicomparisons.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pathlib import Path
import json
import pickle
import warnings

import numpy as np

Expand Down Expand Up @@ -180,6 +181,11 @@ def get_agreement_sorting(self, minimum_agreement_count=1, minimum_agreement_cou
return sorting

def save_to_folder(self, save_folder):
warnings.warn(
"save_to_folder() is deprecated. You should save and load the multi sorting comparison object using pickle.\n>>> pickle.dump(mcmp, open('mcmp.pkl', 'wb')))))\n>>> mcmp_loaded = pickle.load(open('mcmp.pkl', 'rb'))",
DeprecationWarning,
stacklevel=2,
)
for sorting in self.object_list:
assert (
sorting.check_if_json_serializable()
Expand All @@ -205,6 +211,11 @@ def save_to_folder(self, save_folder):

@staticmethod
def load_from_folder(folder_path):
warnings.warn(
"load_from_folder() is deprecated. You should save and load the multi sorting comparison object using pickle.\n>>> pickle.dump(mcmp, open('mcmp.pkl', 'wb')))))\n>>> mcmp_loaded = pickle.load(open('mcmp.pkl', 'rb'))",
DeprecationWarning,
stacklevel=2,
)
folder_path = Path(folder_path)
with (folder_path / "kwargs.json").open() as f:
kwargs = json.load(f)
Expand Down

0 comments on commit 9add5de

Please sign in to comment.