Skip to content

Commit c0754eb

Browse files
committed
Merge branch 'development' of https://github.com/open-ephys/plugin-GUI into development
2 parents 8acce56 + 3756bfa commit c0754eb

12 files changed

Lines changed: 307 additions & 230 deletions

File tree

Plugins/BasicSpikeDisplay/SpikeDisplayNode/SpikeDisplayNode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void SpikeDisplayNode::setParameter(int param, float val)
106106

107107
for (auto ch : chan->localChannelIndexes)
108108
{
109-
msg += String(ch) + " ";
109+
msg += String(ch + 1) + " ";
110110
}
111111

112112
//std::cout << "MESSAGE: " << msg << std::endl;

Plugins/LfpDisplayNode/LfpChannelDisplay.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void LfpChannelDisplay::pxPaint()
243243
double a = (canvasSplit->getYCoordMax(chan, index)/range*channelHeightFloat);
244244
double b = (canvasSplit->getYCoordMin(chan, index)/range*channelHeightFloat);
245245

246-
double mean = (canvasSplit->getMean(chan)/range*channelHeightFloat);
246+
double mean = (canvasSplit->getScreenBufferMean(chan)/range*channelHeightFloat);
247247

248248
if (drawWithOffsetCorrection)
249249
{
@@ -508,7 +508,7 @@ void LfpChannelDisplay::pxPaintHistory(int playhead, int rightEdge, int maxScree
508508
double a = (canvasSplit->getYCoordMax(chan, index) / range * channelHeightFloat);
509509
double b = (canvasSplit->getYCoordMin(chan, index) / range * channelHeightFloat);
510510

511-
double mean = (canvasSplit->getMean(chan) / range * channelHeightFloat);
511+
double mean = (canvasSplit->getScreenBufferMean(chan) / range * channelHeightFloat);
512512

513513
if (drawWithOffsetCorrection)
514514
{

Plugins/LfpDisplayNode/LfpChannelDisplayInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void LfpChannelDisplayInfo::paint(Graphics& g)
247247

248248
g.setColour(Colours::grey);
249249
g.drawText(String(canvasSplit->getStd(chan)), 5, center+110,41,10,Justification::centred,false);
250-
g.drawText(String(canvasSplit->getMean(chan)), 5, center+60,41,10,Justification::centred,false);
250+
g.drawText(String(canvasSplit->getDisplayBufferMean(chan)), 5, center+60,41,10,Justification::centred,false);
251251

252252
if (x > 0)
253253
{

Plugins/LfpDisplayNode/LfpDisplayCanvas.cpp

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ uint16 LfpDisplaySplitter::getChannelStreamId(int channel)
15481548
return processor->getContinuousChannel(channel)->getStreamId();
15491549
}
15501550

1551-
float LfpDisplaySplitter::getMean(int chan)
1551+
float LfpDisplaySplitter::getScreenBufferMean(int chan)
15521552
{
15531553
float total = 0.0f;
15541554
float numPts = 0;
@@ -1566,16 +1566,51 @@ float LfpDisplaySplitter::getMean(int chan)
15661566
return total / numPts;
15671567
}
15681568

1569+
float LfpDisplaySplitter::getDisplayBufferMean(int chan)
1570+
{
1571+
float total = 0.0f;
1572+
float numPts = 0;
1573+
1574+
float sample = 0.0f;
1575+
1576+
// use 0.1s of sample to compute Mean and Std
1577+
float totalPoints = 0.1 * sampleRate;
1578+
1579+
for (int samp = displayBufferIndex[chan] - totalPoints; samp < displayBufferIndex[chan]; samp += 1)
1580+
{
1581+
if (samp >= 0) // read the beginning of the buffer
1582+
sample = *displayBuffer->getReadPointer(chan, samp);
1583+
else // read the end of the buffer if negative index
1584+
sample = *displayBuffer->getReadPointer(chan, displayBuffer->getNumSamples() - samp);
1585+
1586+
total += sample;
1587+
numPts++;
1588+
}
1589+
1590+
//std::cout << sample << std::endl;
1591+
1592+
return total / numPts;
1593+
}
1594+
15691595
float LfpDisplaySplitter::getStd(int chan)
15701596
{
15711597
float std = 0.0f;
1598+
float sample = 0.0f;
15721599

1573-
float mean = getMean(chan);
1600+
float mean = getDisplayBufferMean(chan);
15741601
float numPts = 1;
15751602

1576-
for (int samp = 0; samp < (lfpDisplay->getWidth() - leftmargin); samp += 10)
1603+
// use 0.1s of sample to compute Mean and Std
1604+
float totalPoints = 0.1 * sampleRate;
1605+
1606+
for (int samp = displayBufferIndex[chan] - totalPoints; samp < displayBufferIndex[chan]; samp += 1)
15771607
{
1578-
std += pow((*screenBufferMean->getReadPointer(chan, samp) - mean),2);
1608+
if (samp >= 0) // read the beginning of the buffer
1609+
sample = *displayBuffer->getReadPointer(chan, samp);
1610+
else // read the end of the buffer if negative index
1611+
sample = *displayBuffer->getReadPointer(chan, displayBuffer->getNumSamples() - samp);
1612+
1613+
std += pow((sample - mean),2);
15791614
numPts++;
15801615
}
15811616

Plugins/LfpDisplayNode/LfpDisplayCanvas.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,11 @@ class LfpDisplaySplitter : public Component,
263263
/** Gets the event channel state for a particular sample */
264264
const float getEventState(int samp);
265265

266-
/** Returns the mean of a given channel */
267-
float getMean(int chan);
266+
/** Returns the mean of a given channel, computed from the screen buffer */
267+
float getScreenBufferMean(int chan);
268+
269+
/** Returns the mean of a given channel, computed from the display buffer */
270+
float getDisplayBufferMean(int chan);
268271

269272
/** Returns the standard deviation of a given channnel*/
270273
float getStd(int chan);

0 commit comments

Comments
 (0)