Skip to content

Auto-generate contact_ids when not explicitly set#429

Open
h-mayorquin wants to merge 1 commit intoSpikeInterface:mainfrom
h-mayorquin:always_contact_ids
Open

Auto-generate contact_ids when not explicitly set#429
h-mayorquin wants to merge 1 commit intoSpikeInterface:mainfrom
h-mayorquin:always_contact_ids

Conversation

@h-mayorquin
Copy link
Copy Markdown
Collaborator

Closes #423. A Probe now always carries contact_ids: when the user does not pass them into set_contacts, they are auto-generated as ["0", "1", ..., str(n - 1)], matching the zero-indexed convention and giving every contact a stable, slicing- and aggregation-invariant handle without requiring every reader or caller to generate ids themselves. This removes a class of friction where downstream code (serialization round-trips, ProbeGroup aggregation in PR #420, ChannelsAggregationRecording in SpikeInterface #4465) had to special-case None at the consumer side. set_contact_ids also accepts the legacy all-empty-strings form (produced by older serialized probes via to_numpy) and regenerates in the same way, so old data still loads cleanly. Because contact_ids is now an internal invariant after set_contacts, I deleted the unreachable None guard in the BIDS export path in io.py (which also referenced the now-irrelevant auto_generate_contact_ids workflow) and the None branch in Probe.to_numpy. I kept the change narrow: Probe.__init__ still leaves _contact_ids = None so an unpopulated probe is still recognizable, and I did not touch the manufacturer-label split (python-neo's contact_name vs contact_id); that can come later if we decide we want to preserve manufacturer labels separately from the always-set identifier.

@h-mayorquin h-mayorquin marked this pull request as ready for review April 24, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Probes should always have contact ids

1 participant