% A test script for the spikecleaning method
%
% J Sanjuan 26-01-08
%
% $Id: test_ao_spikecleaning.m,v 1.4 2009/02/02 15:20:38 hewitson Exp $
%
function test_ao_spikecleaning()
  
  % Make test AOs
  nsecs = 1e4;
  fs    = 1;
  
  pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*1.433*t) + randn(size(t))');
  
  a1=ao(pl);
  
  % Make spike cleaning of each
  
  % parameters list
  pl = plist('kspike', 1, 'method', 'mean');
  
  % use spike cleaning
  a3 = spikecleaning(a1); % default parameters list
  a4 = spikecleaning(a1, pl);
  
  % Plot (a1,a3)
  iplot(a1,a3)
  
  % plot history for a3
  plot(a3.hist)
  
  % Plot (a1,a4)
  iplot(a1,a4)
  
  % plot history for a4
  plot(a4.hist)
  
  % Reproduce from history
  a_out = rebuild(a3);
  a_out2 = rebuild(a4);
  
end