-
Notifications
You must be signed in to change notification settings - Fork 23
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
[Bug]: Double probe recording for KiloSortSortingInterface #1079
Comments
Hi, neuroconv decides on unit identity based on two things: "unit_name` and its corresponding electrodes (the electrodes in the electrode table associated with it). There are two ways of solving this from within neuroconv Change the unit name of the sortingfrom neuroconv.tools.testing import MockSortingInterface
from neuroconv import ConverterPipe
sorting_interface1 = MockSortingInterface(num_units=4)
sorting_interface2 = MockSortingInterface(num_units=4)
sorting_extractor1 = sorting_interface1.sorting_extractor
sorting_interface1.sorting_extractor = sorting_extractor1.rename_units(new_unit_ids=["a_sorting1", "b_sorting1", "c_sorting1", "d_sorting1"])
sorting_extractor2 = sorting_interface2.sorting_extractor
sorting_interface2.sorting_extractor = sorting_extractor2.rename_units(new_unit_ids=["a_sorting2", "b_sorting2", "c_sorting2", "d_sorting2"])
data_interfaces = {"sorting1": sorting_interface1, "sorting2": sorting_interface2}
converter = ConverterPipe(data_interfaces = data_interfaces)
# You can also run converter.run_conversion(kwargs)
nwbfile = converter.create_nwbfile()
nwbfile.units.to_dataframe() Write them in two separate tablesfrom neuroconv.tools.testing import MockSortingInterface
from neuroconv import ConverterPipe
sorting_interface1 = MockSortingInterface(num_units=4, seed=0)
sorting_interface2 = MockSortingInterface(num_units=4, seed=1)
data_interfaces = {"sorting1": sorting_interface1, "sorting2": sorting_interface2}
converter = ConverterPipe(data_interfaces=data_interfaces)
conversion_options = {
"sorting1": {"write_as": "processing", "units_name": "UnitsSorting1"},
"sorting2": {"write_as": "processing", "units_name": "UnitsSorting2"},
}
# You can also run converter.run_conversion(kwargs)
nwbfile = converter.create_nwbfile(conversion_options=conversion_options) There is another way of solving this but I realize we have not propagated that yet. I will work on that. |
Also, can you tell us more on why you want to add more than one sorting interface? As in, what is the experimental setup or result you want to achieve, just more context. @bendichter was asking recently if there were cases like this and we thought that this feature was sort of artificial so this is good for us to know. Knowing more about use cases is always useful for us. |
This worked, thank you very much! In my case, I used |
In that case, I also advise to add an annotation to the sorting unit about the probe if you are using one table or if you are using two tables add the probe in the description. |
Yes, I went for units ids with probe name included. Thanks again for your prompt and useful help! |
Thanks, I should add a how-to with this kind of info. I would need #1065 to be merge first to write though. |
What happened?
I tried to load two spike sorters from an experiment with two probes, then wrote a single file using ConverterPipe([KiloSortSortingInterface1, KiloSortSortingInterface2]).
When I open the file, I can't find half of the units, which apparently got overwritten. I was planning to just import the sorted units and not the corresponding raw electrical series; am I missing some arguments/metadata specification that would fix this? In that case, sorry in advance!
Steps to Reproduce
Traceback
No response
Operating System
macOS
Python Executable
Conda
Python Version
3.10
Package Versions
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: