r_figs_pos.m 4.76 KB
function r_figs_pos(expNumber,camNumber,rowNumber,nbF)
% R_FIGS_POS - Produces data for r_figs and r_figs_summary.
%
% Syntax:  r_figs_data(expNumber,camNumber, rowNumber)
%
% Inputs:
%    expNumber - The experiment identifier
%    camNumber - The camera number
%    rowNumber - The row number
%    nbF       - The number of floes (40 or 80)
%
% Example:
%    r_figs(201307231525,1,4)
%
% Other m-files required: none
% Subfunctions: none
% MAT-files required: data_$expNumber_$camNumber.mat (produced by R_RECON)
%                     list1.mat 
%
% See also: R_RECON, R_ISOLATE, R_LIST
%
% Author: Marie-Pier Marquis, Dany Dumont
% UQAR/ISMER
% email: dany_dumont@uqar.ca
% Website: http://www.ismer.ca/dumont-dany
% July 2014
% ______________________________________________________________________
%%

nbFStr  = num2str(nbF);
cam     = num2str(camNumber);
exp     = num2str(expNumber);
row     = num2str(rowNumber);

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

fps      = info.fps;
int1     = info.int1;
int2     = info.int2;
int3     = info.int3;
int4     = info.int4;
ave      = info.average;
res      = info.result;
figsdata = info.figsData;
title2   = info.xyTitle;
title1   = info.dispTitle;
fpsStr   = num2str(fps);
aveStr   = num2str(ave);

expdir   = [rootdir,'/',exp,'_multicam'];
resdir   = [expdir,'/',fpsStr,'fps_',nbFStr,'f_',aveStr,res];
datafile = [resdir,figsdata,fpsStr,'fps_',nbFStr,'f_',aveStr,'_',exp,...
                     '_',cam,'_',row,'.mat'];
load(datafile)
cd(expdir)

if ~exist(resdir,'dir')
    mkdir(resdir)
end

cd(resdir)

ii     = find(list1.exp == expNumber);
tp     = list1.tp(ii);
tpms   = tp./10;            % Wave period at model scale
hs     = list1.hs(ii);
hsms   = hs./100;           % Wave height at model scale
tpstr  = num2str(tp);
hsstr  = num2str(hs);

%% Figure
% Subplot 1 - Mean displacement of floes in the wave propagation direction.
% We retrieve the mean start position of all floes by averaging
% over the first 10 seconds (from 40 to 50s)

figure(1); clf
%title(['exp ',exp,' cam ',cam,' row ',row,' (\itT_p \rm= ',...
%      tpstr,',\itH_s \rm=',hsstr,')'], ...
%      'FontSize',16,'FontName','Times');
subplot(1,2,1)
hold on
errorbar(delta, deltaStd,'ok','MarkerSize',8,'MarkerFaceColor','black');
plot([-2 6],[0 0],'-k');
plot([-2 6], meanDisp           .*[1 1],'--b');
plot([-2 6],(meanDisp + meanStd).*[1 1],'--r');
plot([-2 6],(meanDisp - meanStd).*[1 1],'--r');
hold off

text(1,-0.22,[exp,'-',cam,'-',row], ...
    'FontSize',13,'FontName','Times');
text(1,-0.27,['\itT_p \rm= ',tpstr,'s \itH_s \rm=',hsstr,'m'], ...
    'FontSize',13,'FontName','Times');
text(1,-0.31,['(\Delta\ity\rm)_{ave} = ',...
                 num2str(meanDisp),' m'],'FontSize',13,'FontName','Times');


set(gca,'FontSize',16,'FontName','Times', ...
    'XTick',1:nObjects,'YTick',[-0.3:0.1:0.3], ...
    'Box','on','PlotBoxAspectRatio',[0.5 1 1]);
xlabel('Floe number','FontSize',16,'FontName','Times');
ylabel('\Delta\ity \rm(m)','FontSize',16,'FontName','Times');
xlim([0.5 nObjects+0.5])
%ylim([(min(min(delta),0)-(max(deltaStd)+0.1)) ...
%    (max(max(delta),0) + (max(deltaStd)) + 0.1)])
ylim([-0.35 0.35])

subplot(1,2,2)
hold on
for k = 1:nObjects
    if nObjects == 5
        kk = k;
    elseif nObjects == 3
        kk = 2.*k - 1;
    elseif nObjects == 2
        kk = 2.*k;
    end
    plot(time',floeF(k,:)-kk+1,'-k','LineWidth',1,'MarkerSize',7);
    plot(40:50,(iPos(k)-kk+1).*ones(11,1),'-r','LineWidth',2);
    plot(floor(int1+int3*tpms):0.05:floor(int2+int4*tpms),...
        (fPos(k)-kk+1).*ones(size(floor(int1+int3*tpms):0.05:floor(int2+...
        int4*tpms))),'-r','LineWidth',1);
    plot(floor(int1+int3*tpms):0.05:floor(int2+int4*tpms),...
        (fPos(k)-kk+1).*ones(size(floor(int1+int3*tpms):0.05:floor(int2+...
        int4*tpms)))+ fStdPos(k).*ones(size(floor(int1+...
        int3*tpms):0.05:floor(int2+int4*tpms))),'--r');
    plot(floor(int1+int3*tpms):0.05:floor(int2+int4*tpms),...
        (fPos(k)-kk+1).*ones(size(floor(int1+int3*tpms):0.05:floor(int2+...
        int4*tpms)))- fStdPos(k).*ones(size(floor(int1+...
        int3*tpms):0.05:floor(int2+int4*tpms))),'--r');
end
hold off

set(gca,'FontSize',16,'FontName','Times', ...
    'XTick',[0 50 100 150 200 250],'YTick',[-4:1:0], ...
    'Box','on','PlotBoxAspectRatio',[0.5 1 1])
xlabel('\itt \rm(s)','FontSize',16,'FontName','Times');
ylabel('\it{y}_{k} \rm(m)','FontSize',16,'FontName','Times');
%xlim([time(1) time(end)])
xlim([40 250])
ylim([-4.5 0.5])

print([title2,fpsStr,'fps_',nbFStr,'f_',aveStr,'_',exp,'_',cam,'_',...
                                                     row,'.png'],'-dpng') ;
%print([title2,fpsStr,'fps_',nbFStr,'f_',aveStr,'_',exp,'_',cam,'_',...
%                                                     row,'.eps'],'-depsc2') ;


end