Changeset 1141 for trunk/src/series/test_patch_tps.m
- Timestamp:
- May 3, 2024, 6:16:47 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/test_patch_tps.m
r1139 r1141 202 202 str=num2str(FieldSmooth(irho)); 203 203 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]; 206 206 Xstr{irho}=['X_' str]; 207 207 Ystr{irho}=['Y_' str]; 208 Dimstr{irho}= ['NbVec_' str];208 Dimstr{irho}='NbVec'; 209 209 str_i{irho}=str; 210 210 end … … 213 213 DataOut.ListGlobalAttribute={'CivStage'}; 214 214 DataOut.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]; 215 DataOut.ListVarName=[{'FieldSmooth','Diff_rms','NbExclude','FF','X','Y'} Ustr Vstr] ; 216 DataOut.VarDimName=[{'FieldSmooth','FieldSmooth','FieldSmooth','NbVec','NbVec','NbVec'} Dimstr Dimstr]; 217 DataOut.VarAttribute{4}.Role='falseflag'; 217 218 DataOut.FieldSmooth=FieldSmooth; 218 219 … … 226 227 Uin=Data.U(ind_good); 227 228 Vin=Data.V(ind_good); 229 tic 228 230 for irho=1:NbSmooth 229 231 [SubRange,NbCentres,Coord_tps,U_tps,V_tps,~,U_smooth, V_smooth,~,FFres]=... 230 232 filter_tps([Xin Yin],Uin,Vin,[],SubDomainSize,FieldSmooth(irho),MaxDiff); 231 233 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) 233 240 for irec=1:size(SubRange,3) 234 241 rectangle('Position',[SubRange(:,1,irec)' SubRange(:,2,irec)'-SubRange(:,1,irec)']) 235 end 242 end 236 243 title('subdomains for thin shell splines (tps)') 237 244 end 238 245 ind_good=find(FFres==0); 246 ind_false=find(FFres~=0); 239 247 U_Diff=Uin(ind_good)-U_smooth(ind_good); 240 248 V_Diff=Vin(ind_good)-V_smooth(ind_good); 241 249 DataOut.Diff_rms(irho)=sqrt(mean(U_Diff.*U_Diff+V_Diff.*V_Diff)/2); 242 250 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 end251 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 248 256 OutputFile=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,FileExtOut,NomTypeOut,i1_series{1}(index),[],j1_series{1}(index),j2_series{1}(index)) 249 257 errormsg=struct2nc(OutputFile,DataOut) 250 258 end 251 figure (1)259 figure 252 260 semilogx(FieldSmooth,DataOut.Diff_rms,'b',FieldSmooth,DataOut.NbExclude,'r',FieldSmooth,0.1*ones(size(FieldSmooth)),'m') 253 261 grid on 254 262 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') 256 264 xlabel('smoothing parameter') 257 265 ylabel('rms (pixels) and exclusion ratio') 266 OutputFig=fullfile(OutputPath,OutputDir,'plot_rms_diff.png') 267 saveas(2,OutputFig) 258 268 259 269
Note: See TracChangeset
for help on using the changeset viewer.