load('SuppPOmData.mat')

%%
POm_cumvals = nan(150,size(POmCumVals,1));
for i = 1:size(POmCumVals,1)
    cumvals = POmCumVals{i}';
    if size(cumvals,1) < 150
        POm_cumvals(1:size(cumvals,1),i) = cumvals;
    else
        POm_cumvals(:,i) = cumvals(1:150);
    end
end

%%
POm_cumvals = POm_cumvals(1:100,:);

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

hold on

errorbar(nanmean(POm_cumvals,2),nanstd(POm_cumvals,[],2)/sqrt(7),'b')

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


%%
% figure
% boundedline(1:150, nanmean(Control_cumvals,2), nanstd(Control_cumvals,[],2)/sqrt(11),'k')
% hold on
% boundedline(1:150, nanmean(BacL1_cumvals,2),nanstd(BacL1_cumvals,[],2)/sqrt(12),'r')
% hold on
% boundedline(1:150, nanmean(POm_cumvals,2),nanstd(POm_cumvals,[],2)/sqrt(5),'b')
% 
% ylabel('Cummulative Sum')
% xlabel('trial #')

%%
for i =1:size(Control_cumvals,2)
    plot(Control_cumvals(:,i),'k')
    hold on
end



for i =1:size(POm_cumvals,2)
    plot(POm_cumvals(:,i),'b')
    hold on
end
legend({'Control (n=20)',   'POm (n=7)'})

ylim([-50 100])
%%

figure
PlotAllDataPoints(Ctrl, POm)


set(gca, 'XTick',1:2, 'XTickLabel', {'Ctrl', 'POm'})

ylabel('Normalized learning score')
xlim([0.5 2.5])


[p h] = ranksum(Ctrl, POm)

text(1.8, 0.7, ['p = ', num2str(p)])


ylim([-1 1])
set(gca,'YTick', [-1:0.5:1])
