Repository navigation
Fix duplicate probe_id field in ProbeGroup.to_numpy(complete=True) - #473
Merged
samuelgarcia merged 3 commits intoOct 16, 2026
Merged
Conversation
samuelgarcia
approved these changes
Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ProbeGroup.to_numpy(complete=True)crashes withwhen a probe has a contact annotation named
probe_id. Since 0.4.0,to_numpyalways adds its ownprobe_idfield and then also adds every contact annotation (withcomplete=True), soprobe_idappears twice.How such annotations appear: version mismatch
These annotations come from files written and read by different probeinterface versions:
contact_vectorproperty (probegroup.to_numpy(complete=True)) includes aprobe_idcolumn.Probe.from_numpydoesn't knowprobe_idas a structural field, so it turns the column into a contact annotation. ASortingAnalyzersaved at this point stores the probe with that annotation.to_numpy(complete=True), called for example bySortingAnalyzer.get_channel_locations(), crashes.We hit this with Open Ephys data that was compressed with spikeinterface/probeinterface 0.4.x and sorted with spikeinterface 0.104.7/probeinterface 0.3.x. The resulting analyzers can't be loaded with probeinterface 0.4.x.
Fix
to_numpynow skips any probe fields namedprobe_indexorprobe_id, so the probegroup's own values are used. Stale annotations stay on the probe but are no longer exported.Minimal reproducer
Tests
Added
test_to_numpy_with_probe_id_contact_annotation. It fails on main and passes with this fix.🤖 Generated with Claude Code