Skip to content

Commit 229666e

Browse files
committed
Add LFP toggle button
1 parent c2e7b88 commit 229666e

File tree

4 files changed

+57
-36
lines changed

4 files changed

+57
-36
lines changed

Source/SourceSimEditor.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
SourceSimEditor::SourceSimEditor (GenericProcessor* parentNode, SourceSimThread* t)
2727
: GenericEditor (parentNode)
2828
{
29-
desiredWidth = 180;
29+
desiredWidth = 220;
3030
thread = t;
3131

3232
clockLabel = new Label ("clkFreqLabel", "CLK");
@@ -54,7 +54,11 @@ SourceSimEditor::SourceSimEditor (GenericProcessor* parentNode, SourceSimThread*
5454
quantityLabel->setBounds (138, 55, 40, 20);
5555
addAndMakeVisible (quantityLabel);
5656

57-
NPXDeviceLabel = new Label ("NPX1 Probe", "NPX1 Probe");
57+
lfpLabel = new Label ("LFP:", "LFP");
58+
lfpLabel->setBounds (176, 55, 40, 20);
59+
addAndMakeVisible (lfpLabel);
60+
61+
NPXDeviceLabel = new Label ("NPX Probe", "NPX Probe");
5862
NPXDeviceLabel->setBounds (5, 80, 85, 20);
5963
addAndMakeVisible (NPXDeviceLabel);
6064

@@ -66,6 +70,10 @@ SourceSimEditor::SourceSimEditor (GenericProcessor* parentNode, SourceSimThread*
6670
getParameterEditor ("npx_probes")->setLayout (ParameterEditor::nameHidden);
6771
getParameterEditor ("npx_probes")->setSize (30, 20);
6872

73+
addToggleParameterEditor (Parameter::PROCESSOR_SCOPE, "npx_type", 176, 80);
74+
getParameterEditor ("npx_type")->setLayout (ParameterEditor::nameHidden);
75+
getParameterEditor ("npx_type")->setSize (40, 20);
76+
6977
NIDAQDeviceLabel = new Label ("NIDAQ", "NIDAQ-Sim");
7078
NIDAQDeviceLabel->setBounds (5, 105, 85, 20);
7179
addAndMakeVisible (NIDAQDeviceLabel);
@@ -79,4 +87,4 @@ SourceSimEditor::SourceSimEditor (GenericProcessor* parentNode, SourceSimThread*
7987
getParameterEditor ("nidaq_devices")->setSize (30, 20);
8088
}
8189

82-
SourceSimEditor::~SourceSimEditor() {}
90+
SourceSimEditor::~SourceSimEditor() {}

Source/SourceSimEditor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class SourceSimEditor : public GenericEditor
6666
ScopedPointer<Label> deviceLabel;
6767
ScopedPointer<Label> channelsLabel;
6868
ScopedPointer<Label> quantityLabel;
69+
ScopedPointer<Label> lfpLabel;
6970

7071
ScopedPointer<Label> NPXDeviceLabel;
7172
ScopedPointer<Label> NIDAQDeviceLabel;

Source/SourceSimThread.cpp

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,14 @@ void SourceSimThread::registerParameters()
5454
settings.channelsPerProbe = 384;
5555
settings.numNIDAQ = 1;
5656
settings.channelsPerNIDAQ = 16;
57+
settings.probeType = true;
5758

5859
addIntParameter (Parameter::PROCESSOR_SCOPE, "clk_hz", "Clock Frequency", "Clock Frequency", settings.clkFreq, 1, 10000, false);
5960

6061
addIntParameter (Parameter::PROCESSOR_SCOPE, "npx_chans", "NPX Chans", "Number of channels per probe", settings.channelsPerProbe, 1, 10000, true);
6162

63+
addBooleanParameter (Parameter::PROCESSOR_SCOPE, "npx_type", "NPX Type", "Toggle Neuropixels probe type (1.0 = true, 2.0 = false)", true, true);
64+
6265
addIntParameter (Parameter::PROCESSOR_SCOPE, "npx_probes", "NPX Probes", "Number of probes", settings.numProbes, 0, 20, true);
6366

6467
addIntParameter (Parameter::PROCESSOR_SCOPE, "nidaq_chans", "NIDAQ Chans", "Number of channels per device", settings.channelsPerNIDAQ, 1, 32, true);
@@ -84,7 +87,7 @@ void SourceSimThread::updateSettings (OwnedArray<ContinuousChannel>* continuousC
8487
sources.clear();
8588

8689
std::vector<std::string> probeNames = {
87-
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
90+
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "AA", "BB", "CC", "DD", "EE", "FF"
8891
};
8992

9093
for (int i = 0; i < settings.numProbes; i++)
@@ -137,44 +140,48 @@ void SourceSimThread::updateSettings (OwnedArray<ContinuousChannel>* continuousC
137140

138141
//std::cout << "Probe " << i << " LFP; " << settings.channelsPerProbe << " channels." << std::endl;
139142

140-
DataStream::Settings lfpSettings {
141-
lfpBandName,
142-
"Neural data sampled @ 2.5kHz ",
143-
"SP" + String (i) + "_LFP",
144-
2500.0f
145-
};
146-
147-
dataStreams->add (new DataStream (lfpSettings));
148-
sources.add (new SimulatedSource (lfpBandName, settings.channelsPerProbe, 2500.0, SimulatedSourceType::LFP_BAND));
149-
sourceBuffers.add (new DataBuffer (settings.channelsPerProbe, 48000));
150-
sources.getLast()->buffer = sourceBuffers.getLast();
151-
152-
for (int j = 0; j < settings.channelsPerProbe; j++)
143+
if (settings.probeType) // NP 1.0 = true
153144
{
154-
ContinuousChannel::Settings channelSettings {
155-
ContinuousChannel::Type::ELECTRODE,
156-
"CH" + String (j + 1),
157-
"LFP voltage from electrode " + String (j + 1),
158-
"source",
159-
0.195f, // BITVOLTS VALUE
145+
DataStream::Settings lfpSettings {
146+
lfpBandName,
147+
"Neural data sampled @ 2.5kHz ",
148+
"SP" + String (i) + "_LFP",
149+
2500.0f
150+
};
151+
152+
dataStreams->add (new DataStream (lfpSettings));
153+
sources.add (new SimulatedSource (lfpBandName, settings.channelsPerProbe, 2500.0, SimulatedSourceType::LFP_BAND));
154+
sourceBuffers.add (new DataBuffer (settings.channelsPerProbe, 48000));
155+
sources.getLast()->buffer = sourceBuffers.getLast();
156+
157+
for (int j = 0; j < settings.channelsPerProbe; j++)
158+
{
159+
ContinuousChannel::Settings channelSettings {
160+
ContinuousChannel::Type::ELECTRODE,
161+
"CH" + String (j + 1),
162+
"LFP voltage from electrode " + String (j + 1),
163+
"source",
164+
0.195f, // BITVOLTS VALUE
165+
dataStreams->getLast()
166+
};
167+
168+
continuousChannels->add (new ContinuousChannel (channelSettings));
169+
}
170+
171+
EventChannel* lfpSyncLine;
172+
173+
EventChannel::Settings lfpSyncSettings {
174+
EventChannel::Type::TTL,
175+
"LFP Sync Line",
176+
"Synchronization signal from the LFP band of simulated probe " + String (i),
177+
"probe.sync",
160178
dataStreams->getLast()
161179
};
162180

163-
continuousChannels->add (new ContinuousChannel (channelSettings));
181+
lfpSyncLine = new EventChannel (lfpSyncSettings);
182+
eventChannels->add (lfpSyncLine);
164183
}
165184

166-
EventChannel* lfpSyncLine;
167-
168-
EventChannel::Settings lfpSyncSettings {
169-
EventChannel::Type::TTL,
170-
"LFP Sync Line",
171-
"Synchronization signal from the LFP band of simulated probe " + String (i),
172-
"probe.sync",
173-
dataStreams->getLast()
174-
};
175-
176-
lfpSyncLine = new EventChannel (lfpSyncSettings);
177-
eventChannels->add (lfpSyncLine);
178185
}
179186

180187
for (int i = 0; i < settings.numNIDAQ; i++)
@@ -242,6 +249,10 @@ void SourceSimThread::parameterValueChanged (Parameter* param)
242249
{
243250
settings.numProbes = ((IntParameter*) param)->getIntValue();
244251
}
252+
else if (param->getName().equalsIgnoreCase ("npx_type"))
253+
{
254+
settings.probeType = ((BooleanParameter*) param)->getBoolValue();
255+
}
245256
else if (param->getName().equalsIgnoreCase ("nidaq_chans"))
246257
{
247258
settings.channelsPerNIDAQ = ((IntParameter*) param)->getIntValue();

Source/SourceSimThread.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct PluginSettingsObject
3939
int channelsPerProbe;
4040
int numNIDAQ;
4141
int channelsPerNIDAQ;
42+
bool probeType; // true = 1.0, false = 2.0
4243
};
4344

4445
/**

0 commit comments

Comments
 (0)