load('/home/sam/Dropbox/buzsaki/data/SeqGen/camkii2_20160418_NWB.mat')
if ~exist('xml') ||isempty(xml)
[xml,path] = uigetfile('*.xml');
xml = [path xml];
end
SetCurrentSession(xml)

units = GetUnits;
spikes = GetSpikeTimes(units,'output','full');
[~,~,cellID] = unique(spikes(:,2:3),'rows');
spikesIDs = [spikes(:,2:3) cellID];
[spiketimes,b] = sort(spikes(:,1));
spikesIDs = spikesIDs(b,:);



ok = NWB.spikes.ID(NWB.CCG.mono_spont.sig_con);
kp = ok(:,1) ==1 & ok(:,2)>1;



sigcon  =NWB.CCG.mono_spont.sig_con(kp,:);


kp1 = spikesIDs(:,3) ==11 ;
kp2 = spikesIDs(:,3) ==15 ;

spks = spiketimes([find(kp1);find(kp2);find(kp2 & spiketimes>5000)]);
grp = [ones(sum(kp1),1);2*ones(sum(kp2),1);2*ones(sum(kp2& spiketimes>5000),1)];

[spks,b]  =sort(spks);
grp  =grp(b);
ses = GetTransAcrossTime(spks,grp,'win_inc',.5,'win',300,'duration',...
500,'binsize',.001);


ses = bootStrapCCG( spks, grp, .1, 33, .015, .0004 );

