% Process SS objects.
% Venus Data
base = '../2012_05_03_Venus-MultiClamp/venus-20708/';

fids = {
    'multi-u_dead-time_2012-05-03_hoss-r3_venus_20708_01';
    };
for f = 1:length(fids)
    
    
    fid = fids{f};
    s = loadspk([base fid '.spk']);
    d = loaddig([base fid '.dig']);
    ss = SqueakySpk(fid,s.meta.fs_Hz,1,s);
    ss.RemoveChannel([1 8 33 57 64 35 24 60]);
    ss.CalculateAvgWaveform;
    
    % p2p waveform
    u = 1:max(ss.unit);
    p2p = max(ss.avgwaveform.avg) - min(ss.avgwaveform.avg);
    bu = u(p2p < 30);

    % Save
    save('venus_20708_bad_unit','bu');
    
end


base = '../2012_04_16_Tommy-MultiClamp/tommy-20709/';

fids = {
    'multi-u_dead-time_2012-04-16_hoss-r3_tommy_20709_01';
    };

for f = 1:length(fids)
    
    
       fid = fids{f};
    s = loadspk([base fid '.spk']);
    d = loaddig([base fid '.dig']);
    ss = SqueakySpk(fid,s.meta.fs_Hz,1,s);
    ss.RemoveChannel([1 8 33 57 64 35 24 60]);
    ss.CalculateAvgWaveform;
    
    % p2p waveform
    u = 1:max(ss.unit);
    p2p = max(ss.avgwaveform.avg) - min(ss.avgwaveform.avg);
    bu = u(p2p < 30);

    % Save
    save('tommy_20709_bad_unit','bu');
end