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

Save/load comparison objects with pickle #2013

Merged
merged 2 commits into from
Sep 22, 2023

Conversation

alejoe91
Copy link
Member

Closes #2012

Turns out that all comparison objects (since all sorting objects are now pickleable), are also directly pickleable. This PR only deprecates the save_to_folder/load_from_folder functions of the MultiSortingComparison.

# generate
sorting = si.generate_sorting()
sorting_mono = si.generate_sorting(durations=[10])
rec, sort = si.generate_ground_truth_recording()
we = si.extract_waveforms(rec, sort, mode="memory", progress_bar=False, return_scaled=False)

# two sorters
cmp = si.compare_two_sorters(sorting, sorting)
cmp_l = pickle.loads(pickle.dumps(cmp))

cmp_gt = si.compare_sorter_to_ground_truth(sorting, sorting)
cmp_gt_l = pickle.loads(pickle.dumps(cmp_gt))

# multiple sorters
mcmp = si.compare_multiple_sorters([sorting, sorting, sorting])
mcmp_l = pickle.loads(pickle.dumps(mcmp))

# collision and correlograms
cmp_coll = si.CollisionGTComparison(sorting_mono, sorting_mono)
cmp_coll_l = pickle.loads(pickle.dumps(cmp_coll))

cmp_corr = si.CorrelogramGTComparison(sorting_mono, sorting_mono)
cmp_corr_l = pickle.loads(pickle.dumps(cmp_corr))

# templates
cmp_t = si.compare_templates(we, we)
cmp_t_l = pickle.loads(pickle.dumps(cmp_t))

mcmp_t = si.compare_multiple_templates([we, we, we])
mcmp_t_l = pickle.loads(pickle.dumps(mcmp_t))

@alejoe91 alejoe91 added the comparison Related to comparison module label Sep 19, 2023
@samuelgarcia samuelgarcia merged commit 37463ac into SpikeInterface:main Sep 22, 2023
8 checks passed
@alejoe91 alejoe91 deleted the save-load-comparison branch October 17, 2023 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comparison Related to comparison module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Save/load comparison object
2 participants