function ASDR_CSDR(fid_prefix)

fpath = 'C:\Users\USER\Documents\mingfaifong_tmp\';
load([fpath fid_prefix '_nowaveform.mat']);

load('turbo364_0to1hr.SS','-mat');
SS.name = [fid_prefix '_nowaveform'];
SS.clean = cleanspk;
SS.time = spktimes;
SS.channel = channels;
SS.waveform = [];
SS.unit = [];
SS.avgwaveform = [];
if strfind(fid_prefix,'361')
    SS.badchannel = [1 8 33 47 57 64];
    et = [etime([2011 04 22 19 21 28],[2011 04 21 21 26 37]),...
        etime([2011 04 23 19 30 31],[2011 04 21 21 26 37]),...
        etime([2011 04 25 09 51 08],[2011 04 21 21 26 37])];
    et_text = {'added 20uM CNQX', ['replenished',10,'20uM CNQX'], ['replenished',10,'20uM CNQX']};
    starthour = 16; %beginning of recording cut off as desired
elseif strfind(fid_prefix,'364')
    SS.badchannel = [1 8 19 22 23 27 33 57 64];
    et = [etime([2011 04 22 19 23 41],[2011 04 21 23 24 06]),...
        etime([2011 04 23 19 25 41],[2011 04 21 23 24 06]),...
        etime([2011 04 25 09 57 08],[2011 04 21 23 24 06])];
    et_text = {'vehicle added', ['replenished',10,'vehicle'], ['replenished',10,'vehicle']};
    starthour = 13; %beginning of recording cut off as desired
end
SS.methodlog = [];
clear channels cleanspk spktimes

binsize = 30; %in seconds
binsize_label = [num2str(binsize) 'sec'];
hpr = 25; %hours per row


% ASDR
close all;
%figure('Position',[-1228 -277 1229 951]);
figure('units','normalized','outerposition',[0 0 1 1])

subplot(3,1,1);
SS.ASDR(binsize,1,0);
hold on;
plot([et(1) et(1)],[0 max(SS.asdr(:,2))*1.05],'--r'); text(et(1)+(hpr*.005)*3600,max(SS.asdr(:,2))*.95,et_text{1},'Color','r');
plot([et(2) et(2)],[0 max(SS.asdr(:,2))*1.05],'--r'); text(et(2)+(hpr*.005)*3600,max(SS.asdr(:,2))*.9,et_text{2},'Color','r');
plot([et(3) et(3)],[0 max(SS.asdr(:,2))*1.05],'--r'); text(et(3)+(hpr*.005)*3600,max(SS.asdr(:,2))*.9,et_text{3},'Color','r');
axis([starthour*3600 (hpr+starthour)*3600 0 max(SS.asdr(:,2))*1.05]);
if strfind(fid_prefix,'364')
    text(6.65*10000,max(SS.asdr(:,2)*.6),['(break in',10,'recording)'],'FontSize',6,'Color',[0.5 0.5 0.5]);
end
set(gca,'TickDir','out','XTick',[starthour*3600:3600:(hpr+starthour)*3600],'XTickLabel',[starthour:1:hpr+starthour]);
%set(gca,'Position',[0.085 0.7331-0.2996*0 0.7750 0.1919]);
%box off;
xlabel(''); ylabel('');
text((hpr*.82+starthour)*3600,max(SS.asdr(:,2))*.95,['bin size = ' binsize_label]);

subplot(3,1,2);
SS.ASDR(binsize,1,0);
hold on;
plot([et(1) et(1)],[0 max(SS.asdr(:,2))*1.05],'--r'); text(et(1)+(hpr*.005)*3600,max(SS.asdr(:,2))*.95,et_text{1},'Color','r');
plot([et(2) et(2)],[0 max(SS.asdr(:,2))*1.05],'--r'); text(et(2)+(hpr*.005)*3600,max(SS.asdr(:,2))*.9,et_text{2},'Color','r');
plot([et(3) et(3)],[0 max(SS.asdr(:,2))*1.05],'--r'); text(et(3)+(hpr*.005)*3600,max(SS.asdr(:,2))*.9,et_text{3},'Color','r');
axis([(hpr+starthour)*3600 ((2*hpr)+starthour)*3600 0 max(SS.asdr(:,2))*1.05]);
set(gca,'TickDir','out','XTick',[(hpr+starthour)*3600:3600:((2*hpr)+starthour)*3600],'XTickLabel',[hpr+starthour:1:((2*hpr)+starthour)]);
%set(gca,'Position',[0.085 0.7331-0.2996*1 0.7750 0.1919]);
%box off;
xlabel('');

subplot(3,1,3);
SS.ASDR(binsize,1,0);
hold on;
plot([et(1) et(1)],[0 max(SS.asdr(:,2))*1.05],'--r'); text(et(1)+(hpr*.005)*3600,max(SS.asdr(:,2))*.95,et_text{1},'Color','r');
plot([et(2) et(2)],[0 max(SS.asdr(:,2))*1.05],'--r'); text(et(2)+(hpr*.005)*3600,max(SS.asdr(:,2))*.9,et_text{2},'Color','r');
plot([et(3) et(3)],[0 max(SS.asdr(:,2))*1.05],'--r'); text(et(3)+(hpr*.005)*3600,max(SS.asdr(:,2))*.9,et_text{3},'Color','r');
axis([((2*hpr)+starthour)*3600 ((3*hpr)+starthour)*3600 0 max(SS.asdr(:,2))*1.05]);
set(gca,'TickDir','out','XTick',[((2*hpr)+starthour)*3600:3600:((3*hpr)+starthour)*3600],'XTickLabel',[((2*hpr)+starthour):1:((3*hpr)+starthour)]);
%box off;
%set(gca,'Position',[0.085 0.7331-0.2996*2 0.7750 0.1919]);
xlabel([10,'Time (hours)'],'FontSize',14); ylabel('');

print('-depsc',[fid_prefix '_ASDR_bin',binsize_label,'.eps']);
print('-dpng',[fid_prefix '_ASDR_bin',binsize_label,'.png']);
saveas(gcf,[fid_prefix '_ASDR_bin',binsize_label,'.fig'],'fig');
