Ignore:
Timestamp:
May 3, 2024, 6:16:47 PM (5 months ago)
Author:
sommeria
Message:

smoothig parameter renormalised in filter_tps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/test_patch_tps.m

    r1139 r1141  
    202202    str=num2str(FieldSmooth(irho));
    203203    str=regexprep(str,'\.','p');
    204     Ustr{irho}=['U_diff_' str];
    205     Vstr{irho}=['V_diff_' str];
     204    Ustr{irho}=['U_' str];
     205    Vstr{irho}=['V_' str];
    206206    Xstr{irho}=['X_' str];
    207207    Ystr{irho}=['Y_' str];
    208     Dimstr{irho}=['NbVec_' str];
     208    Dimstr{irho}='NbVec';
    209209    str_i{irho}=str;
    210210end
     
    213213DataOut.ListGlobalAttribute={'CivStage'};
    214214DataOut.CivStage=Param.InputFields.VelType;
    215 DataOut.ListVarName=[{'FieldSmooth','Diff_rms','NbExclude'} Xstr Ystr Ustr Vstr] ;
    216 DataOut.VarDimName=[{'FieldSmooth','FieldSmooth','FieldSmooth'} Dimstr Dimstr Dimstr Dimstr];
     215DataOut.ListVarName=[{'FieldSmooth','Diff_rms','NbExclude','FF','X','Y'} Ustr Vstr] ;
     216DataOut.VarDimName=[{'FieldSmooth','FieldSmooth','FieldSmooth','NbVec','NbVec','NbVec'} Dimstr Dimstr];
     217DataOut.VarAttribute{4}.Role='falseflag';
    217218DataOut.FieldSmooth=FieldSmooth;
    218219
     
    226227        Uin=Data.U(ind_good);
    227228        Vin=Data.V(ind_good);
     229        tic
    228230    for irho=1:NbSmooth
    229231        [SubRange,NbCentres,Coord_tps,U_tps,V_tps,~,U_smooth, V_smooth,~,FFres]=...
    230232            filter_tps([Xin Yin],Uin,Vin,[],SubDomainSize,FieldSmooth(irho),MaxDiff);
    231233        if irho==1
    232         figure(irho)
     234            DataOut.FF=zeros(size(Xin));
     235            DataOut.X=Xin;
     236            DataOut.Y=Yin;
     237        figure(1)
     238            cla
     239            scatter(Xin,Yin,1)
    233240            for irec=1:size(SubRange,3)
    234241                rectangle('Position',[SubRange(:,1,irec)' SubRange(:,2,irec)'-SubRange(:,1,irec)'])
    235             end
     242            end       
    236243            title('subdomains for thin shell splines (tps)')
    237244        end
    238245        ind_good=find(FFres==0);
     246        ind_false=find(FFres~=0);
    239247        U_Diff=Uin(ind_good)-U_smooth(ind_good);
    240248        V_Diff=Vin(ind_good)-V_smooth(ind_good);
    241249        DataOut.Diff_rms(irho)=sqrt(mean(U_Diff.*U_Diff+V_Diff.*V_Diff)/2);
    242250        DataOut.NbExclude(irho)=(NbGood-numel(ind_good))/NbGood;
    243         DataOut.(['X_' str_i{irho}])=Xin(ind_good);
    244         DataOut.(['Y_' str_i{irho}])=Yin(ind_good);
    245         DataOut.(['U_diff_' str_i{irho}])=U_soomth(ind_good);
    246         DataOut.(['V_diff_' str_i{irho}])=V_Diff;
    247     end
     251        DataOut.(['U_' str_i{irho}])=U_smooth;
     252        DataOut.(['V_' str_i{irho}])=V_smooth;
     253        DataOut.FF(ind_false)=FieldSmooth(irho);
     254    end
     255    time=toc
    248256    OutputFile=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,FileExtOut,NomTypeOut,i1_series{1}(index),[],j1_series{1}(index),j2_series{1}(index))
    249257    errormsg=struct2nc(OutputFile,DataOut)
    250258end
    251 figure(1)
     259figure
    252260    semilogx(FieldSmooth,DataOut.Diff_rms,'b',FieldSmooth,DataOut.NbExclude,'r',FieldSmooth,0.1*ones(size(FieldSmooth)),'m')
    253261    grid on
    254262    title( [filecell{1,1} ':' Param.InputFields.VelType])
    255     legend({'rms vel. diff. ' ;' ratio excluded vectors';'recommended diff'})
     263    legend({'rms vel. diff. ' ;' ratio excluded vectors';'recommended diff'},'Location','northwest')
    256264    xlabel('smoothing parameter')
    257265    ylabel('rms (pixels) and exclusion ratio')
     266    OutputFig=fullfile(OutputPath,OutputDir,'plot_rms_diff.png')
     267    saveas(2,OutputFig)
    258268
    259269
Note: See TracChangeset for help on using the changeset viewer.