r_figs_summary_pos.m 7.04 KB
function r_figs_summary_pos(nbF)
% R_FIGS_data_summary - Produces summary figures for displacement 
%
% Syntax:  R_FIGS_SUMMARY_POS
%
% Example:
%    r_figs_summary_pos
%
% Other m-files required: none
% Subfunctions: none
% MAT-files required: figs_summary_$fps_$f_$.mat (produced by R_DATA_POS)
%                     list.mat 
%
% See also: R_DATA_POS
%
% Author: Marie-Pier Marquis, Dany Dumont
% UQAR/ISMER
% email: dany_dumont@uqar.ca
% Website: http://www.ismer.ca/dumont-dany
% 14 October 2013, Last revision: October 2014
% ______________________________________________________________________
%%
bar = 1;        % 1 : with errorbar
                % 0 : without errorbar
                   
ms  = 12;       % Marker Size
lw  = 1.5;      % Line Width
fs  = 18;

                   
% fpsStr  = num2str(fps);
nbFStr    = num2str(nbF);
% aveStr  = num2str(ave);

rootdir   = r_root(nbF);
listfile2 = [rootdir, '/info.mat'];
load(listfile2)

fps       = info.fps;
ave       = info.average;

fpsStr    = num2str(fps);
aveStr    = num2str(ave);
sumRes    = info.sumResult;
figsSum   = info.figsSummary;
titleSum1 = info.dyNorm;
titleSum2 = info.meanDy;

listfile  = [rootdir,'/list1.mat'];
sumdir    = [rootdir,'/',fpsStr,'fps_',nbFStr,'f_',aveStr,sumRes];  
datafile  = [sumdir,figsSum,fpsStr,'fps_',nbFStr,'f_',aveStr,'.mat'];
cd(sumdir)

load(listfile)
load(datafile)


tp = [6.5 8.0 9.5 11.0 12.5 14.0 15.5 17.0 18.5 20.0];
%% Mean Displacement of the floes for each row

%dy        = nan.*ones(5,10);
%stdTemp   = nan.*ones(5,10); % Temporary variable
normDy    = nan.*ones(6,10);
normStdDy = nan.*ones(6,10);

for r = 1:16
    rowNumber = num2str(r);
    for h = 1:size(dyHs(:,:,:),1)
        if     h == 1
            hs = 2;
        elseif h == 2
            hs = 3;
        elseif h == 3
            hs = 4;
        elseif h == 4
            hs = 6;
        elseif h == 5
            hs = 8;
        elseif h == 6
            hs = 10;
        end
        %dy(h,:)      = dyHs(h,:,r);
        %stdTemp(h,:) = StdHs(h,:,r);
        normDy(h,:)    = (100.*(dyHs(h,:,r)))./(hs^2);
        normStdDy(h,:) = (100.*(StdHs(h,:,r)))./(hs^2);
    end
        
    figure(1); clf
    hold on
    
    if bar == 1
        
        errorbar(tp,-normDy(1,:),normStdDy(1,:),'sqk','MarkerSize',...
            ms,'MarkerFaceColor','black');
        errorbar(tp,-normDy(2,:),normStdDy(2,:),'vk','MarkerSize',...
            ms,'MarkerFaceColor','black');
        errorbar(tp,-normDy(3,:),normStdDy(3,:),'ok','MarkerSize',...
            ms,'MarkerFaceColor','black');
        errorbar(tp,-normDy(4,:),normStdDy(4,:),'xk','MarkerSize',...
            ms,'MarkerFaceColor','black');
        errorbar(tp,-normDy(5,:),normStdDy(5,:),'*k','MarkerSize',...
            ms,'MarkerFaceColor','black');
        errorbar(tp,-normDy(6,:),normStdDy(6,:),'+k','MarkerSize',...
            ms,'MarkerFaceColor','black');
    elseif bar == 0
        
        plot(tp,-normDy(1,:),'sqk','MarkerSize',ms,'LineWidth',lw);
        plot(tp,-normDy(2,:),'vk','MarkerSize',ms,'LineWidth',lw);
        plot(tp,-normDy(3,:),'ok','MarkerSize',ms,'LineWidth',lw);
        plot(tp,-normDy(4,:),'xk','MarkerSize',ms,'LineWidth',lw);
        plot(tp,-normDy(5,:),'*k','MarkerSize',ms,'LineWidth',lw);
        plot(tp,-normDy(6,:),'+k','MarkerSize',ms,'LineWidth',lw);
        
    end
    
    plot(tp,0.*tp,'--k');
    hold off
        
    set(gca,'FontName','Times New Roman','FontSize',fs);
    xlabel('\itT \rm(s)','FontName','Times New Roman','FontSize',fs);
    ylabel('\Delta\ity\rm/H^2      (m^{-1})','FontName',...
        'Times New Roman','FontSize',fs);
    legend('\itH \rm= 2m','\itH \rm= 3m','\itH \rm= 4m','\itH \rm= 6m',...
        '\itH \rm= 8m','\itH \rm= 10m','location','NorthEast');
    box on
    
    if bar == 1
        ylim([(min(min(min(-normDy))- max(max(normStdDy)),0)-0.01)...
            (max(max(max(-normDy))+max(max(normStdDy)),0)+0.01)]) % with errorbars
    elseif bar == 0
        ylim([(min(min(min(-normDy)),0)-0.01)...
            (max(max(max(-normDy)),0)+0.01)])
    end
    xlim([6 21])
    
    if bar == 0
        print([titleSum1,fpsStr,'fps_',nbFStr,'f_',aveStr,'_row_',...
            rowNumber,'.png'],'-dpng');
    elseif bar == 1
        print([titleSum1,fpsStr,'fps_',nbFStr,'f_',aveStr,'e_row_',...
            rowNumber,'.png'],'-dpng'); % with errorbars
    end
