Add typed Units columns and UnitMetrics table for per-unit metrics#20
Conversation
|
As we discussed, since only a subset of metrics ise the periods, individual columns could link to the This is how to check if valid unit periods were used in SI and which metric used it: @h-mayorquin the only "issue" here is that spike train metrics (which are also in the quality metrics list) also support periods, but I think that's ok... |
|
I implemented the logic for adding the This PR is ready to go, here is a summary of the current implementation:
Let me know if you want to to take a second look. Otherwise, we can merge and make a release. |
|
Good to merge for me @h-mayorquin ! |
|
I merged yours. SHOuld we still merge this one? |
Yes. I realize I have tests here. |
I'd like to propose a different shape for spike-sorting metrics storage than the open MetricExtension PR (#18). Two pieces:
Cell properties as typed columns on the Units table
Some cell properties are properties of the cell, independent of any analysis run, so they belong on
nwbfile.unitsas typed VectorData columns. As a minimal implementation of the idea I am addingFiringRate; other candidates are peak-to-trough duration, trough half-width, and median amplitude, we can add them after this PR if we refine this idea.A generic UnitMetrics table for run-dependent metrics
Besides cell properties, the metrics extension covers a lot. From the SpikeInterface side we have
quality_metrics(defined by purpose),template_metrics(defined by source), andspiketrain_metrics(defined by source). Like in #18, I have a generic DynamicTable to cover all those cases, but with some differences from #18: (1) explicit linkage to the Units table via a requiredunitDynamicTableRegion per row, which ensures provenance; (2) per-rowobs_intervalsmatching the NWB-coreUnits.obs_intervalsragged-column pattern, so we reuse the existing NWB convention for period attribution rather than introducing a new shape (this also covers the periods produced by SpikeInterface'svalid_unit_periodsextension).Taken together, this PR is the structural base: typed canonical columns on
nwbfile.unitsfor cell properties, plus a genericUnitMetricsDynamicTable for run-dependent metrics. Future PRs can either canonize more typed columns onUnitsor subclassUnitMetricsfor specific purposes (e.g., curation) with their own canonical columns.