Changeset 526 for trunk/src/series
- Timestamp:
- Aug 20, 2012, 12:32:31 PM (12 years ago)
- Location:
- trunk/src/series
- Files:
-
- 2 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 -
trunk/src/series/time_series.m
r524 r526 63 63 end 64 64 65 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT)%%%%%%%%%%%%65 %%%%%%%%%%%% STANDARD PART %%%%%%%%%%%% 66 66 %% select different modes, RUN, parameter input, BATCH 67 67 % BATCH case: read the xml file for batch case … … 87 87 NomType=Param.InputTable(:,4); 88 88 FileExt=Param.InputTable(:,5); 89 90 % get the set of input file names (cell array filecell), and the lists of91 % input file or frame indices i1_series,i2_series,j1_series,j2_series92 89 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 93 % filecell{iview,fileindex}: cell array representing the list of file names 90 %%%%%%%%%%%% 91 % The cell array filecell is the list of input file names, while 92 % filecell{iview,fileindex}: 94 93 % iview: line in the table corresponding to a given file series 95 94 % fileindex: file index within the file series, 96 95 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 97 96 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 98 % set of frame indices used for movie or multimage input 99 % numbers of slices and file indices 100 97 %%%%%%%%%%%% 101 98 NbSlice=1;%default 102 99 if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice) … … 138 135 139 136 %% coordinate transform or other user defined transform 140 transform_fct= '';%default137 transform_fct=[];%default 141 138 if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName) 142 139 addpath(Param.FieldTransform.TransformPath) … … 148 145 % EDIT FROM HERE 149 146 150 %% check the validity of input file types147 %% check the validity of ctinput file types 151 148 if CheckImage{1} 152 149 FileExtOut='.png'; % write result as .png images for image inputs … … 162 159 end 163 160 NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series 164 % if NbSlice~=nbfield_j165 % answer=_uvmat('INPUT_Y-N',['will not average slice by slice: for so cancel and set NbSlice= ' num2str(nbfield_j)]);166 % if ~strcmp(answer,'Yes')167 % return168 % end169 % end170 161 if checkrun==1 171 162 return % stop here for input checks … … 189 180 end 190 181 end 191 %%% TO UPDATE192 if isequal(InputFields{1},'get_field...')193 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI194 if numel(hget_field)>1195 delete(hget_field(2:end)) % delete multiple occurerence of the GUI get_fioeld196 elseif isempty(hget_field)197 filename=filecell{1,1};198 % filename=name_generator(filebase{1},i1_series{1}(1),j1_series{1}(1),FileExt{1},NomType{1},1,i2_series{1}(1),num_j2{1}(1),SubDir{1});199 idetect(iview)=exist(filename,'file');200 hget_field=get_field(filename);201 return202 end203 SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI204 if isempty(SubField)205 delete(hget_field)206 filename=filecell{1,1};207 %filename=name_generator(filebase{1},i1_series{1}(1),j1_series{1}(1),FileExt{1},NomType{1},1,i2_series{1}(1),j2_series{1}(1),SubDir{1});208 hget_field=get_field(filename);209 SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI210 end211 end212 %%%%%%%213 182 214 183 %% Initiate output fields … … 255 224 stopstate='queue'; 256 225 end 257 258 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%%259 226 if isequal(stopstate,'queue')% enable STOP command 260 227 Data=cell(1,nbview);%initiate the set Data 261 228 nbtime=0; 262 229 dt=[]; 263 % loop on views (in case of multiple input series)230 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%% 264 231 for iview=1:nbview 265 232 % reading input file(s) 266 [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview}, Param.InputFields,frame_index{iview}(index));233 [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},InputFields{iview},frame_index{iview}(index)); 267 234 if ~isempty(errormsg) 268 235 errormsg=['time_series/read_field/' errormsg]; … … 280 247 end 281 248 249 Field=Data{1}; % default input field structure 282 250 % coordinate transform (or other user defined transform) 283 251 if ~isempty(transform_fct) 284 if nbview==2 285 [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2}); 286 if isempty(Data{2}) 287 Data(2)=[]; 288 end 289 else 290 Data{1}=transform_fct(Data{1},XmlData{1}); 291 end 292 end 293 294 % field substration (for two input file series) 295 if length(Data)==2 296 [Field,errormsg]=sub_field(Data{1},Data{2}); %substract the two fields 297 else 298 Field=Data{1}; 299 end 252 switch nargin(transform_fct) 253 case 4 254 if length(Data)==2 255 Field=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2}); 256 else 257 Field=transform_fct(Data{1},XmlData{1}); 258 end 259 case 3 260 if length(Data)==2 261 Field=transform_fct(Data{1},XmlData{1},Data{2}); 262 else 263 Field=transform_fct(Data{1},XmlData{1}); 264 end 265 case 2 266 Field=transform_fct(Data{1},XmlData{1}); 267 case 1 268 Field=transform_fct(Data{1}); 269 end 270 end 271 272 % calculate tps coefficients if needed 273 if isfield(Param.ProjObject,'ProjMode')&& strcmp(Param.ProjObject.ProjMode,'filter') 274 Field=calc_tps(Field,check_proj_tps); 275 end 276 277 %field projection on an object 300 278 if Param.CheckObject 301 279 [Field,errormsg]=proj_field(Field,Param.ProjObject); 280 if ~isempty(errormsg) 281 msgbox_uvmat('ERROR',['error in aver_stat/proj_field:' errormsg]) 282 return 283 end 302 284 end 303 285 nbfile=nbfile+1;
Note: See TracChangeset
for help on using the changeset viewer.