Skip to content

Attach ProbeGroup directly to recordings#4531

Draft
h-mayorquin wants to merge 21 commits intoSpikeInterface:mainfrom
h-mayorquin:probe_refactoring
Draft

Attach ProbeGroup directly to recordings#4531
h-mayorquin wants to merge 21 commits intoSpikeInterface:mainfrom
h-mayorquin:probe_refactoring

Conversation

@h-mayorquin
Copy link
Copy Markdown
Collaborator

@h-mayorquin h-mayorquin commented Apr 19, 2026

Coming here from probeinterface #425.

This PR migrates SpikeInterface's recording layer from the flat contact_vector structured array stored in _properties to a ProbeGroup object held directly on the recording. BaseRecordingSnippets grows a _probegroup attribute populated by set_probe / set_probegroup and propagated through every probe-retaining operation. get_channel_locations reads positions from probegroup._contact_vector (the narrow handle from #425).

SpikeInterface #4465 was developed assuming the fuller array-backed direction in probeinterface (probeinterface #420). This PR takes the same recording-side migration but pairs with the narrower probeinterface #425. The SI-side code ends up roughly the same shape either way; what changes is how much we ask probeinterface to absorb.

Three technical points:

  • ProbeGroup becomes the canonical attached object. The legacy contact_vector property is gone from the steady-state representation. All probe-retaining operations (set_probe, ChannelSliceRecording, ChannelsAggregationRecording, motion_interpolation remove_channels, dict-load) route through the canonical _set_probes path, so location and group derive from the attached probegroup consistently rather than being maintained separately across code paths.

  • Probe serialization stays in probeinterface. The recording's to_dict() delegates to ProbeGroup.to_dict(), and _load_extractor_from_dict restores via ProbeGroup.from_dict(...). There is no recording-side format for probe state; the serialized representation matches the in-memory object. Derived properties like location and group are still written on the recording for backward compatibility and to keep the diff focused, but they are treated as cached views of the probegroup, not as the canonical representation.

  • Old recordings still load. A _restore_probegroup_from_legacy_contact_vector helper migrates the legacy contact_vector property plus associated annotations (probes_info, planar contours) into the new representation on load, then drops the legacy fields. biocam and maxwell extractors (which previously read contact_vector["row"] / ["col"] / ["electrode"] directly) now read from probe.contact_annotations.

@h-mayorquin h-mayorquin changed the title [draft] Probe refactoring Attach ProbeGroup directly to recordings via _probegroup Apr 19, 2026
@h-mayorquin h-mayorquin changed the title Attach ProbeGroup directly to recordings via _probegroup Attach ProbeGroup directly to recordings Apr 19, 2026
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.

1 participant