Skip to content

Commit 8086231

Browse files
committed
Merge branch 'development' of https://github.com/open-ephys/plugin-GUI into development
2 parents f157f16 + 3b91905 commit 8086231

4 files changed

Lines changed: 13 additions & 7 deletions

File tree

Source/Plugins/SpikeSorter/SpikeSortBoxes.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ static int iminarg1,iminarg2;
17051705
static double sqrarg;
17061706
#define SQR(a) ((sqrarg = (a)) == 0.0 ? 0.0 : sqrarg * sqrarg)
17071707

1708-
PCAjob::PCAjob(SorterSpikeArray _spikes, float* _pc1, float* _pc2,
1708+
PCAjob::PCAjob(SorterSpikeArray& _spikes, float* _pc1, float* _pc2,
17091709
float* pc1Min, float* pc2Min, float* pc1Max, float* pc2Max, bool* _reportDone) : spikes(_spikes), reportDone(_reportDone)
17101710
{
17111711
cov = nullptr;
@@ -2142,7 +2142,11 @@ void PCAjob::computeSVD()
21422142

21432143
void PCAcomputingThread::addPCAjob(PCAjob job)
21442144
{
2145-
jobs.push(job);
2145+
{
2146+
ScopedLock critical(lock);
2147+
jobs.push(job);
2148+
}
2149+
21462150
if (!isThreadRunning())
21472151
{
21482152
startThread();
@@ -2153,8 +2157,10 @@ void PCAcomputingThread::run()
21532157
{
21542158
while (jobs.size() > 0)
21552159
{
2160+
lock.enter();
21562161
PCAjob J = jobs.front();
21572162
jobs.pop();
2163+
lock.exit();
21582164
// compute PCA
21592165
// 1. Compute Covariance matrix
21602166
// 2. Apply SVD on covariance matrix

Source/Plugins/SpikeSorter/SpikeSortBoxes.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ PCAjob();
179179
class PCAjob
180180
{
181181
public:
182-
PCAjob(SorterSpikeArray _spikes, float* _pc1, float* _pc2,
182+
PCAjob(SorterSpikeArray& _spikes, float* _pc1, float* _pc2,
183183
float*, float*, float*, float*, bool* _reportDone);
184184
~PCAjob();
185185
void computeCov();
@@ -215,7 +215,9 @@ class PCAcomputingThread : juce::Thread
215215
void run(); // computes PCA on waveforms
216216
void addPCAjob(PCAjob job);
217217

218+
private:
218219
std::queue<PCAjob> jobs;
220+
CriticalSection lock;
219221
};
220222

221223
class PCAUnit

Source/Plugins/SpikeSorter/SpikeSorterCanvas.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ void WaveformAxes::plotSpike(SorterSpikePtr s, Graphics& g)
10751075
g.setColour(Colour(s->color[0], s->color[1], s->color[2]));
10761076
//g.setColour(Colours::pink);
10771077
//compute the spatial width for each waveform sample
1078-
float dx = getWidth()/float(spikeBuffer[0]->getChannel()->getTotalSamples());
1078+
float dx = getWidth()/float(s->getChannel()->getTotalSamples());
10791079

10801080
/*
10811081
float align = 8 * getWidth()/float(spikeBuffer[0].nSamples);

Source/Processors/DataThreads/DataThread.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ void DataThread::updateChannels()
102102
void DataThread::setOutputHigh() {}
103103
void DataThread::setOutputLow() {}
104104

105-
int DataThread::getNumDataOutputs(DataChannel::DataChannelTypes type, int subproc) const { return 0; }
106-
107-
unsigned int DataThread::getNumSubProcessors() const { return 0; }
105+
unsigned int DataThread::getNumSubProcessors() const { return 1; }
108106

109107
int DataThread::getNumTTLOutputs(int subproc) const { return 0; }
110108

0 commit comments

Comments
 (0)