-
Notifications
You must be signed in to change notification settings - Fork 175
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_to_folder()
fails for the InjectDriftingTemplatesRecording
#3125
Comments
Thanks! One simple option is to make the |
Oh! That sounds good. Happy to make a PR for that -- is it done by implementing |
@cwindolf you can just add this at the end of the init:
|
Mmm the Templates should be json serializable, it has a dict: spikeinterface/src/spikeinterface/core/template.py Lines 250 to 261 in ed9d1b5
Could you share a minimal example where this fails? |
@h-mayorquin it does have a I think for the same reason @alejoe91 just setting |
@h-mayorquin maybe we just need to extend the |
@cwindolf no we don't need to inherit from @h-mayorquin let's discuss about this tomorrow! |
OK. Let's discuss it tomorrow. |
Thanks @alejoe91 ! This is great. rec.frame_slice(0, 1000).save_to_folder(scratch_dir)
rec1 = si.load_extractor(scratch_dir / "provenance.pkl")
rec1._kwargs["parent_recording"].drifting_templates.templates_array_moved.shape |
@cwindolf you can also do this! (better API)
|
Thanks, good to know! |
When trying to save a hybrid recording, I get the error
TypeError: Object of type DriftingTemplates is not JSON serializable
. This makes sense, because DriftingTemplates inherits from Templates which is a dataclass and not a BaseExtractor, so it will not be.to_dict()
ed by https://github.com/SpikeInterface/spikeinterface/blob/main/src/spikeinterface/core/base.py#L423 even though it has a.to_dict()
method.I'm not sure how to resolve this? One could maybe make Templates subclass BaseExtractor while still being a dataclass? Although it does feel a bit strange to json-serialize a large array of templates. Anyway, wanted to see what you all think, thanks!
The text was updated successfully, but these errors were encountered: