function BIfilt(fid_prefix)

fpath = ['C:\Users\USER\Documents\mingfaifong\' fid_prefix '\'];
spath = [fpath 'figures\'];
load([fpath fid_prefix '_nowaveform.SS'],'-mat');

SS.ASDR(1,0,0); %from 1 second bins
asdr_times = SS.asdr(:,1);
asdr_1sec = SS.asdr(:,2);

%binsize = 60; %seconds
binsize = 3600; %seconds
BI = NaN(size(asdr_times));

for j = binsize/2:length(asdr_times)-binsize/2+1
    ind = find(asdr_times>=j-binsize/2 & asdr_times < j+binsize/2);
    asdr_sort = sort(asdr_1sec(ind));
    f15 = sum(asdr_sort(round(0.85*length(asdr_sort)):length(asdr_sort)))/sum(asdr_sort);
    BI(j) = (f15-0.15)/0.85;
end


save([fpath fid_prefix '_asdr_BIfilt.mat'],'BI','asdr_1sec','asdr_times','binsize');