Changeset 1197
- Timestamp:
- Mar 11, 2026, 5:31:25 PM (3 days ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
-
get_field.m (modified) (2 diffs)
-
read_field.m (modified) (1 diff)
-
series.m (modified) (4 diffs)
-
series/civ_series.m (modified) (1 diff)
-
series/merge_proj.m (modified) (1 diff)
-
series/turb_correlation_x.m (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/get_field.m
r1196 r1197 627 627 var_component=find(test_component);% list of variable indices elligible as unstructured coordinates 628 628 var_coord=find(test_coord);% % list of variable indices elligible as gridded coordinates 629 % index_coord=[];630 % index_component=[];631 % for iscalar=1:numel(scalar_index)632 % index_component=[index_component find(var_component==scalar_index(iscalar),1)];633 % index_coord=[index_coord find(var_coord==scalar_index(iscalar),1)];634 % end635 % var_component(index_component)=[];636 % var_coord(index_coord)=[];637 629 ListCoord=Field.Display.ListVarName([var_coord var_component]); 638 %coord_val=zeros(size(ListCoord)); 630 639 631 640 632 %% set default selection for grid coordinates … … 903 895 function Coord_x_Callback(hObject, DimCell, handles) 904 896 905 index=get(handles.Coord_x,'Value');906 897 string=get(handles.Coord_x,'String'); 907 VarName=string{ index};898 VarName=string{get(handles.Coord_x,'Value')}; 908 899 if ~ischar(DimCell)% no dimension as input 909 900 update_field(handles,VarName)% update the display of the variable 'VarName' and its dimensions in the general list of variables 910 901 end 911 if isequal(get(handles.FieldOption,'Value'),1) 902 MenuFieldOption=get(handles.FieldOption,'String'); 903 FieldOption=MenuFieldOption{get(handles.FieldOption,'Value')}; 904 if strcmp(FieldOption,'1D_plot') 912 905 set_coord_y_options(handles,VarName) 913 906 end -
trunk/src/read_field.m
r1196 r1197 16 16 % FileType: type of file, as determined by the function get_file_info.m 17 17 % ParamIn: movie object or Matlab structure of input parameters 18 % . FieldName: name (char string) of the input field (for Civx data)19 % . VelType: char string giving the type of velocity data ('civ1', 'filter1', 'civ2'...)20 % .ColorVar: variableused for vector color18 % .VelType: (for civdata) char string giving the type of velocity data ('civ1', 'filter1', 'civ2'...) 19 % .FieldName:(for general netcdf files) name (char string) or list of names (cell of char strings) of fields to read 20 % .ColorVar:(for general netcdf files) variable possibly used for vector color 21 21 % .Npx, .Npy: nbre of pixels along x and y (used for .vol input files) 22 22 % .TimeDimName: name of the dimension considered as 'time', selected index value then set by input 'frame_index' 23 % .TimeVarName: name of the variable considered as 'time' 23 24 % frame_index: frame number for movies or multidimensional netcdf files with dim >2 24 25 % -
trunk/src/series.m
r1196 r1197 3067 3067 TimeTable{LineIndex,5}=get_time(Param.IndexRange.MaxIndex_i(LineIndex),MaxIndex_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % Max time 3068 3068 case 'variable' 3069 set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName]) 3070 set(handles.NomType,'String','*') 3071 set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% A VERIFIER !!!!!! 3072 set(handles.FileIndex,'String','') 3069 TimeName=['var:' GetFieldData.Time.TimeName]; 3070 % set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName]) 3071 % set(handles.NomType,'String','*') 3072 % set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% A VERIFIER !!!!!! 3073 % set(handles.FileIndex,'String','') 3073 3074 ParamIn.TimeVarName=GetFieldData.Time.TimeName; 3074 3075 case 'matrix_index' … … 3361 3362 %------------------------------------------------------------------------ 3362 3363 function CheckMask_Callback(hObject, eventdata, handles) 3363 3364 % SeriesData=get(handles.series,'UserData'); 3364 3365 3365 3366 if get(handles.CheckMask,'Value') 3367 3366 3368 set(handles.DeleteMask,'Visible','on') 3367 3369 Param=read_GUI_series(handles); % displayed parameters … … 3379 3381 %checkmask=zeros(NbView,1); 3380 3382 for iview=1:NbView 3381 checkmask= 0;3383 checkmask=false; 3382 3384 FirstFileName=fullfile_uvmat(Param.InputTable{iview,1},Param.InputTable{iview,2},Param.InputTable{iview,3},... 3383 3385 Param.InputTable{iview,5},Param.InputTable{iview,4},i1,i2,j1,j2); 3384 3386 3385 %[FileInfo,VideoObject]=get_file_info(FirstFileName);3387 [FileInfo,VideoObject]=get_file_info(FirstFileName); 3386 3388 3387 3389 3388 % Data=nc2struct(FirstFileName); 3389 if isfield(Data,'Civ2_Mask') 3390 if exist(Data.Civ2_Mask,'file') 3391 MaskTable{iview,1}=Data.Civ2_Mask; 3392 checkmask=1; 3390 % Data=nc2struct(FirstFileName); 3391 if isfield(FileInfo,'MaskFile') && isfield(FileInfo,'MaskExt') 3392 if isfield(FileInfo,'MaskNbSlice')&& exist([FileInfo.MaskFile '_1' FileInfo.MaskExt],'file') 3393 MaskTable{iview,1}=[FileInfo.MaskFile '_1' FileInfo.MaskExt]; 3394 MaskTable{iview,2}=num2str(FileInfo.MaskNbSlice); 3395 checkmask=true; 3396 elseif exist([FileInfo.MaskFile FileInfo.MaskExt],'file') 3397 MaskTable{iview,1}=[FileInfo.MaskFile FileInfo.MaskExt]; 3398 MaskTable{iview,2}=''; 3399 checkmask=true; 3393 3400 end 3394 3401 end … … 3410 3417 end 3411 3418 set(handles.MaskTable,'Data',MaskTable) 3412 set(handles.CheckMask,'Value',0) 3413 end 3419 end 3420 3414 3421 % 3415 3422 % if ~isempty(NewMask) -
trunk/src/series/civ_series.m
r1196 r1197 276 276 time_patch2=0; 277 277 if ~isempty(RUNHandle)% update the waitbar in interactive mode with GUI series (checkrun=1) 278 update_waitbar(WaitbarHandle,ifield/NbField)279 278 if checkrun && ~strcmp(get(RUNHandle,'BusyAction'),'queue') 280 279 disp('program stopped by user') -
trunk/src/series/merge_proj.m
r1196 r1197 354 354 end 355 355 [MaskData,~,errormsg] = read_field(maskname,'image'); 356 if ~isempty(errormsg) 357 disp(['error reading ' maskname ' :' errormsg]) 358 return 359 end 356 360 if ~isempty(NbSlice_calib) 357 361 MaskData.ZIndex=mod(i1_series{iview}(index)-1,NbSlice_calib{iview})+1;%Zindex for phys transform -
trunk/src/series/turb_correlation_x.m
r1127 r1197 94 94 95 95 %% root input file(s) name, type and index series 96 RootPath=Param.InputTable (:,1);97 RootFile=Param.InputTable (:,3);98 SubDir=Param.InputTable(:,2);99 NomType=Param.InputTable (:,4);100 FileExt=Param.InputTable(:,5);96 RootPath=Param.InputTable{:,1}; 97 RootFile=Param.InputTable{:,3}; 98 %SubDir=Param.InputTable(:,2); 99 NomType=Param.InputTable{1,4}; 100 %FileExt=Param.InputTable(:,5); 101 101 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 102 102 %%%%%%%%%%%% … … 108 108 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 109 109 %%%%%%%%%%%% NbView=1 : a single input series 110 NbView=numel(i1_series);%number of input file series (lines in InputTable)110 %NbView=numel(i1_series);%number of input file series (lines in InputTable) 111 111 NbField_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices) 112 112 NbField_i=size(i1_series{1},2); %nb of fields for the i index 113 113 NbField=NbField_j*NbField_i; %total number of fields 114 114 115 %% determine the file type on each line from the first input file 116 ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'}; 117 NcTypeOptions={'netcdf','civx','civdata'}; 118 for iview=1:NbView 119 if ~exist(filecell{iview,1}','file') 120 msgbox_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist']) 121 return 122 end 123 [FileInfo{iview},MovieObject{iview}]=get_file_info(filecell{iview,1}); 124 FileType{iview}=FileInfo{iview}.FileType; 125 CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images 126 CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files 127 if ~isempty(j1_series{iview}) 128 frame_index{iview}=j1_series{iview}; 129 else 130 frame_index{iview}=i1_series{iview}; 131 end 132 end 133 134 %% calibration data and timing: read the ImaDoc files 135 XmlData=[]; 136 [XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series); 137 if size(time,1)>1 138 diff_time=max(max(diff(time))); 139 if diff_time>0 140 msgbox_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)]) 141 end 142 end 143 144 %% coordinate transform or other user defined transform 145 transform_fct='';%default 146 if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName) 147 addpath(Param.FieldTransform.TransformPath) 148 transform_fct=str2func(Param.FieldTransform.TransformName); 149 rmpath(Param.FieldTransform.TransformPath) 150 end 151 152 %%%%%%%%%%%% END STANDARD PART %%%%%%%%%%%% 153 % EDIT FROM HERE 154 155 %% check the validity of input file types 156 if CheckImage{1} 157 FileExtOut='.png'; % write result as .png images for image inputs 158 elseif CheckNc{1} 159 FileExtOut='.nc';% write result as .nc files for netcdf inputs 115 %% determine the file type on each line from the first input file 116 117 [FileInfo,MovieObject]=get_file_info(filecell{1,1}); 118 FileType=FileInfo.FileType; 119 120 if ~isempty(j1_series{1}) 121 frame_index=j1_series{1}; 160 122 else 161 msgbox_uvmat('ERROR',['invalid file type input ' FileType{1}]) 162 return 163 end 164 123 frame_index=i1_series{1}; 124 end 165 125 166 126 %% settings for the output file 167 NomTypeOut=nomtype2pair(NomType{1});% determine the index nomenclature type for the output file 127 FileExtOut='.nc';% write result as .nc files for netcdf inputs 128 NomTypeOut=nomtype2pair(NomType);% determine the index nomenclature type for the output file 168 129 first_i=i1_series{1}(1); 169 130 last_i=i1_series{1}(end); … … 177 138 %% Set field names and velocity types 178 139 InputFields{1}=[];%default (case of images) 179 if isfield(Param,'InputFields') 180 InputFields{1}=Param.InputFields; 181 end 182 140 %%%%%%%%%%%%%%%%%%%%% 141 if isfield(Param.IndexRange,'TimeSource') && find(regexp(Param.IndexRange.TimeSource,'^var:'))==1 142 Param.InputFields.TimeVarName=regexprep(Param.IndexRange.TimeSource,'^var:',''); 143 end 144 %%%%%%%%%%%%%%%%%%%% 145 % if isfield(Param,'InputFields') 146 % InputFields{1}=Param.InputFields; 147 % end 148 Param.InputFields.FieldName={'Uprime','Vprime'}; 183 149 nbfiles=0; 184 150 nbmissing=0; … … 197 163 disp('loop for mean started') 198 164 for index=1:NbField 199 update_waitbar(WaitbarHandle,index/NbField) 200 if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue') 201 disp('program stopped by user') 202 break 203 end 204 [Field,tild,errormsg] = read_field(filecell{1,index},FileType{iview},InputFields{iview},frame_index{iview}(index)); 165 % if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue') 166 % disp('program stopped by user') 167 % break 168 % end 169 [Field,~,errormsg] = read_field(filecell{1,index},FileType,Param.InputFields,frame_index(index)); 170 171 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 172 Field.U=Field.Uprime; 173 Field.V=Field.Vprime; 174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 205 175 if index==1 %first field 206 176 if ~isfield(Field,'U')||~isfield(Field,'V') … … 208 178 return 209 179 end 180 210 181 [npy,npx]=size(Field.U); 211 182 UMean=zeros(npy,npx); 212 183 VMean=zeros(npy,npx); 213 184 Counter=zeros(npy,npx); 214 % transcripts the global attributes185 % transcripts the global attributes 215 186 if isfield(Field,'ListGlobalAttribute') 216 187 DataOut.ListGlobalAttribute= Field.ListGlobalAttribute; … … 236 207 disp('loop for correlation started') 237 208 for index=1:NbField 238 update_waitbar(WaitbarHandle,index/NbField)239 209 if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue') 240 210 disp('program stopped by user') 241 211 break 242 212 end 243 [Field,tild,errormsg] = read_field(filecell{1,index},FileType{iview},InputFields{iview},frame_index{iview}(index)); 244 213 [Field,~,errormsg] = read_field(filecell{1,index},FileType,Param.InputFields,frame_index(index)); 214 Field.U=Field.Uprime; 215 Field.V=Field.Vprime; 245 216 %%%%%%%%%%%% MAIN RUNNING OPERATIONS %%%%%%%%%%%% 246 217 if index==1 %first field … … 281 252 VVCorr(ishift+npcorr+1,:,:)=Field.V.*V_shift; 282 253 UVCorr(ishift+npcorr+1,:,:)=Field.U.*V_shift; 283 FFCorr(ishift+npcorr+1,:,:)=FF | FF_shift; 254 FFCorr(ishift+npcorr+1,:,:)=FF | FF_shift; 284 255 end 285 256 DataOut.UUCorr=DataOut.UUCorr+UUCorr; … … 322 293 323 294 %% writing the result file as netcdf file 324 OutputFile=fullfile_uvmat(RootPath {1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,first_i,last_i,first_j,last_j);295 OutputFile=fullfile_uvmat(RootPath,OutputDir,RootFile,FileExtOut,NomTypeOut,first_i,last_i,first_j,last_j); 325 296 %case of netcdf input file , determine global attributes 326 297 errormsg=struct2nc(OutputFile,DataOut); %save result file … … 331 302 end 332 303 333 334 %% open the result file with uvmat (in RUN mode)335 if checkrun336 uvmat(OutputFile)% open the last result file with uvmat337 end
Note: See TracChangeset
for help on using the changeset viewer.
