Skip to content

Commit

Permalink
fix(tests): fix docstrings
Browse files Browse the repository at this point in the history
This fix both description and tests in the
SpikeClassifiers routines, since they
were outdated.

In `imosSpikeClassifierBurstHampel`, the description
for madfactor was wrong (wiki was correct) and
the test for the "ignore burst" functionality
was not very explicit.

Within the `BurstRunningStats,NonBurstSavGolOTSU,RunningStats`
functions, the docstrings were outdated with the function
behaviour, which was to return the index of spikes (a-la find).
  • Loading branch information
ocehugo committed Jun 10, 2021
1 parent ad54242 commit 9ef5d56
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
20 changes: 12 additions & 8 deletions AutomaticQC/SpikeClassifiers/imosSpikeClassifierBurstHampel.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
% signal - A Burst 1-d signal.
% use_burst_window - a boolean to consider the half_window_width applied at burst scale. If false, will consider the burst series as continuous.
% half_window_width - The half_window_width burst range (the full window size will be 1+2*half_window_width)
% madfactor - A multipling scale for the MAD.
% madfactor - a scale for the mean absolute deviation which values above will be marked as a spike.
% repeated_only - a boolean to mark spikes in burst only if they are detected more than one time (only for half_window_width>0).
% lower_mad_limit - a lower threshold for the MAD values, which values below will be ignored.
%
Expand All @@ -23,13 +23,11 @@
%
% % simple spikes
% x = randn(1,100)*1e-2;
% spikes = [3,7,33,92,99]
% spikes = [3,7,33,92,99];
% x(spikes) = 1000;
% bduration = 6;
% v = 1:bduration:length(x)+bduration;
% for k=1:length(v)-1;
% bind{k} = [v(k),min(v(k+1)-1,length(x))];
% end
% for k=1:length(v)-1; bind{k} = [v(k),min(v(k+1)-1,length(x))]; end
% [dspikes] = imosSpikeClassifierBurstHampel(bind,x);
% assert(isequal(dspikes,spikes));
% % equal to Hampel
Expand All @@ -38,12 +36,18 @@
% assert(isequal(dspikes,spikes));
% assert(isequal(dspikes,dspikes2));
%
% % detecting entire burst as spike
% % by ignoring the burst nature, we need to be aware
% % that entire bursts as spike will be missing.
%
% x = randn(1,100)*1e-2;
% fullburst_spiked = [3,7,13,14,15,16,17,18,33,92,99]
% fullburst_spiked = [3,7,13,14,15,16,17,18,33,92,99];
% x(fullburst_spiked) = 1000;
% [dspikes] = imosSpikeClassifierBurstHampel(bind,x);
% half_window_width = 1; % 3 point window
% madfactor = mad([1000,0,0]); %pick only big spikes.
% [dspikes] = imosSpikeClassifierBurstHampel(bind,x,false,1,madfactor);
% assert(isequal(dspikes,[3,7,33,92,99]));
%
% %considering the burst nature of sampling fix this
% [dspikes2] = imosSpikeClassifierBurstHampel(bind,x,true,2);
% assert(isequal(dspikes2,fullburst_spiked))
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
% z = randn(1,10);
% z(10) = 10000;
% [spikes] = imosSpikeClassifierRunningStats(z,@mean,@std,2);
% assert(spikes(10)==1)
% assert(spikes(1:9)==0)
% assert(spikes==10)
%
% author: hugo.oliveira@utas.edu.au
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
% signal = 10*sin(omega*t);
% signal([20]) = max(signal).^3;
% [spikes] = imosSpikeClassifierNonBurstSavGolOTSU(signal,5,2,100,5);
% assert(spikes,20)
% assert(spikes==20)
%
% author: Unknown
% author: Ken Ridgway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
% z = randn(1,10);
% z(10) = 10000;
% [spikes] = imosSpikeClassifierRunningStats(z,@mean,@std,2);
% assert(spikes(10)==1)
% assert(spikes(1:9)==0)
% assert(spikes==10)
%
% author: hugo.oliveira@utas.edu.au
%
Expand Down

0 comments on commit 9ef5d56

Please sign in to comment.