CINPLA / expipe-plugin-cinpla

Plugins for expipe command line interface
http://expipe-plugin-cinpla.readthedocs.io/en/latest/
GNU General Public License v3.0
1 stars 3 forks source link

Unit "number" in curation view in browser does not match phy unit ID #71

Closed sarahthon closed 1 month ago

sarahthon commented 2 months ago

Hi, two questions:

1) After curating in phy, the reloaded and curated units seen in the "curation" tab in the display browser do not match with the saved unit "ID" that is reported in phy. Making it very challenging to look at curated units in the display and comparing them to units in phy.

I eg, there no longer exists a unit in phy with ID "23" after curating. It seems like the unit ID in browser display is not updated (even after reloading units from phy: image

2) Also, can we rather choose "phy unit ID" in the tab (where the number 5 is listed in the picture above), instead of what seems to be a list of the total number of cells ( i.eg. 0,2...,20 for 21 cells instead of their phy-ID)?

alejoe91 commented 2 months ago

Hi Sarah,

  1. In Phy you should have a si_unit_id column which corresponds to the SpikeInterface unit id.
  2. In the display, the dropdown displays the unit ID in the NWB file, which is an index (so it's always between 0 and N-1).

Since there are multiple ways to curate, there is no guarantee that the "phy unit ID" is available (e.g. when using quality metrics)

sarahthon commented 2 months ago
  1. This goes missing during curation (see picture). I thought maybe the "Id" option would be more stable. image

  2. I see - I can work with it "as is" :)

alejoe91 commented 2 months ago

I see! You can also check the unit table in the NWBViewer (open the Units and got to table, there should be a column called original_cluster_id :)

Alternatively, in a different cell, you can read the sorting object and print this original_cluster_id as follows:

import spikeinterface.extractors as se

sorting_phy = se.read_phy("path-to-phy-folder") 
# you can copy past it from the GUI (after `phy template-gui`)
# note that you have to remove the params.py from the file path

print(sorting_phy.get_property("original_cluster_id"))
sarahthon commented 2 months ago

Its probably hidden here, should I be able to click on it to expand(does not work now)? image

sarahthon commented 2 months ago

I assume it is updated form the "summary" tab somehow, trying to figure out how to update it according to my choices

alejoe91 commented 2 months ago

Not sure if you can expand...can you try by loading directly the SpikeInterface Sorting object?

sarahthon commented 2 months ago

I get all the units (including noise), how can I exclude units marked as "noise"?

I eg, I have 21 units marked as unsorted, good or mua, but the output here lists all phy units (including 41 noise "units"): image

Still I would have to match to the correct unit in phy, which I guess can be done manually when I sort on increasing unit ID number. But not the optimal solution when having many units

alejoe91 commented 2 months ago

You can simply do this!

sorting_phy = se.read_phy("path-to-phy-folder", exclude_cluster_groups=["noise"])

alejoe91 commented 1 month ago

@sarahthon can we close this?