diff --git a/herdingspikes/detection_lightning/Detection.cpp b/herdingspikes/detection_lightning/Detection.cpp index 6c73214..938c8be 100644 --- a/herdingspikes/detection_lightning/Detection.cpp +++ b/herdingspikes/detection_lightning/Detection.cpp @@ -1,6 +1,6 @@ #include #include -#include + #include #include "Detection.h" @@ -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), @@ -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) @@ -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); } } diff --git a/herdingspikes/detection_lightning/RollingArray.h b/herdingspikes/detection_lightning/RollingArray.h index 764017e..d4ed7ae 100644 --- a/herdingspikes/detection_lightning/RollingArray.h +++ b/herdingspikes/detection_lightning/RollingArray.h @@ -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;