Skip to content

Commit

Permalink
Add activity view for Quad Base probes
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiegle committed Jul 3, 2024
1 parent b8b09c7 commit 48df0c5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
17 changes: 10 additions & 7 deletions Source/Probes/Neuropixels_QuadBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ bool Neuropixels_QuadBase::open()
lfp_timestamp = 0;
eventCode = 0;

apView = new ActivityView (384, 3000);
apView = new ActivityView (384 * 4, 3000);

return errorCode == Neuropixels::SUCCESS;
}
Expand Down Expand Up @@ -324,6 +324,9 @@ void Neuropixels_QuadBase::writeConfiguration()

void Neuropixels_QuadBase::startAcquisition()
{

apView->reset();

if (acquisitionThreads.size() == 0)
{
for (int shank = 0; shank < 4; shank++)
Expand All @@ -336,12 +339,11 @@ void Neuropixels_QuadBase::startAcquisition()
dock,
shank,
quadBaseBuffers[shank],
this));
this,
apView));
}
}

apView->reset();

for (int shank = 0; shank < 4; shank++)
{
jassert (quadBaseBuffers[shank]->getNumSamples() == 0);
Expand All @@ -366,13 +368,15 @@ AcquisitionThread::AcquisitionThread (
int dock_,
int shank_,
DataBuffer* buffer_,
Probe* probe_) : Thread ("AcquisitionThread" + String (shank)),
Probe* probe_,
ActivityView* apView_) : Thread ("AcquisitionThread" + String (shank)),
slot (slot_),
port (port_),
dock (dock_),
shank (shank_),
buffer (buffer_),
probe (probe_),
apView(apView_),
ap_sample_rate (30000.0f),
ap_timestamp (0),
last_npx_timestamp (0),
Expand All @@ -392,7 +396,6 @@ AcquisitionThread::AcquisitionThread (

void AcquisitionThread::run()
{
//apView->reset();

ap_timestamp = 0;
last_npx_timestamp = 0;
Expand Down Expand Up @@ -451,7 +454,7 @@ void AcquisitionThread::run()
apSamples[packetNum + count * j] =
float (data[packetNum * shank_channel_count + j]) / 4096.0f / 100.0f * 1000000.0f; // convert to microvolts

//probe->apView->addSample(apSamples[j + packetNum * SKIP], j);
apView->addSample (apSamples[packetNum + count * j], j + shank * 384);
}

if (sendSync)
Expand Down
6 changes: 5 additions & 1 deletion Source/Probes/Neuropixels_QuadBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
class AcquisitionThread : public Thread
{
public:

AcquisitionThread (int slot,
int port,
int dock,
int shank,
DataBuffer* buffer,
Probe* probe);
Probe* probe,
ActivityView* apView);

/** Acquires data from the probe */
void run() override; // acquire data
Expand Down Expand Up @@ -77,6 +79,7 @@ class AcquisitionThread : public Thread
DataBuffer* buffer;
Probe* probe;
bool invertSyncLine = false;
ActivityView* apView;
};

/**
Expand All @@ -88,6 +91,7 @@ class AcquisitionThread : public Thread
class Neuropixels_QuadBase : public Probe
{
public:

/** Constructor */
Neuropixels_QuadBase (Basestation*,
Headstage*,
Expand Down
18 changes: 17 additions & 1 deletion Source/UI/ProbeBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,20 @@ ProbeBrowser::ProbeBrowser (NeuropixInterface* parent_) : parent (parent_)
cursorType = MouseCursor::NormalCursor;

activityToView = ActivityToView::APVIEW;
maxPeakToPeakAmplitude = 250.0f;

ProbeType probeType = parent->probe->type;

if (probeType == ProbeType::QUAD_BASE ||
probeType == ProbeType::NP2_1 ||
probeType == ProbeType::NP2_4)
{
maxPeakToPeakAmplitude = 1000.0f;
}
else
{
maxPeakToPeakAmplitude = 250.0f;
}


isOverZoomRegion = false;
isOverUpperBorder = false;
Expand Down Expand Up @@ -1015,6 +1028,9 @@ void ProbeBrowser::timerCallback()
if (parent->electrodeMetadata[i].status == ElectrodeStatus::CONNECTED)
{
int channelNumber = parent->electrodeMetadata[i].channel;

if (parent->probe->type == ProbeType::QUAD_BASE)
channelNumber += parent->electrodeMetadata[i].shank * 384;

parent->electrodeMetadata.getReference (i).colour =
ColourScheme::getColourForNormalizedValue (peakToPeakValues[channelNumber] / maxPeakToPeakAmplitude);
Expand Down

0 comments on commit 48df0c5

Please sign in to comment.