load('SuppLidoHCCumVals.mat')
%%
xt = [1:4];                                                         % X-Ticks

lb = [xt'-ones(4,1)*0.2,  xt'+ones(4,1)*0.2]; % Long Bar X

plot(xt(1), RatCtrlNormCumSumLastVal, 'ko','MarkerSize', 10)
hold on
plot(xt(2), RatHPCExpNormCumSumLastVal , 'ro','MarkerSize', 10)
plot(xt(3), MouseCtrl , 'ko','MarkerSize', 10)
plot(xt(4), MouseHPC , 'ro','MarkerSize', 10)


dmean = [mean(RatCtrlNormCumSumLastVal), mean(RatHPCExpNormCumSumLastVal), mean(MouseCtrl), mean(MouseHPC)];


for k1 = 1:4
    
    plot(lb(k1,:), [1 1]*dmean(k1), '-b')
end

xlim([0.5 4.5])
ylim([-1 1])
set(gca, 'XTick', xt, 'XTickLabel', {'Rat Ctrl','Rat HPC', 'Mouse Ctrl', 'MouseHPC'})

set(gca, 'YTick', -1:0.5:1)

%%
[p1 h] = ranksum(RatCtrlNormCumSumLastVal, RatHPCExpNormCumSumLastVal)

[p2 h] = ranksum(MouseCtrl, MouseHPC)

[p h] = ranksum(RatCtrlNormCumSumLastVal, MouseCtrl)

text(0.8, 0.8, ['p=', num2str(p1)])
text(2.8, 0.8, ['p=', num2str(p2)])

%%
%%
figure
errorbar(nanmean(MouseCtrl_cumvals,2),nanstd(MouseCtrl_cumvals,[],2)/sqrt(20),'k')
hold on

errorbar(nanmean(MouseHPC_cumvals(1:100,:),2),nanstd(MouseHPC_cumvals(1:100,:),[],2)/sqrt(3),'b')


errorbar(nanmean(RatCtrl_cumvals(1:100,:),2),nanstd(RatCtrl_cumvals(1:100,:),[],2)/sqrt(24),'b')

errorbar(RatHPCExpCumSumValsAvg(1:100), RatHPCExpCumSumValsSEM(1:100),'m')

xlim([0 100])
ylabel('Cummulative Sum')
xlabel('trial #')

ylim([-50 100])

legend({'Mouse Ctrl (n=20)',   'Mouse HPC (n=3)', 'Rat Ctrl (n=24)', 'RatHPC (n=7)'})
