load('Fig3DiscriminationEffect')

 for ntp = 1:49
    [h,p(ntp),dc,stats] = ttest2(avg_RSA_ripple_tg_AMY_lowAro(ntp,:) , avg_RSA_ripple_tg_AMY_highAro(ntp,:)   ,'tail', 'left') ; % 
    t_val(ntp) = stats.tstat ;
end
h = p<=0.05;
[labeledA, numRegions] = bwlabel(h , 8);
for n_cluster = 1:numRegions , t_val(labeledA==n_cluster)=sum(t_val(labeledA==n_cluster));end


 figure, shadedErrorBar(linspace(-0.25,0.25,49) ,  mean( avg_RSA_ripple_tg_HPC_LFA , 2 ) , std( avg_RSA_ripple_tg_HPC_LFA ,[], 2 )/sqrt(6) , {'-b','LineWidth',2,'MarkerFaceColor','w'},0.01 )
hold on, shadedErrorBar(linspace(-0.25,0.25,49) ,  mean( avg_RSA_ripple_tg_HPC_LCR, 2 ) , std(avg_RSA_ripple_tg_HPC_LCR ,[], 2 )/sqrt(6) ,  {'-r','LineWidth',2,'MarkerFaceColor','w'},0.01 )
set(gca,'LineWidth',2), xlim([-0.25 0.25]), ylim([-.5 .5])
ylabel(''), xlabel('Time from aSWR( s)')


 figure, shadedErrorBar(linspace(-0.25,0.25,49) ,  mean( avg_RSA_ripple_tg_AMY_LFA , 2 ) , std( avg_RSA_ripple_tg_AMY_LFA ,[], 2 )/sqrt(6) , {'-b','LineWidth',2,'MarkerFaceColor','w'},0.01 )
hold on, shadedErrorBar(linspace(-0.25,0.25,49) ,  mean( avg_RSA_ripple_tg_AMY_LCR, 2 ) , std(avg_RSA_ripple_tg_AMY_LCR ,[], 2 )/sqrt(6) ,  {'-r','LineWidth',2,'MarkerFaceColor','w'},0.01 )
set(gca,'LineWidth',2), xlim([-0.25 0.25]), ylim([-.5 .5])
ylabel(''), xlabel('Time from aSWR( s)')