end


%% Mean Displacement of the floes for all rows
 
%mean_dy     = nan.*ones(5,10);
normMeanDy  = nan.*ones(6,10);
%mean_std    = nan.*ones(5,10);
normMeanStd = nan.*ones(6,10);

for t = 1:size(dyHs(:,:,:),2)
    for h = 1:size(dyHs(:,:,:),1)
        if     h == 1
            hs = 2;
        elseif h == 2
            hs = 3;
        elseif h == 3
            hs = 4;
        elseif h == 4
            hs = 6;
        elseif h == 5
            hs = 8;
        elseif h == 6
            hs = 10;
        end
 
        %mean_dy(h,t)     = nanmean(dyHs(h,t,:));
        normMeanDy(h,t)  = (100.*(nanmean(dyHs(h,t,:))))./(hs^2);
        %mean_std(h,t)    = nanmean(StdHs(h,t,:));
        normMeanStd(h,t) = (100.*(nanmean(StdHs(h,t,:))))./hs^2;
    end  
end

figure(1);clf
hold on    

if bar == 0
    
    plot(tp,-normMeanDy(1,:),'sqk','MarkerSize',ms,'LineWidth',lw);
    plot(tp,-normMeanDy(2,:),'vk','MarkerSize',ms,'LineWidth',lw);
    plot(tp,-normMeanDy(3,:),'ok','MarkerSize',ms,'LineWidth',lw);
    plot(tp,-normMeanDy(4,:),'xk','MarkerSize',ms,'LineWidth',lw);
    plot(tp,-normMeanDy(5,:),'*k','MarkerSize',ms,'LineWidth',lw);
    plot(tp,-normMeanDy(6,:),'+k','MarkerSize',ms,'LineWidth',lw);
    
elseif bar == 1
    
    errorbar(tp,-normMeanDy(1,:),normMeanStd(1,:),'sqk','MarkerSize',...
        ms,'MarkerFaceColor','black');
    errorbar(tp,-normMeanDy(2,:),normMeanStd(2,:),'vk','MarkerSize',...
        ms,'MarkerFaceColor','black');
    errorbar(tp,-normMeanDy(3,:),normMeanStd(3,:),'ok','MarkerSize',...
        ms,'MarkerFaceColor','black');
    errorbar(tp,-normMeanDy(4,:),normMeanStd(4,:),'xk','MarkerSize',...
        ms,'MarkerFaceColor','black');
    errorbar(tp,-normMeanDy(5,:),normMeanStd(5,:),'*k','MarkerSize',...
        ms,'MarkerFaceColor','black');
    errorbar(tp,-normMeanDy(6,:),normMeanStd(6,:),'+k','MarkerSize',...
        ms,'MarkerFaceColor','black');
    
end

plot(tp,0.*tp,'--k');
hold off
 
set(gca,'FontName','Times New Roman','FontSize',fs);
xlabel('\itT   \rm(s)','FontName','Times New Roman','FontSize',fs);
ylabel('\Delta\ity\rm / \itH^2\rm   \rm(m^{-1})','FontName',...
    'Times New Roman','FontSize',fs);
legend('\itH \rm= 2m',  '\itH \rm= 3m','\itH \rm= 4m','\itH \rm= 6m',...
    '\itH \rm= 8m','\itH \rm= 10m','location','NorthEast');
box on

if bar == 1
    ylim([(min(min(min(-normMeanDy))- max(max(normMeanStd)),0)-0.01)...
        (max(max(max(-normMeanDy))+max(max(normMeanStd)),0)+0.01)]) %with errorbars
elseif bar == 0
    ylim([(min(min(min(-normMeanDy)),0)-0.01)...
        (max(max(max(-normMeanDy)),0)+0.01)])
end
xlim([6 21])

if bar == 0
    print([titleSum2,fpsStr,'fps_',nbFStr,'f_',aveStr,'.png'],'-dpng');
elseif bar == 1
    print([titleSum2,fpsStr,'fps_',nbFStr,'f_',aveStr,'_e','.png'],...
        '-dpng');  % with errorbar
end

end