Changeset 526 for trunk/src/series/aver_stat.m
- Timestamp:
- Aug 20, 2012, 12:32:31 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/aver_stat.m
r494 r526 182 182 183 183 %% MAIN LOOP ON SLICES 184 %%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%185 184 for i_slice=1:NbSlice 186 185 index_slice=i_slice:NbSlice:nbfield;% select file indices of the slice … … 196 195 stopstate='queue'; 197 196 end 198 197 if isequal(stopstate,'queue')% enable STOP command 198 199 199 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%% 200 200 for iview=1:nbview … … 209 209 end 210 210 end 211 Field=[]; % initiate the current input field structure 211 else 212 errormsg='stop'; 213 end 212 214 %%%%%%%%%%%%%%%% end loop on views (input lines) %%%%%%%%%%%%%%%% 213 215 %%%%%%%%%%%% END STANDARD PART %%%%%%%%%%%% 214 216 % EDIT FROM HERE 215 217 216 218 if isempty(errormsg) 217 % coordinate transform (or other user defined transform) 219 Field=Data{1}; % default input field structure 220 %% coordinate transform (or other user defined transform) 218 221 if ~isempty(transform_fct) 219 if nbview==2 220 [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2}); 221 if isempty(Data{2}) 222 Data(2)=[]; 223 end 224 else 225 Data{1}=transform_fct(Data{1},XmlData{1}); 222 switch nargin(transform_fct) 223 case 4 224 if length(Data)==2 225 Field=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2}); 226 else 227 Field=transform_fct(Data{1},XmlData{1}); 228 end 229 case 3 230 if length(Data)==2 231 Field=transform_fct(Data{1},XmlData{1},Data{2}); 232 else 233 Field=transform_fct(Data{1},XmlData{1}); 234 end 235 case 2 236 Field=transform_fct(Data{1},XmlData{1}); 237 case 1 238 Field=transform_fct(Data{1}); 226 239 end 227 240 end 228 241 229 %% check whether tps is needed, then calculate tps coefficients if needed 230 check_tps=0; 231 if ischar(Param.InputFields.FieldName) 232 Param.InputFields.FieldName={Param.InputFields.FieldName}; 233 end 234 for ilist=1:numel(Param.InputFields.FieldName) 235 switch Param.InputFields.FieldName{ilist} 236 case {'vort','div','strain'} 237 check_tps=1; 238 end 239 end 240 if strcmp(Param.ProjObject.ProjMode,'filter') 241 check_tps=1; 242 end 243 if check_tps 244 SubDomain=1500; %default, estimated nbre of vectors in a subdomain used for tps 245 if isfield(Data{iview},'SubDomain') 246 SubDomain=Data{iview}.SubDomain;% 247 end 248 [Data{iview}.SubRange,Data{iview}.NbSites,Data{iview}.Coord_tps,Data{iview}.U_tps,Data{iview}.V_tps,tild,U_smooth,V_smooth,W_smooth,FF] =... 249 filter_tps([Data{iview}.X(Data{iview}.FF==0) Data{iview}.Y(Data{iview}.FF==0)],Data{iview}.U(Data{iview}.FF==0),Data{iview}.V(Data{iview}.FF==0),[],SubDomain,0); 250 nbvar=numel(Data{iview}.ListVarName); 251 Data{iview}.ListVarName=[Data{iview}.ListVarName {'SubRange','NbSites','Coord_tps','U_tps','V_tps'}]; 252 Data{iview}.VarDimName=[Data{iview}.VarDimName {{'nb_coord','nb_bounds','nb_subdomain'},{'nb_subdomain'},... 253 {'nb_tps','nb_coord','nb_subdomain'},{'nb_tps','nb_subdomain'},{'nb_tps','nb_subdomain'}}]; 254 Data{iview}.VarAttribute{nbvar+3}.Role='coord_tps'; 255 Data{iview}.VarAttribute{nbvar+4}.Role='vector_x'; 256 Data{iview}.VarAttribute{nbvar+5}.Role='vector_y'; 257 if isfield(Data{iview},'ListDimName')%cleaning 258 Data{iview}=rmfield(Data{iview},'ListDimName'); 259 end 260 if isfield(Data{iview},'DimValue')%cleaning 261 Data{iview}=rmfield(Data{iview},'DimValue'); 262 end 263 end 264 265 % field calculation (vort, div...) 266 if strcmp(FileType{1},'civx')||strcmp(FileType{1},'civdata') 267 if isfield(Data{1},'Coord_tps') 268 Data{1}.FieldList=Param.InputFields.FieldName; 269 else 270 Data{1}=calc_field(Param.InputFields.FieldName,Data{1});%calculate field (vort..) 271 end 272 end 273 274 % field substration (for two input file series) 275 if length(Data)==2 276 if strcmp(FileType{2},'civx')||strcmp(FileType{2},'civdata') 277 if isfield(Data{2},'Coord_tps') 278 Data{2}.FieldList=Param.InputFields.FieldName; 279 else 280 Data{2}=calc_field(Param.InputFields.FieldName,Data{2});%calculate field (vort..) 281 end 282 end 283 [Field,errormsg]=sub_field(Data{1},Data{2}); %substract the two fields 284 if ~isempty(errormsg) 285 msgbox_uvmat('ERROR',['error in aver_stat/sub_field:' errormsg]) 286 return 287 end 288 else 289 Field=Data{1}; 290 end 291 242 %% calculate tps coefficients if needed 243 if isfield(Param.ProjObject,'ProjMode')&& strcmp(Param.ProjObject.ProjMode,'filter') 244 Field=calc_tps(Field,check_proj_tps); 245 end 246 292 247 %field projection on an object 293 248 if Param.CheckObject … … 356 311 end 357 312 358 %writ ing the result file313 %writting the result file 359 314 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(1),i1_series{1}(end),i_slice,[]); 360 315 if CheckImage{1} %case of images … … 381 336 %% open the result file with uvmat (in RUN mode) 382 337 if checkrun 383 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI384 delete(hget_field)338 % hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI 339 % delete(hget_field) 385 340 uvmat(OutputFile)% open the last result file with uvmat 386 341 end
Note: See TracChangeset
for help on using the changeset viewer.