Skip to content

v0.5.0: channel map ownership, deep copies, and schema-accurate validation - #23

Merged
jonnew merged 2 commits into
mainfrom
0.5.0
Jul 31, 2026
Merged

v0.5.0: channel map ownership, deep copies, and schema-accurate validation#23
jonnew merged 2 commits into
mainfrom
0.5.0

Conversation

@jonnew

@jonnew jonnew commented Jul 30, 2026

Copy link
Copy Markdown
Member
  • Flip the channel map direction from contact -> channel to channel -> contact. A hardware channel can only ever be wired to one contact, so channel is the value that actually needs uniqueness enforcement; keying by channel makes that structural (a Dictionary can't hold two entries for the same key), so duplicate-channel detection in Probe's constructor and ProbeGroup.ValidateDeviceChannelIndices no longer need a separate manual scan.
  • Move channel map ownership off Probe: Probe.ChannelMap and Probe.TryGetMappedChannel are now internal. Public access goes through ProbeGroup.ChannelMap / ProbeGroup.TryGetMappedChannel, or through the new SingleProbeGroup base class for groups that always contain exactly one probe. Probe.GetChannelMap() and ProbeGroup.GetChannelMap() are removed in favor of the ChannelMap properties.
  • Add SingleProbeGroup: an abstract ProbeGroup subclass that enforces the single-probe invariant and exposes Probe, ChannelMap, and TryGetMappedChannel without a probe-index argument.
  • Add deep copy constructors to Probe, ProbeAnnotations, and ProbeGroup. Copies no longer share a channel map or contact/probe annotation store with their source.
  • Add schema-accurate validation to Probe's JSON constructor:
    • ndim must be 2 or 3
    • contact_positions, contact_plane_axes, and probe_planar_contour rows must match ndim
    • contact_plane_axes entries can't be null and must contain exactly 2 axis vectors
    • contact_shape_params must be consistent with contact_shapes (circle requires radius, rect requires width and height, square requires width)
  • Add validation to ContactShapeParam: radius/width/height must be non-negative, and at least one of radius or width must be specified.
  • Require model_name and manufacturer in ProbeAnnotations, matching the probeinterface schema.
  • Add ProbeGroup.NumberOfProbes.
  • Enable InternalsVisibleTo for OpenEphys.ProbeInterface.NET.Tests.
  • Correct and complete XML doc comments across the public API.

…ation

- Flip the channel map direction from contact -> channel to
  channel -> contact. A hardware channel can only ever be wired to one
  contact, so channel is the value that actually needs uniqueness
  enforcement; keying by channel makes that structural (a Dictionary
  can't hold two entries for the same key), so duplicate-channel
  detection in Probe's constructor and ProbeGroup.ValidateDeviceChannelIndices
  no longer need a separate manual scan.
- Move channel map ownership off Probe: Probe.ChannelMap and
  Probe.TryGetMappedChannel are now internal. Public access goes through
  ProbeGroup.ChannelMap / ProbeGroup.TryGetMappedChannel, or through the
  new SingleProbeGroup base class for groups that always contain exactly
  one probe. Probe.GetChannelMap() and ProbeGroup.GetChannelMap() are
  removed in favor of the ChannelMap properties.
- Add SingleProbeGroup: an abstract ProbeGroup subclass that enforces the
  single-probe invariant and exposes Probe, ChannelMap, and
  TryGetMappedChannel without a probe-index argument.
- Add deep copy constructors to Probe, ProbeAnnotations, and ProbeGroup.
  Copies no longer share a channel map or contact/probe annotation store
  with their source.
- Add schema-accurate validation to Probe's JSON constructor:
  - ndim must be 2 or 3
  - contact_positions, contact_plane_axes, and probe_planar_contour rows
    must match ndim
  - contact_plane_axes entries can't be null and must contain exactly 2
    axis vectors
  - contact_shape_params must be consistent with contact_shapes (circle
    requires radius, rect requires width and height, square requires
    width)
- Add validation to ContactShapeParam: radius/width/height must be
  non-negative, and at least one of radius or width must be specified.
- Require model_name and manufacturer in ProbeAnnotations, matching the
  probeinterface schema.
- Add ProbeGroup.NumberOfProbes.
- Enable InternalsVisibleTo for OpenEphys.ProbeInterface.NET.Tests.
- Correct and complete XML doc comments across the public API.
@jonnew jonnew added this to the 0.5.0 milestone Jul 30, 2026
…ontact

- ChannelWiring.WireChannels' assignments parameter (IDictionary<int,int>)
  now reads channel -> contact, matching the direction already used by
  ProbeGroup.ChannelMap, TryGetMappedChannel, and the JSON
  device_channel_indices handling. Previously it was the one remaining
  API surface still keyed by contact.
- Note: This is a silent breaking change: the parameter type is unchanged
  (IDictionary<int,int>), so existing callers will keep compiling but
  wire the wrong contacts to the wrong channels unless updated.
  WireChannel, UnwireChannel, and UnwireChannels are unaffected.
- Validation swaps accordingly: channel keys must be >= 0; contact
  values must be within [0, contact count) and unique within the call.
  Duplicate-channel-within-a-call is now structurally impossible (can't
  construct a Dictionary with two identical keys), so that manual check
  is removed; a new check catches the mirror case, the same contact
  targeted by two different channels in one call.
@jonnew
jonnew requested a review from bparks13 July 31, 2026 01:26
@jonnew
jonnew merged commit d7f22cb into main Jul 31, 2026
9 checks passed
@jonnew
jonnew deleted the 0.5.0 branch July 31, 2026 11:34
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