Skip to content

Commit 7f0db1a

Browse files
committed
Save both Neuropixels 2.0 probes when recording starts
- Standardize how stream names are created across the code base for 2.0 probes - Standardized the stream name itself for 2.0 probes to include the device name, similar to other devices
1 parent 104126a commit 7f0db1a

File tree

7 files changed

+26
-16
lines changed

7 files changed

+26
-16
lines changed

Source/Devices/Neuropixels2e.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,15 @@ Neuropixels2e::~Neuropixels2e()
5353
deviceContext->setOption(ONIX_OPT_PASSTHROUGH, 0);
5454
}
5555

56+
std::string Neuropixels2e::createStreamName(int n)
57+
{
58+
return OnixDevice::createStreamName(ProbeString + std::to_string(n));
59+
}
60+
5661
void Neuropixels2e::createDataStream(int n)
5762
{
5863
StreamInfo apStream = StreamInfo(
59-
createStreamName("Probe" + std::to_string(n)),
64+
createStreamName(n),
6065
"Neuropixels 2.0 data stream",
6166
getStreamIdentifier(),
6267
numberOfChannels,

Source/Devices/Neuropixels2e.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ namespace OnixSourcePlugin
6262
void stopAcquisition() override;
6363
void processFrames() override;
6464
void addSourceBuffers(OwnedArray<DataBuffer>& sourceBuffers) override;
65+
std::string createStreamName(int);
6566

6667
int getNumProbes() const;
6768

Source/NeuropixelsComponents.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ namespace OnixSourcePlugin
348348
return bytes;
349349
}
350350

351+
static const std::string ProbeString = "Probe";
352+
351353
template<int ch, int e>
352354
class INeuropixel
353355
{

Source/OnixDevice.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ namespace OnixSourcePlugin
5656
UNKNOWN
5757
};
5858

59-
static const std::string ProbeString = "Probe";
60-
6159
struct StreamInfo {
6260
public:
6361
StreamInfo() {}

Source/OnixSource.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ void OnixSource::startRecording()
12511251
if (device->getDeviceType() == OnixDeviceType::NEUROPIXELSV1E || device->getDeviceType() == OnixDeviceType::NEUROPIXELSV1F)
12521252
{
12531253
auto npx = std::static_pointer_cast<Neuropixels1>(device);
1254-
auto streamName = npx->createStreamName(); // NB: Create the automatic stream name, without any suffixes and including the port name
1254+
auto streamName = npx->createStreamName();
12551255

12561256
auto streamExists = dataStreamExists(streamName, sn->getDataStreams());
12571257

@@ -1264,15 +1264,19 @@ void OnixSource::startRecording()
12641264
else if (device->getDeviceType() == OnixDeviceType::NEUROPIXELSV2E)
12651265
{
12661266
auto npx = std::static_pointer_cast<Neuropixels2e>(device);
1267-
auto streamName = npx->createStreamName(); // NB: Create the automatic stream name, without any suffixes and including the port name
12681267

1269-
auto streamExists = dataStreamExists(streamName, sn->getDataStreams());
1268+
for (int i = 0; i < npx->getNumProbes(); i++)
1269+
{
1270+
auto streamName = npx->createStreamName(i);
12701271

1271-
if (!streamExists)
1272-
return;
1272+
auto streamExists = dataStreamExists(streamName, sn->getDataStreams());
12731273

1274-
if (!npx->saveProbeInterfaceFile(dir, streamName))
1275-
return;
1274+
if (!streamExists)
1275+
return;
1276+
1277+
if (!npx->saveProbeInterfaceFile(dir, streamName))
1278+
return;
1279+
}
12761280
}
12771281
}
12781282
}

Source/OnixSourceCanvas.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void OnixSourceCanvas::addHub(std::string hubName, int offset)
9999

100100
tab = addTopLevelTab(getTopLevelTabName(port, hubName), (int)port);
101101

102-
devices.emplace_back(std::make_shared<Neuropixels2e>(ProbeString, hubName, passthroughIndex, context));
102+
devices.emplace_back(std::make_shared<Neuropixels2e>(OnixDevice::TypeString.at(OnixDeviceType::NEUROPIXELSV2E), hubName, passthroughIndex, context));
103103
devices.emplace_back(std::make_shared<PolledBno055>(OnixDevice::TypeString.at(OnixDeviceType::POLLEDBNO), hubName, passthroughIndex, context));
104104
}
105105

Source/UI/NeuropixelsV2eInterface.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ NeuropixelsV2eInterface::NeuropixelsV2eInterface(std::shared_ptr<Neuropixels2e>
3232
topLevelTabComponent = std::make_unique<CustomTabComponent>(true);
3333
addAndMakeVisible(topLevelTabComponent.get());
3434

35-
probeInterfaces[0] = std::make_unique<NeuropixelsV2eProbeInterface>(d, 0, e, c);
36-
topLevelTabComponent->addTab("Probe0", Colours::grey, CustomViewport::createCustomViewport(probeInterfaces[0].get()), true, 0);
37-
38-
probeInterfaces[1] = std::make_unique<NeuropixelsV2eProbeInterface>(d, 1, e, c);
39-
topLevelTabComponent->addTab("Probe1", Colours::grey, CustomViewport::createCustomViewport(probeInterfaces[1].get()), true, 1);
35+
for (int i = 0; i < numProbes; i++)
36+
{
37+
probeInterfaces[i] = std::make_unique<NeuropixelsV2eProbeInterface>(d, i, e, c);
38+
topLevelTabComponent->addTab(ProbeString + std::to_string(i), Colours::grey, CustomViewport::createCustomViewport(probeInterfaces[i].get()), true, i);
39+
}
4040

4141
deviceComponent = std::make_unique<Component>();
4242
deviceComponent->setBounds(0, 0, 600, 40);

0 commit comments

Comments
 (0)