fid = 'zeno19309_15DIV_40uM-CNQX_01';
t_end = loadspk([fid '.spk'],'last');
spk = loadspk([fid '.spk'],[0 t_end],0);
ss = SqueakySpk(fid,spk.meta.fs_Hz,1,spk);

avgFR_1hr = length(ss.time(ss.time>max(ss.time)-1*3600))/(1*3600)
avgFR_3hr = length(ss.time(ss.time>max(ss.time)-3*3600))/(3*3600)
avgFR_6hr = length(ss.time(ss.time>max(ss.time)-6*3600))/(6*3600)
avgFR_12hr = length(ss.time(ss.time>max(ss.time)-12*3600))/(12*3600)

%%
dt = 1;
%bin = max(ss.time)-12*3600:dt:max(ss.time);
bin = min(ss.time):dt:max(ss.time);
asdr = histc(ss.time,bin);
plot(bin,asdr/dt,'k-'); hold on;
plot([max(ss.time)-1*3600,max(ss.time)],[avgFR_1hr,avgFR_1hr],'-m','LineWidth',2);
plot([max(ss.time)-3*3600,max(ss.time)],[avgFR_3hr,avgFR_3hr],'-g','LineWidth',2);
plot([max(ss.time)-6*3600,max(ss.time)],[avgFR_6hr,avgFR_6hr],'-b','LineWidth',2);
plot([max(ss.time)-12*3600,max(ss.time)],[avgFR_12hr,avgFR_12hr],'-r','LineWidth',2);