
% Make figures for PAICO reconstructions

%fln='arcatleurafr_23-Jan-2018_23:52:06.mat';
%fln='arcatleurafr_23-Jan-2018_23:52:06.mat';
%fln='arcatleurafr_24-Jan-2018_15:37:43.mat';
%fln='arcatleurafr_r.-6000_-6000_25-Jan-2018_13:39:14.mat';
%fln='arcatleurafr_r.21000_2000_25-Jan-2018_13:45:46.mat';
%load(['./results/' fln])


% Plot proxies

%figure
%hold on
%for i=1:length(data.proxy)
%   plot(data.proxy{i}.times,data.proxy{i}.data)
%end
%xlim([-21000 2000])
%title('Proxies')


%figure
%hold on
%plot(result.times,result.signal)
%plot(result.times,smooth(result.signal))
%xlim([-21000 2000])
%legend('Recon','20 year mean')
%title('Reconstruction')


figure
plot(result.times,result.uncalibSignal)
%xlim([-21000 2000])
title('Reconstruction, uncalibrated')

figure
plot(result.times,result.resample.uncalibSignals);   

% figure
% %plot(result.times,result.uncalibSignal,'-o')
% plot(result.times,result.uncalibSignal,'linewidth',2)
% hold on
% for i=1:length(data.proxy)
%    %plot(data.proxy{i}.times,data.proxy{i}.data,'-s')
%    plot(data.proxy{i}.times,data.proxy{i}.data)
% end
% xlim([-21000 2000])
% legend('Recon')
% title('Recon & proxies')

if options.resample.number > 0

   % Compute percentiles
   p055095=prctile(result.resample.uncalibSignals,[5 50 95],1);   

   figure
   hold on
   plot(result.times,p055095(1,:),'--k')
   plot(result.times,p055095(3,:),'--k')
   plot(result.times,result.uncalibSignal,'k','linewidth',2)
   xlim([-21000 2000])
   title('Rec. ens. percentiles')
   
end




%for i=1:length(data.proxy);disp(['med res ' num2str(median(abs(diff(data.proxy{i}.times))))]);end
%for i=1:length(data.proxy);disp(['max res ' num2str(max(abs(diff(data.proxy{i}.times))))]);end



