Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mhhennig/HS2
Browse files Browse the repository at this point in the history
  • Loading branch information
mhhennig committed Jul 19, 2024
2 parents 85685ef + 6ca1c8d commit 2f453ca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
22 changes: 10 additions & 12 deletions herdingspikes/detection_lightning/Detection.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <algorithm>
#include <numeric>
#include <iostream>

#include <omp.h>

#include "Detection.h"
Expand All @@ -21,10 +21,8 @@ namespace HSDetection
: traceRaw(chunkLeftMargin, numChannels, chunkSize),
numChannels(numChannels), alignedChannels(alignChannel(numChannels)),
chunkSize(chunkSize), chunkLeftMargin(chunkLeftMargin), rescale(rescale),
// scale(new FloatRaw[alignedChannels * channelAlign]),
// offset(new FloatRaw[alignedChannels * channelAlign]),
scale((FloatRaw *)operator new[](sizeof(FloatRaw) * alignedChannels * channelAlign, (std::align_val_t(channelAlign * sizeof(IntVolt))))),
offset((FloatRaw *)operator new[](sizeof(FloatRaw) * alignedChannels * channelAlign, (std::align_val_t(channelAlign * sizeof(IntVolt))))),
scale((FloatRaw *) operator new[](sizeof(FloatRaw) * alignedChannels * channelAlign, (std::align_val_t(channelAlign * sizeof(IntVolt))))),
offset((FloatRaw *) operator new[](sizeof(FloatRaw) * alignedChannels * channelAlign, (std::align_val_t(channelAlign * sizeof(IntVolt))))),
trace(chunkSize + chunkLeftMargin, alignedChannels * channelAlign),
medianReference(medianReference), averageReference(averageReference),
commonRef(chunkSize + chunkLeftMargin, 1),
Expand Down Expand Up @@ -64,8 +62,8 @@ namespace HSDetection
delete[] spikeArea;
delete[] hasAHP;

operator delete[](scale, std::align_val_t(channelAlign * sizeof(IntVolt)));
operator delete[](offset, std::align_val_t(channelAlign * sizeof(IntVolt)));
operator delete[](scale, align_val_t(channelAlign * sizeof(IntVolt)));
operator delete[](offset, align_val_t(channelAlign * sizeof(IntVolt)));
}

void Detection::step(FloatRaw *traceBuffer, IntFrame chunkStart, IntFrame chunkLen)
Expand Down Expand Up @@ -208,13 +206,13 @@ namespace HSDetection
for (IntFrame t = chunkStart; t < chunkStart + chunkLen; t++)
{
estimation(runningBaseline[t], runningDeviation[t],
trace[t], commonRef[t],
runningBaseline[t - 1], runningDeviation[t - 1],
thAlignedStart, thAlignedEnd);
trace[t], commonRef[t],
runningBaseline[t - 1], runningDeviation[t - 1],
thAlignedStart, thAlignedEnd);

detection(trace[t], commonRef[t],
runningBaseline[t], runningDeviation[t],
thAlignedStart * channelAlign, thActualEnd, t);
runningBaseline[t], runningDeviation[t],
thAlignedStart * channelAlign, thActualEnd, t);
}
}

Expand Down
12 changes: 4 additions & 8 deletions herdingspikes/detection_lightning/RollingArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,14 @@ namespace HSDetection
// {
// arrayBuffer = new (memAlign) IntVolt[(IntCalc)(frameMask + 1) * numChannels];
// }
// ~RollingArray() { operator delete[](arrayBuffer, memAlign); }
// RollingArray(IntFrame rollingLen, IntChannel numChannels)
// : frameMask(getMask(rollingLen)), numChannels(numChannels)
// {
// arrayBuffer = new IntVolt[(IntCalc)(frameMask + 1) * numChannels];
// }
RollingArray(IntFrame rollingLen, IntChannel numChannels)
: frameMask(getMask(rollingLen)), numChannels(numChannels)
{
arrayBuffer = (IntVolt *)operator new[](sizeof(IntVolt) * (IntCalc)(frameMask + 1) * numChannels, memAlign);
// std::cout << "Rollingarray\n";
arrayBuffer = (IntVolt *) operator new[](sizeof(IntVolt) * (IntCalc)(frameMask + 1) * numChannels,memAlign);
}
~RollingArray() { delete[] arrayBuffer; }

~RollingArray() { operator delete[](arrayBuffer, memAlign); }

// copy constructor deleted to protect buffer
RollingArray(const RollingArray &) = delete;
Expand Down

0 comments on commit 2f453ca

Please sign in to comment.