spikeinterface icon indicating copy to clipboard operation
spikeinterface copied to clipboard

`.save_to_folder()` fails for the `InjectDriftingTemplatesRecording`

Open cwindolf opened this issue 7 months ago • 12 comments

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!

cwindolf avatar Jul 02 '24 16:07 cwindolf