%% basic pipeline ripple detection

basepath = 'Z:\OR3\OR3day8\';
fname = [basepath 'OR3day8'];
ResampleBinary([basepath 'OR3day8.dat'],[basepath 'OR3day8.lfp'],1,16);

%% detect SWR
cd(basepath)

%     ripsL = detect_hfos(fname,46,'ripTH',[2 4 inf],'Overwrite',1); 
%     ripsR = detect_hfos(fname,50,'ripTH',[2 4 inf],'Overwrite',1); 
    
    swrL = detect_swr(fname,[46 36 45 33 48 37 44 38]-32);
    swrR = detect_swr(fname,[50 63 51 62 52 61]);
    
    ripsL = bz_FindRipples(basepath,46-32);
    ripsR = bz_FindRipples(basepath,50-32);

%% inspect detection
EventExplorer(basepath,'SWR')

