Skip to content

Commit

Permalink
Add more UHD configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiegle committed Apr 29, 2024
1 parent 195ecba commit f83ffdd
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 38 deletions.
5 changes: 4 additions & 1 deletion Source/Basestations/SimulatedBasestation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SimulatedBasestationConfigWindow::SimulatedBasestationConfigWindow(SimulatedBase
comboBox->addItem("Empty", (int) ProbeType::NONE);
comboBox->addItem("Neuropixels 1.0", (int) ProbeType::NP1);
comboBox->addItem("Neuropixels NHP (45 mm)", (int)ProbeType::NHP45);
comboBox->addItem("Neuropixels UHD", (int)ProbeType::UHD1);
comboBox->addItem("Neuropixels UHD - Active", (int)ProbeType::UHD2);
comboBox->addItem("Neuropixels 2.0 1-shank", (int)ProbeType::NP2_1);
comboBox->addItem("Neuropixels 2.0 4-shank", (int)ProbeType::NP2_4);
comboBox->addItem("Neuropixels Opto", (int) ProbeType::OPTO);
Expand Down Expand Up @@ -158,6 +158,9 @@ bool SimulatedBasestation::open()
case ProbeType::UHD1:
headstages.add(new SimulatedHeadstage(this, i + 1, "NP1100", 48948291 + i));
break;
case ProbeType::UHD2:
headstages.add(new SimulatedHeadstage(this, i + 1, "NP1110", 48948211 + i));
break;
case ProbeType::NP2_1:
headstages.add(new SimulatedHeadstage(this, i + 1, "NP2000", 58948291 + i));
break;
Expand Down
6 changes: 4 additions & 2 deletions Source/Probes/Geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,15 +680,17 @@ void Geometry::UHD(bool switchable,
float siteSpacing, Array<ElectrodeMetadata>& electrodeMetadata,
ProbeMetadata& probeMetadata)
{
// need to implement switchable case
probeMetadata.type = ProbeType::UHD1;


if (switchable)
{
probeMetadata.name = "Neuropixels Ultra (Switchable)";
probeMetadata.type = ProbeType::UHD2;
}
else {

probeMetadata.type = ProbeType::UHD1;

if (numColumns == 8 && siteSpacing == 6.0f)
probeMetadata.name = "Neuropixels Ultra (Phase 1)";
if (numColumns == 2 && siteSpacing == 4.5f)
Expand Down
158 changes: 144 additions & 14 deletions Source/Probes/Neuropixels_UHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,14 @@ Neuropixels_UHD::Neuropixels_UHD(Basestation* bs, Headstage* hs, Flex* fl) : Pro
ap_sample_rate = 30000.0f;

for (int i = 0; i < 16; i++)
settings.availableElectrodeConfigurations.add("Bank: " + String(i));
settings.availableElectrodeConfigurations.add("Tip Half");
settings.availableElectrodeConfigurations.add("Base Half");
settings.availableElectrodeConfigurations.add("8 x 48: Bank " + String(i));
settings.availableElectrodeConfigurations.add("1 x 384: Tip Half");
settings.availableElectrodeConfigurations.add("1 x 384: Base Half");
settings.availableElectrodeConfigurations.add("2 x 192");
settings.availableElectrodeConfigurations.add("4 x 96");
settings.availableElectrodeConfigurations.add("2 x 2 x 96");

settings.electrodeConfigurationIndex = 1;
settings.electrodeConfigurationIndex = 1; // 8 x 48: Bank 0

for (int i = 0; i < channel_count; i++)
{
Expand Down Expand Up @@ -249,19 +252,19 @@ Array<int> Neuropixels_UHD::selectElectrodeConfiguration(String electrodeConfigu
* --------24 GROUPS------|-------24 GROUPS-------
*/

int banksPerProbe = 16;
int groupsPerBank = 24;
int groupsPerBankColumn = 6;
int electrodesPerGroup = 16;
int banksPerProbe = 16;
int groupsPerBank = 24;
int groupsPerBankColumn = 6;
int electrodesPerGroup = 16;

Neuropixels::NP_ErrorCode ec;
Neuropixels::NP_ErrorCode ec;

int index = settings.availableElectrodeConfigurations.indexOf(electrodeConfiguration);

if (index == -1)
return returnValue;

if (index < banksPerProbe)
if (index < banksPerProbe || index > 17)
{
LOGC("Selecting column pattern: ALL");
// select columnar configuration
Expand All @@ -284,10 +287,10 @@ Array<int> Neuropixels_UHD::selectElectrodeConfiguration(String electrodeConfigu

);
}

// Select all groups in a particular bank
if (index < banksPerProbe)
{
if (index < banksPerProbe)
{
LOGC("Selecting bank: ", index);

// Select all groups at this bank index
Expand All @@ -300,7 +303,134 @@ Array<int> Neuropixels_UHD::selectElectrodeConfiguration(String electrodeConfigu
index); // bank index

return returnValue;
}
}
else if (index == 17) // 2 x 192
{
LOGC("Selecting 2 x 192 configuration");

// Select G2, G6, G10, G14, G18, G22 from bank 0
for (int group = 2; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
0); // bank index

// Select G0, G4, G8, G12, G16, G20 from bank 1
for (int group = 0; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
1); // bank index

// Select G3, G7, G11, G15, G19, G23 from bank 2
for (int group = 0; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
2); // bank index

// Select G1, G5, G9, G13, G17, G21 from bank 3
for (int group = 0; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
3); // bank index

return returnValue;

}
else if (index == 18) // 4 x 96
{
// Select G2, G6, G10, G14, G18, G22 from bank 0
for (int group = 2; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
0); // bank index

// Select G3, G7, G11, G15, G19, G23 from bank 0
for (int group = 0; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
0); // bank index

// Select G0, G4, G8, G12, G16, G20 from bank 1
for (int group = 0; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
1); // bank index

// Select G1, G5, G9, G13, G17, G21 from bank 1
for (int group = 0; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
1); // bank index

return returnValue;

}
else if (index == 19) // 2 x 2 x 96
{
// Select G2, G6, G10, G14, G18, G22 from bank 1
for (int group = 2; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
1); // bank index

// Select G3, G7, G11, G15, G19, G23 from bank 1
for (int group = 0; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
1); // bank index

// Select G0, G4, G8, G12, G16, G20 from bank 0
for (int group = 0; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
0); // bank index

// Select G1, G5, G9, G13, G17, G21 from bank 0
for (int group = 0; group < groupsPerBank; group += 4)
ec = Neuropixels::selectElectrodeGroup(
basestation->slot, // slot
headstage->port, // port
dock, // dock
group, // group number
0); // bank index

return returnValue;

}

// This code is only reached for 1 x 384 configurations!!

// Select a subset of groups in multiple banks to span half of the probe
// 0 = Select groups from middle to tip of probe (Banks 0-7)
Expand Down
56 changes: 35 additions & 21 deletions Source/Probes/SimulatedProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ SimulatedProbe::SimulatedProbe(Basestation* bs,
type == ProbeType::NHP25 ||
type == ProbeType::NHP45 ||
type == ProbeType::UHD1 ||
type == ProbeType::UHD2 ||
type == ProbeType::NHP1)
{
settings.availableApGains.add(50.0f);
Expand All @@ -105,31 +106,47 @@ SimulatedProbe::SimulatedProbe(Basestation* bs,
settings.availableLfpGains.add(2000.0f);
settings.availableLfpGains.add(3000.0f);

if (type != ProbeType::UHD1 && type != ProbeType::NHP1)
std::cout << "Probe Type: " << (int) type << std::endl;

if (type == ProbeType::UHD2)
{
settings.availableElectrodeConfigurations.add("Bank A");
settings.availableElectrodeConfigurations.add("Bank B");
settings.availableElectrodeConfigurations.add("Bank C");
for (int i = 0; i < 16; i++)
settings.availableElectrodeConfigurations.add("8 x 48: Bank " + String(i));
settings.availableElectrodeConfigurations.add("1 x 384: Tip Half");
settings.availableElectrodeConfigurations.add("1 x 384: Base Half");
settings.availableElectrodeConfigurations.add("2 x 192");
settings.availableElectrodeConfigurations.add("4 x 96");
settings.availableElectrodeConfigurations.add("2 x 2 x 96");

if (type == ProbeType::NHP25 || type == ProbeType::NHP45)
LOGC("ADDING ELECTRODE CONFIGS");
}
else {
if (type != ProbeType::UHD1 && type != ProbeType::NHP1)
{
settings.availableElectrodeConfigurations.add("Bank D");
settings.availableElectrodeConfigurations.add("Bank E");
settings.availableElectrodeConfigurations.add("Bank F");
settings.availableElectrodeConfigurations.add("Bank G");
settings.availableElectrodeConfigurations.add("Bank A");
settings.availableElectrodeConfigurations.add("Bank B");
settings.availableElectrodeConfigurations.add("Bank C");

if (type == ProbeType::NHP45)
if (type == ProbeType::NHP25 || type == ProbeType::NHP45)
{
settings.availableElectrodeConfigurations.add("Bank H");
settings.availableElectrodeConfigurations.add("Bank I");
settings.availableElectrodeConfigurations.add("Bank J");
settings.availableElectrodeConfigurations.add("Bank K");
settings.availableElectrodeConfigurations.add("Bank L");
settings.availableElectrodeConfigurations.add("Bank D");
settings.availableElectrodeConfigurations.add("Bank E");
settings.availableElectrodeConfigurations.add("Bank F");
settings.availableElectrodeConfigurations.add("Bank G");

if (type == ProbeType::NHP45)
{
settings.availableElectrodeConfigurations.add("Bank H");
settings.availableElectrodeConfigurations.add("Bank I");
settings.availableElectrodeConfigurations.add("Bank J");
settings.availableElectrodeConfigurations.add("Bank K");
settings.availableElectrodeConfigurations.add("Bank L");
}
}
}

settings.availableElectrodeConfigurations.add("Single Column");
settings.availableElectrodeConfigurations.add("Tetrodes");
settings.availableElectrodeConfigurations.add("Single Column");
settings.availableElectrodeConfigurations.add("Tetrodes");
}
}

settings.apGainIndex = 3;
Expand All @@ -138,9 +155,6 @@ SimulatedProbe::SimulatedProbe(Basestation* bs,

settings.availableReferences.add("Ext");
settings.availableReferences.add("Tip");
//settings.availableReferences.add("192");
//settings.availableReferences.add("576");
//settings.availableReferences.add("960");

}
else {
Expand Down
2 changes: 2 additions & 0 deletions Source/UI/NeuropixInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ NeuropixInterface::NeuropixInterface(DataSource* p,
electrodeConfigurationComboBox->addItem("Select a preset...", 1);
electrodeConfigurationComboBox->setItemEnabled(1, false);
electrodeConfigurationComboBox->addSeparator();

LOGC("FOUND ", probe->settings.availableElectrodeConfigurations.size(), " electrode configurations");

for (int i = 0; i < probe->settings.availableElectrodeConfigurations.size(); i++)
{
Expand Down

0 comments on commit f83ffdd

Please sign in to comment.