Skip to content

Commit c078b87

Browse files
committed
Add column offsets for left vs. right column electrodes
- This is to match the electrode channel mapping spreadsheet, which has the correct values; the documentation contains the wrong equations, which were originally used
1 parent b3f986a commit c078b87

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

OpenEphys.Onix1/NeuropixelsV2SingleShankElectrode.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,16 @@ static int GetSingleShankChannelNumber(NeuropixelsV2Bank bank, int block, int ro
8888

8989
const int HalfBlock = 16;
9090

91-
return bank switch
91+
return (bank, columnIndex) switch
9292
{
93-
NeuropixelsV2Bank.A => row * ElectrodesPerRow + block * ElectrodesPerBlock + columnIndex,
94-
NeuropixelsV2Bank.B => (row * 7 % HalfBlock) * ElectrodesPerRow + block * ElectrodesPerBlock + columnIndex,
95-
NeuropixelsV2Bank.C => (row * 5 % HalfBlock) * ElectrodesPerRow + block * ElectrodesPerBlock + columnIndex,
96-
NeuropixelsV2Bank.D => (row * 3 % HalfBlock) * ElectrodesPerRow + block * ElectrodesPerBlock + columnIndex,
93+
(NeuropixelsV2Bank.A, 0) => row * ElectrodesPerRow + block * ElectrodesPerBlock,
94+
(NeuropixelsV2Bank.A, 1) => row * ElectrodesPerRow + block * ElectrodesPerBlock + 1,
95+
(NeuropixelsV2Bank.B, 0) => (row * 7 % HalfBlock) * ElectrodesPerRow + block * ElectrodesPerBlock,
96+
(NeuropixelsV2Bank.B, 1) => ((row * 7 + 4) % HalfBlock) * ElectrodesPerRow + block * ElectrodesPerBlock + 1,
97+
(NeuropixelsV2Bank.C, 0) => (row * 5 % HalfBlock) * ElectrodesPerRow + block * ElectrodesPerBlock,
98+
(NeuropixelsV2Bank.C, 1) => ((row * 5 + 8) % HalfBlock) * ElectrodesPerRow + block * ElectrodesPerBlock + 1,
99+
(NeuropixelsV2Bank.D, 0) => (row * 3 % HalfBlock) * ElectrodesPerRow + block * ElectrodesPerBlock,
100+
(NeuropixelsV2Bank.D, 1) => ((row * 3 + 12) % HalfBlock) * ElectrodesPerRow + block * ElectrodesPerBlock + 1,
97101
_ => throw new NotImplementedException($"Invalid {nameof(NeuropixelsV2Bank)} value given.")
98102
};
99103
}

0 commit comments

Comments
 (0)