Bug: Multisorting - Extraction from pickle
See original GitHub issueAfter dumping a multisorting using (multisorting.dump_to_pickle(output_folder / ‘sorting.pkl’)). It can’t be revovered using se.load_extractor_from_pickle(output_folder / ‘sorting.pkl’). The following error occurs:
KeyError Traceback (most recent call last) <ipython-input-53-040ccfef509c> in <module> ----> 1 multisorting = se.load_extractor_from_pickle(‘/data/sarah/MEA/20210504/C25/829/low/1/merged/sorting.pkl’)
~/miniconda3/envs/spikesorting/lib/python3.8/site-packages/spikeextractors-0.9.6-py3.8.egg/spikeextractors/extraction_tools.py in load_extractor_from_pickle(pkl_file) 747 The loaded extractor object 748 “”" –> 749 return BaseExtractor.load_extractor_from_pickle(pkl_file) 750 751
~/miniconda3/envs/spikesorting/lib/python3.8/site-packages/spikeextractors-0.9.6-py3.8.egg/spikeextractors/baseextractor.py in load_extractor_from_pickle(pkl_file) 497 with open(str(pkl_file), ‘rb’) as f: 498 d = pickle.load(f) –> 499 extractor = _load_extractor_from_dict(d[‘serialized_dict’]) 500 if ‘properties’ in d.keys(): 501 extractor._properties = d[‘properties’]
KeyError: ‘serialized_dict’
Looking at the keys of the pickled file it didn’t create the ‘serialized_dict’ necessary for instantiating the extractor:
import pickle
with open(output_folder / 'sorting.pkl', 'rb') as f:
d=pickle.load(f)
print(d.keys())
gives:
dict_keys([‘class’, ‘module’, ‘kwargs’, ‘dumpable’, ‘version’, ‘relative_paths’, ‘annotations’, ‘properties’])
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Hi @alejoe91
sorry you are right I was mixing packages. I just tried the same approach using the si.load_extractor() function and loading from pickle works! Thanks for the clarification!
Closing the issue then 😃