dandi / nwb-healthstatus

Apache License 2.0
1 stars 1 forks source link

add spikeextractors: "data generators"? #13

Open yarikoptic opened 3 years ago

yarikoptic commented 3 years ago

an immediate use case is to support tests from spikeextractors: https://github.com/SpikeInterface/spikeextractors/blob/master/tests/test_gin_repo.py

In the original (before #11) state of things I was thinking that create could be converted to a generator which would yield (testsuite: str, test_case: str, nwbfile: NWBFile) tuples. So the simple1.py:create could have yielded a singular ("core", "simple1", nwbfile). Then in case of spikeextractors it could have yielded records like ("spikeextractors", "recording/BlackrockRecordingExtractor/blackrock/blackrock_2_1", nwbfile), ... ("spikeextractors", "sorting/BlackrockSortingExtractor/blackrock/blackrock_2_1", nwbfile), .... Do you see a nice way to have it implemented?

The idea of duplicating the leading testsuite record to be able in the future to extend to having a singular generator for extensions, where then leading record would include extension name then.

jwodder commented 3 years ago

@yarikoptic I'm not clear on how to adapt the spikeextractor code to produce NWBFile instances instead of writing the data directly to files. There's also the issue of how to pass the ephy_testing_data to the create() methods, including how the caller should know whether to do that in the first place (I'm imagining re-implementing pytest's fixtures).

yarikoptic commented 3 years ago

@yarikoptic I'm not clear on how to adapt the spikeextractor code to produce NWBFile instances instead of writing the data directly to files.

hm... looking at the code I think you can create an instance of NWBFile and pass it as nwbfile argument and it will be changed in place by that write_recording and then you return that file (I guess their interface could be improved to separate those two modes of operation)

yarikoptic commented 3 years ago

There's also the issue of how to pass the ephy_testing_data to the create() methods, including how the caller should know whether to do that in the first place (I'm imagining re-implementing pytest's fixtures).

test class itself should have those copy pasted for now etc... I will submit a quick PR which would mimic what I had in mind in original description

yarikoptic commented 3 years ago

@yarikoptic I'm not clear on how to adapt the spikeextractor code to produce NWBFile instances instead of writing the data directly to files.

hm... looking at the code I think you can create an instance of NWBFile and pass it as nwbfile argument and it will be changed in place by that write_recording and then you return that file (I guess their interface could be improved to separate those two modes of operation)

argh -- NwbSortingExtractor doesn't have write_recording and the only way is through the file. So I will implement a workaround -- saving into temp file and reloading to return NWBFile instance for now.