Changeset 582
- Timestamp:
- Mar 13, 2013, 12:46:21 AM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r581 r582 493 493 end 494 494 end 495 if isfield(XmlData,' TimeUnit')496 TimeUnit=XmlData. TimeUnit;495 if isfield(XmlData,'Camera') && isfield(XmlData.Camera,'TimeUnit') 496 TimeUnit=XmlData.Camera.TimeUnit; 497 497 end 498 498 if isfield(XmlData,'GeometryCalib') … … 2704 2704 last_i=str2double(get(handles.last_i,'String')); 2705 2705 incr_i=str2double(get(handles.incr_i,'String')); 2706 num 1=first_i:incr_i:last_i;2706 num_i=first_i:incr_i:last_i; 2707 2707 lastfield=str2double(get(handles.nb_field,'String')); 2708 2708 if ~isnan(lastfield) 2709 test_find=(num 1-floor(index_pair/2)*ones(size(num1))>0)& ...2710 (num 1+ceil(index_pair/2)*ones(size(num1))<=lastfield);2711 num 1=num1(test_find);2712 end 2713 set(handles.first_i,'String',num2str(num 1(1)));2714 set(handles.last_i,'String',num2str(num 1(end)));2709 test_find=(num_i-floor(index_pair/2)*ones(size(num_i))>0)& ... 2710 (num_i+ceil(index_pair/2)*ones(size(num_i))<=lastfield); 2711 num_i=num_i(test_find); 2712 end 2713 set(handles.first_i,'String',num2str(num_i(1))); 2714 set(handles.last_i,'String',num2str(num_i(end))); 2715 2715 elseif isequal(mode,'series(Dj)') 2716 2716 first_j=str2double(get(handles.first_j,'String')); … … 2722 2722 test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... 2723 2723 (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2); 2724 num 1=num_j(test_find);2725 end 2726 set(handles.first_j,'String',num2str(num 1(1)));2727 set(handles.last_j,'String',num2str(num 1(end)));2724 num_j=num_j(test_find); 2725 end 2726 set(handles.first_j,'String',num2str(num_j(1))); 2727 set(handles.last_j,'String',num2str(num_j(end))); 2728 2728 end 2729 2729 … … 2742 2742 last_i=str2double(get(handles.last_i,'String')); 2743 2743 incr_i=str2double(get(handles.incr_i,'String')); 2744 num 1=first_i:incr_i:last_i;2744 num_i=first_i:incr_i:last_i; 2745 2745 lastfield=str2double(get(handles.nb_field,'String')); 2746 2746 if ~isnan(lastfield) 2747 test_find=(num 1-floor(index_pair/2)*ones(size(num1))>0)& ...2748 (num 1+ceil(index_pair/2)*ones(size(num1))<=lastfield);2749 num 1=num1(test_find);2750 end 2751 set(handles.first_i,'String',num2str(num 1(1)));2752 set(handles.last_i,'String',num2str(num 1(end)));2747 test_find=(num_i-floor(index_pair/2)*ones(size(num_i))>0)& ... 2748 (num_i+ceil(index_pair/2)*ones(size(num_i))<=lastfield); 2749 num_i=num_i(test_find); 2750 end 2751 set(handles.first_i,'String',num2str(num_i(1))); 2752 set(handles.last_i,'String',num2str(num_i(end))); 2753 2753 elseif isequal(mode,'series(Dj)') 2754 2754 first_j=str2double(get(handles.first_j,'String')); … … 2760 2760 test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... 2761 2761 (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2); 2762 num 1=num_j(test_find);2763 end 2764 set(handles.first_j,'String',num2str(num 1(1)));2765 set(handles.last_j,'String',num2str(num 1(end)));2762 num_j=num_j(test_find); 2763 end 2764 set(handles.first_j,'String',num2str(num_j(1))); 2765 set(handles.last_j,'String',num2str(num_j(end))); 2766 2766 end 2767 2767 -
trunk/src/civ_matlab.m
r581 r582 169 169 Data.Patch1_SubDomainSize=Param.Patch1.SubDomainSize; 170 170 nbvar=length(Data.ListVarName); 171 Data.ListVarName=[Data.ListVarName {'Civ1_U_smooth','Civ1_V_smooth','Civ1_SubRange','Civ1_Nb Sites','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}];172 Data.VarDimName=[Data.VarDimName {'nb_vec_1','nb_vec_1',{'nb_coord','nb_bounds','nb_subdomain_1'}, {'nb_subdomain_1'},...171 Data.ListVarName=[Data.ListVarName {'Civ1_U_smooth','Civ1_V_smooth','Civ1_SubRange','Civ1_NbCentres','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}]; 172 Data.VarDimName=[Data.VarDimName {'nb_vec_1','nb_vec_1',{'nb_coord','nb_bounds','nb_subdomain_1'},'nb_subdomain_1',... 173 173 {'nb_tps_1','nb_coord','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'}}]; 174 174 Data.VarAttribute{nbvar+1}.Role='vector_x'; … … 184 184 ind_good=1:numel(Data.Civ1_X); 185 185 end 186 [Data.Civ1_SubRange,Data.Civ1_Nb Sites,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,tild,Ures, Vres,tild,FFres]=...186 [Data.Civ1_SubRange,Data.Civ1_NbCentres,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,tild,Ures, Vres,tild,FFres]=... 187 187 filter_tps([Data.Civ1_X(ind_good) Data.Civ1_Y(ind_good)],Data.Civ1_U(ind_good),Data.Civ1_V(ind_good),[],Data.Patch1_SubDomainSize,Data.Patch1_FieldSmooth,Data.Patch1_MaxDiff); 188 188 Data.Civ1_U_smooth(ind_good)=Ures; … … 268 268 % get the guess from patch1 269 269 for isub=1:NbSubDomain 270 nbvec_sub=Data.Civ1_Nb Sites(isub);270 nbvec_sub=Data.Civ1_NbCentres(isub); 271 271 ind_sel=find(GridX>=Data.Civ1_SubRange(1,1,isub) & GridX<=Data.Civ1_SubRange(1,2,isub) & GridY>=Data.Civ1_SubRange(2,1,isub) & GridY<=Data.Civ1_SubRange(2,2,isub)); 272 272 epoints = [GridX(ind_sel) GridY(ind_sel)];% coordinates of interpolation sites … … 375 375 Data.Patch2_FieldSmooth=Param.Patch2.FieldSmooth; 376 376 Data.Patch2_MaxDiff=Param.Patch2.MaxDiff; 377 Data.Patch2_SubDomainSize=Param.Patch2.Sub domainSize;377 Data.Patch2_SubDomainSize=Param.Patch2.SubDomainSize; 378 378 nbvar=length(Data.ListVarName); 379 Data.ListVarName=[Data.ListVarName {'Civ2_U_smooth','Civ2_V_smooth','Civ2_SubRange','Civ2_Nb Sites','Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps'}];379 Data.ListVarName=[Data.ListVarName {'Civ2_U_smooth','Civ2_V_smooth','Civ2_SubRange','Civ2_NbCentres','Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps'}]; 380 380 Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2',{'nb_coord','nb_bounds','nb_subdomain_2'},{'nb_subdomain_2'},... 381 381 {'nb_tps_2','nb_coord','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'}}]; … … 393 393 ind_good=1:numel(Data.Civ2_X); 394 394 end 395 [Data.Civ2_SubRange,Data.Civ2_Nb Sites,Data.Civ2_Coord_tps,Data.Civ2_U_tps,Data.Civ2_V_tps,tild,Ures, Vres,tild,FFres]=...395 [Data.Civ2_SubRange,Data.Civ2_NbCentres,Data.Civ2_Coord_tps,Data.Civ2_U_tps,Data.Civ2_V_tps,tild,Ures, Vres,tild,FFres]=... 396 396 filter_tps([Data.Civ2_X(ind_good) Data.Civ2_Y(ind_good)],Data.Civ2_U(ind_good),Data.Civ2_V(ind_good),[],Data.Patch2_SubDomainSize,Data.Patch2_FieldSmooth,Data.Patch2_MaxDiff); 397 397 Data.Civ2_U_smooth(ind_good)=Ures; -
trunk/src/filter_tps.m
r581 r582 46 46 %% default output 47 47 SubRange=zeros(NbCoord,2,NbSubDomain);%initialise the positions of subdomains 48 NbCentres=zeros( NbSubDomain);%number of interpolated values per subdomain, =0 by default49 Coord_tps=zeros(NbVec,NbCoord,NbSubDomain);% default positions of the tps source= initial positions of the good vectors sorted by subdomain50 U_tps=zeros(NbVec,NbSubDomain);%default spline51 V_tps=zeros(NbVec,NbSubDomain);%default spline48 NbCentres=zeros(1,NbSubDomain);%number of interpolated values per subdomain, =0 by default 49 %Coord_tps=zeros(NbVec,NbCoord,NbSubDomain);% default positions of the tps source= initial positions of the good vectors sorted by subdomain 50 %U_tps=zeros(NbVec,NbSubDomain);%default spline 51 %V_tps=zeros(NbVec,NbSubDomain);%default spline 52 52 W_tps=[];%default (2 component case) 53 53 U_smooth=zeros(NbVec,1); % smoothed velocity U at the initial positions -
trunk/src/find_field_cells.m
r581 r582 165 165 for icell_tps=1:numel(ivar_tps) 166 166 check_cell=zeros(1,nbvar);% =1 for the variables selected in the current cell 167 check_cell(ivar_tps(icell_tps))=1;% mark the coordi ante variable as selected167 check_cell(ivar_tps(icell_tps))=1;% mark the coordinate variable as selected 168 168 DimCell=Data.VarDimName{ivar_tps(icell_tps)};% dimension names for the current tps coordinate variable 169 169 icell=numel(CellInfo)+icell_tps; % new field cell index -
trunk/src/get_field.m
r581 r582 63 63 msgbox_uvmat('ERROR',['get_field/nc2struct/' Field.Txt]) 64 64 else 65 set(handles.get_field,'UserData',Field);66 65 if ~exist('ParamIn','var') 67 66 ParamIn=[]; … … 80 79 pos_view_field(2)=ScreenSize(2); 81 80 set(hObject,'Position',pos_view_field) 82 83 % if ~(exist('multiple','var') && isequal(multiple,1)) %set single occurrence84 % hget_field=findobj(allchild(0),'Name','get_field'); %hget_field(1)= new GUI85 % if length(hget_field)>186 % delete(hget_field(2))87 % end88 % else89 % set(hObject,'name','get_field_1')90 % end91 81 set(handles.get_field,'WindowStyle','modal')% Make the GUI modal 92 82 drawnow 93 uiwait(handles.get_field); 94 95 %------------------------------------------------------------------------ 96 % --- Outputs from this function are returned to the command line. 97 function varargout = get_field_OutputFcn(hObject, eventdata, handles) 98 %------------------------------------------------------------------------ 99 varargout{1} = handles.output; 100 delete(handles.get_field) 101 102 %------------------------------------------------------------------------ 103 % --- Executes when a new input file name is introduced. 104 function inputfile_Callback(hObject, eventdata, handles) 105 %------------------------------------------------------------------------ 106 inputfile=get(handles.inputfile,'String'); 107 Field=nc2struct(inputfile,[]);% reads the field description, without data 108 if isfield(Field,'Txt') 109 msgbox_uvmat('ERROR',Field.Txt) 110 else 111 set(handles.get_field,'UserData',Field); 112 Field_input(handles,Field); 113 end 114 huvmat=findobj(allchild(0),'tag','uvmat'); 115 if ~isempty(huvmat) 116 delete(huvmat)%delete uvmat for plot reinitialisation 117 end 83 uiwait(handles.get_field); 118 84 119 85 %------------------------------------------------------------------------ 120 86 % --- update the display when a new field is introduced. 121 function Field_input(handles,Field,ParamInput) 122 %------------------------------------------------------------------------ 87 function Field_input(handles,Field,ParamIn) 88 %------------------------------------------------------------------------ 89 90 %% fill the list and values of dimensions 123 91 if isfield(Field,'ListDimName')&&~isempty(Field.ListDimName) 124 92 Tabcell(:,1)=Field.ListDimName; … … 132 100 return 133 101 end 102 103 %% fill the list of variables 134 104 Txt=Field.ListVarName; 135 105 set(handles.variables,'Value',1) … … 137 107 variables_Callback(handles.variables,[], handles) 138 108 139 if exist('ParamInput','var') 140 fill_GUI(ParamInput,handles); 141 return 142 else 143 set(handles.abscissa,'String',[{''} Txt ]) 109 % set(handles.abscissa,'String',[{''} Txt ]) 144 110 set(handles.ordinate,'String',Txt) 145 111 set(handles.vector_x,'String',[Txt ]) … … 147 113 set(handles.vector_z,'String',[{''} Txt ]) 148 114 set(handles.vec_color,'String',[{''} Txt ]) 149 % set(handles.XVarName,'String',[{''} Txt ]) 150 % set(handles.ZVarName,'String',[{''} Txt ]) 115 set(handles.XVarName,'String',[{''} Txt ]) 116 set(handles.YVarName,'String',[{''} Txt ]) 117 set(handles.ZVarName,'String',[{''} Txt ]) 151 118 % set(handles.coord_x_vectors,'String',[{''} Txt ]) 152 119 % set(handles.coord_y_vectors,'String',[{''} Txt ]) … … 154 121 % set(handles.TimeVarName,'String',[{''} Txt ]) 155 122 set(handles.scalar,'Value',1) 156 157 123 set(handles.scalar,'String', Txt ) 124 125 %% ananlyse the input field cells 158 126 [CellInfo,NbDim,errormsg]=find_field_cells(Field); 159 127 if ~isempty(errormsg) … … 161 129 return 162 130 end 163 [maxdim,imax]=max(NbDim); 131 [Field.MaxDim,imax]=max(NbDim); 132 % look at variables with a single dimension 133 for ilist=1:numel(Field.VarDimName) 134 if ischar(Field.VarDimName{ilist}) 135 Field.VarDimName{ilist}={Field.VarDimName{ilist}}; %transform string into cell 136 end 137 NbDim=numel(Field.VarDimName{ilist});% TODO eliminate singleton dimensions 138 check_singleton=false(1,NbDim); 139 for idim=1:NbDim 140 dim_index=strcmp(Field.VarDimName{ilist}{idim},Field.ListDimName); 141 check_singleton(idim)=isequal(Field.DimValue(dim_index),1); 142 end 143 Field.VarDimName{ilist}=Field.VarDimName{ilist}(~check_singleton); 144 Field.NbDim(ilist)=numel(Field.VarDimName{ilist}); 145 if Field.NbDim(ilist)==1 146 Field.VarDimName{ilist}=cell2mat(Field.VarDimName{ilist}); 147 end 148 end 149 SingleVarName=Field.ListVarName(Field.NbDim==1);%list of variables with a single dim 150 MultiVarName=Field.ListVarName(Field.NbDim>1); 151 check_dim=zeros(size(Field.VarDimName)); 152 for ilist=1:numel(Field.VarDimName); 153 if iscell(Field.VarDimName{ilist})% exclude single dim 154 for idim=1:numel(Field.VarDimName{ilist}) 155 check_dim=check_dim|strcmp(Field.VarDimName{ilist}{idim},Field.VarDimName); 156 end 157 end 158 end 159 Field.SingleVarName=Field.ListVarName(find(check_dim));%list of variables with a single dim 160 Field.SingleDimName=Field.VarDimName(find(check_dim));% corresponding list of dimensions for variables with a single dim 161 Field.MaxDim=max(Field.NbDim); 164 162 165 163 %% set time mode 166 if maxdim>=4 167 set(handles.SwitchVarIndexTime,'Value',4) 164 ListSwitchVarIndexTime={'file index'}; 165 % look at global attributes with numerical values 166 check_numvalue=false; 167 check_time=false; 168 for ilist=1:numel(Field.ListGlobalAttribute) 169 Value=Field.(Field.ListGlobalAttribute{ilist}); 170 check_numvalue(ilist)=isnumeric(Value); 171 check_time(ilist)=~isempty(find(regexp(Field.ListGlobalAttribute{ilist},'Time'),1)); 172 end 173 Field.ListNumAttributes=Field.ListGlobalAttribute(check_numvalue);% select the attributes with float numerical value 174 if ~isempty(Field.ListNumAttributes) 175 ListSwitchVarIndexTime=[ListSwitchVarIndexTime; {'attribute'}]; 176 end 177 nboption=numel(ListSwitchVarIndexTime); 178 if Field.MaxDim>=2 179 ListSwitchVarIndexTime=[ListSwitchVarIndexTime;{'variable'};{'dim index'}]; 180 end 181 if Field.MaxDim>=4 182 option=nboption+1; 183 elseif ~isempty(find(check_time, 1)) 184 option=2; 168 185 else 169 time_index=[]; 170 if isfield(Field,'ListGlobalAttribute') 171 time_index=find(~cellfun('isempty',regexp(Field.ListGlobalAttribute,'Time')));% index of the attributes containing the string 'Time' 172 end 173 if isempty(time_index) 174 set(handles.SwitchVarIndexTime,'Value',1) 175 else 176 set(handles.SwitchVarIndexTime,'Value',2) 177 end 178 end 186 option=1; 187 end 188 set(handles.SwitchVarIndexTime,'String',ListSwitchVarIndexTime) 189 set(handles.SwitchVarIndexTime,'Value',option) 190 set(handles.get_field,'UserData',Field);% record the finput field structure 179 191 SwitchVarIndexTime_Callback([],[], handles) 180 192 181 if maxdim>=3 193 %% set z coordinate menu if relevant 194 if Field.MaxDim>=3 182 195 set(handles.vector_z,'Visible','on') 183 196 set(handles.vector_z,'String',[{''} Txt ]) … … 185 198 set(handles.SwitchVarIndexZ,'Visible','on') 186 199 set(handles.Z_title,'Visible','on') 187 % set(handles.TimeVarName,'Visible','on')188 % set(handles.TimeVarName,'String',[{''} Txt ])189 % set(handles.YVarName,'Visible','on')190 % set(handles.YVarName,'String',[{''} Txt ])191 200 else 192 201 set(handles.vector_z,'Visible','off') … … 195 204 set(handles.Z_title,'Visible','off') 196 205 end 197 if maxdim>=2 206 207 %% set vector menu (priority) if detected or scalar menu for space dim >=2, or usual (x,y) plot for 1D fields 208 if Field.MaxDim>=2 % case of 2D (or 3D) fields 198 209 set(handles.CheckPlot1D,'Value',0) 199 210 if isfield(CellInfo{imax},'VarIndex_vector_x') && isfield(CellInfo{imax},'VarIndex_vector_y') … … 202 213 set(handles.vector_x,'Value',CellInfo{imax}.VarIndex_vector_x(1)) 203 214 set(handles.vector_y,'Value',CellInfo{imax}.VarIndex_vector_y(1)) 204 % if strcmp(CellInfo{imax}.CoordType,'scattered')205 % set(handles.coord_x_vectors,'Value',CellInfo{imax}.CoordIndex(end))206 % set(handles.coord_y_vectors,'Value',CellInfo{imax}.CoordIndex(end-1))207 % elseif strcmp(CellInfo{imax}.CoordType,'grid')208 % set(handles.coord_x_vectors,'Value',CellInfo{imax}.CoordIndex(end)+1)209 % set(handles.coord_y_vectors,'Value',CellInfo{imax}.CoordIndex(end-1)+1)210 % end211 215 else 212 216 set(handles.CheckScalar,'Value',1) 213 217 set(handles.CheckVector,'Value',0) 214 % if isfield(CellInfo{imax},'VarIndex_scalar') 215 % set(handles.scalar,'Value',CellInfo{imax}.VarIndex_scalar(1)) 216 % set(handles.XVarName,'Value',CellInfo{imax}.CoordIndex(end)+1) 217 % set(handles.ZVarName,'Value',CellInfo{imax}.CoordIndex(end-1)+1) 218 % if numel(CellInfo{imax}.CoordIndex)==3 219 % set(handles.YVarName,'Value',CellInfo{imax}.CoordIndex(1)+1) 220 % end 221 % end 222 end 223 else 218 end 219 else % case of 1D fields 224 220 set(handles.CheckPlot1D,'Value',1) 225 221 set(handles.CheckScalar,'Value',0) 226 222 set(handles.CheckVector,'Value',0) 227 223 end 224 225 %% Make choices in menus from input 226 if exist('ParamIn','var')&&~isempty(ParamIn) 227 fill_GUI(ParamIn,handles); 228 228 end 229 229 CheckPlot1D_Callback(handles.CheckPlot1D, [], handles) … … 232 232 233 233 %------------------------------------------------------------------------ 234 % --- Outputs from this function are returned to the command line. 235 function varargout = get_field_OutputFcn(hObject, eventdata, handles) 236 %------------------------------------------------------------------------ 237 varargout{1} = handles.output; 238 delete(handles.get_field) 239 240 241 % ----------------------------------------------------------------------- 242 % --- Activated by selection in the list of variables 243 function variables_Callback(hObject, eventdata, handles) 244 % ----------------------------------------------------------------------- 245 Tabchar={''};%default 246 Tabcell=[]; 247 hselect_field=get(handles.variables,'parent'); 248 Field=get(handles.get_field,'UserData'); 249 index=get(handles.variables,'Value');%index in the list 'variables' 250 251 %% list global TimeAttribute names and values if index=1 (blank TimeVariable display) is selected 252 if isequal(index,1) 253 set(handles.attributes_txt,'String','global attributes') 254 if isfield(Field,'ListGlobalAttribute') && ~isempty(Field.ListGlobalAttribute) 255 for iline=1:length(Field.ListGlobalAttribute) 256 Tabcell{iline,1}=Field.ListGlobalAttribute{iline}; 257 if isfield(Field, Field.ListGlobalAttribute{iline}) 258 eval(['val=Field.' Field.ListGlobalAttribute{iline} ';']) 259 if ischar(val);% attribute value is char string 260 Tabcell{iline,2}=val; 261 elseif size(val,1)==1 %attribute value is a number or matlab vector 262 Tabcell{iline,2}=num2str(val); 263 end 264 end 265 end 266 Tabchar=cell2tab(Tabcell,'='); 267 end 268 %% list Attribute names and values associated to the Variable # index-1 269 else 270 list_var=get(handles.variables,'String'); 271 var_select=list_var{index}; 272 set(handles.attributes_txt,'String', ['attributes of ' var_select]) 273 if isfield(Field,'VarAttribute')&& length(Field.VarAttribute)>=index-1 274 % nbline=0; 275 VarAttr=Field.VarAttribute{index-1}; 276 if isstruct(VarAttr) 277 attr_list=fieldnames(VarAttr); 278 for iline=1:length(attr_list) 279 Tabcell{iline,1}=attr_list{iline}; 280 eval(['val=VarAttr.' attr_list{iline} ';']) 281 if ischar(val); 282 Tabcell{iline,2}=val; 283 else 284 Tabcell{iline,2}=num2str(val); 285 end 286 end 287 end 288 end 289 290 end 291 if ~isempty(Tabcell) 292 Tabchar=cell2tab(Tabcell,'='); 293 Tabchar=[{''};Tabchar]; 294 end 295 set(handles.attributes,'Value',1);% select the first item 296 set(handles.attributes,'String',Tabchar); 297 298 %% update dimensions; 299 if isfield(Field,'ListDimName') 300 Tabdim={};%default 301 if isequal(index,1)%list all dimensions 302 dim_indices=1:length(Field.ListDimName); 303 set(handles.dimensions_txt,'String', 'dimensions') 304 else 305 DimCell=Field.VarDimName{index-1}; 306 if ischar(DimCell) 307 DimCell={DimCell}; 308 end 309 dim_indices=[]; 310 for idim=1:length(DimCell) 311 dim_index=strcmp(DimCell{idim},Field.ListDimName);%vector with size of Field.ListDimName, =0 312 dim_index=find(dim_index,1); 313 dim_indices=[dim_indices dim_index]; 314 end 315 set(handles.dimensions_txt,'String', ['dimensions of ' var_select]) 316 end 317 for iline=1:length(dim_indices) 318 Tabdim{iline,1}=Field.ListDimName{dim_indices(iline)}; 319 Tabdim{iline,2}=num2str(Field.DimValue(dim_indices(iline))); 320 end 321 Tabchar=cell2tab(Tabdim,' = '); 322 Tabchar=[{''} ;Tabchar]; 323 set(handles.dimensions,'Value',1) 324 set(handles.dimensions,'String',Tabchar) 325 end 326 327 328 329 %------------------------------------------------------------------------ 330 % --- Executes on button press in CheckPlot1D. 331 function CheckPlot1D_Callback(hObject, eventdata, handles) 332 %------------------------------------------------------------------------ 333 val=get(handles.CheckPlot1D,'Value'); 334 if isequal(val,0) 335 set(handles.Panel1Dplot,'Visible','off') 336 else 337 set(handles.Panel1Dplot,'Visible','on') 338 set(handles.PanelScalar,'Visible','off') 339 set(handles.CheckScalar,'Value',0) 340 set(handles.PanelVectors,'Visible','off') 341 set(handles.CheckVector,'Value',0) 342 set(handles.XVarName,'Visible','on') 343 set(handles.SwitchVarIndexX,'Visible','on') 344 set(handles.X_title,'Visible','on') 345 set(handles.YVarName,'Visible','off') 346 set(handles.SwitchVarIndexY,'Visible','off') 347 set(handles.Y_title,'Visible','off') 348 set(handles.ZVarName,'Visible','off') 349 set(handles.SwitchVarIndexZ,'Visible','off') 350 set(handles.Z_title,'Visible','off') 351 ordinate_Callback(hObject, eventdata, handles) 352 end 353 354 %------------------------------------------------------------------------ 234 355 function ordinate_Callback(hObject, eventdata, handles) 235 356 %------------------------------------------------------------------------ 236 hselect_field=get(handles.inputfile,'parent'); 237 Field=get(hselect_field,'UserData'); 357 Field=get(handles.get_field,'UserData'); 238 358 list=get(handles.ordinate,'String'); 239 359 yindex=get(handles.ordinate,'Value'); … … 245 365 [CellInfo,NbDim,errormsg]=find_field_cells(Field); 246 366 %[CellVarIndex,NbDim,VarRole,errormsg]=find_field_cells(Field); 247 % for icell=1:numel(CellInfo) TODO: adapt to new convention 248 % VarIndex=CellInfo{icell}.VarIndex; 249 % if ~isempty(find(VarIndex==yindex,1)) && (isempty(VarRole{icell}.coord_x)||~isequal(VarRole{icell}.coord_x,VarIndex)) 250 % cell_select=icell; 251 % break 252 % end 253 % end 254 % 255 % val=get(handles.abscissa,'Value'); 256 % set(handles.abscissa,'Value',min(val,2)); 257 % coord_x_index=VarRole{cell_select}.coord; 258 % coord_x_index=coord_x_index(coord_x_index~=0); 259 % set(handles.abscissa,'String',[{''}; (Field.ListVarName(coord_x_index))'; (Field.ListVarName(VarIndex))']) 367 for icell=1:numel(CellInfo) 368 VarIndex=CellInfo{icell}.VarIndex; 369 if ~isempty(find(VarIndex==yindex,1)) && (isempty(VarRole{icell}.coord_x)||~isequal(VarRole{icell}.coord_x,VarIndex)) 370 cell_select=icell; 371 break 372 end 373 end 374 val=get(handles.abscissa,'Value'); 375 set(handles.abscissa,'Value',min(val,2)); 376 coord_x_index=VarRole{cell_select}.coord; 377 coord_x_index=coord_x_index(coord_x_index~=0); 378 set(handles.XVarname,'String',[{''}; (Field.ListVarName(coord_x_index))'; (Field.ListVarName(VarIndex))']) 379 380 %------------------------------------------------------------------------ 381 % --- Executes on button press in CheckScalar. 382 function CheckScalar_Callback(hObject, eventdata, handles) 383 %------------------------------------------------------------------------ 384 val=get(handles.CheckScalar,'Value'); 385 if isequal(val,0) 386 set(handles.PanelScalar,'Visible','off') 387 else 388 set(handles.Panel1Dplot,'Visible','off') 389 set(handles.CheckPlot1D,'Value',0) 390 set(handles.PanelScalar,'Visible','on') 391 set(handles.PanelVectors,'Visible','off') 392 set(handles.CheckVector,'Value',0) 393 end 394 395 %------------------------------------------------------------------------ 396 % --- Executes on button press in CheckVector. 397 function CheckVector_Callback(hObject, eventdata, handles) 398 %------------------------------------------------------------------------ 399 val=get(handles.CheckVector,'Value'); 400 if isequal(val,0) 401 set(handles.PanelVectors,'Visible','off') 402 else 403 set(handles.Panel1Dplot,'Visible','off') 404 set(handles.CheckPlot1D,'Value',0) 405 set(handles.PanelScalar,'Visible','off') 406 set(handles.CheckScalar,'Value',0) 407 set(handles.PanelVectors,'Visible','on') 408 end 409 410 411 %------------------------------------------------------------------------ 412 % --- Executes on selection change in scalar menu. 413 function scalar_Callback(hObject, eventdata, handles) 414 %------------------------------------------------------------------------ 415 index=get(handles.scalar,'Value'); 416 string=get(handles.scalar,'String'); 417 VarName=string{index}; 418 update_field(hObject, eventdata, handles,VarName) 419 420 %eliminate time 421 TimeDimName='';%default 422 if strcmp(get(handles.TimeDimensionMenu,'Visible'),'on') 423 TimeDimList=get(handles.TimeDimensionMenu,'String'); 424 TimeDimIndex=get(handles.TimeDimensionMenu,'Value'); 425 TimeDimName=TimeDimList{TimeDimIndex}; 426 end 427 428 %check possible coordinates 429 Field=get(handles.get_field,'UserData'); 430 dim_scalar=Field.VarDimName{index};%list of dimensions of the selected scalar 431 test_coord=ones(size(Field.VarDimName)); %=1 when variable #ilist is eligible as coordinate 432 for ilist=1:numel(Field.VarDimName) 433 dimnames=Field.VarDimName{ilist}; %list of dimensions for variable #ilist 434 if isequal(dimnames,{TimeDimName}) 435 test_coord(ilist)=0;%mark time variables fo elimination 436 end 437 for idim=1:numel(dimnames) 438 if isempty(find(strcmp(dimnames{idim},dim_scalar),1))%dimension not found in the scalar variable 439 test_coord(ilist)=0; 440 break 441 end 442 end 443 end 444 test_coord(index)=0;%the coordinate variable must be different from the scalar 445 446 string_coord=[{''};string(test_coord==1)]; 447 val=get(handles.XVarName,'Value'); 448 if val>numel(string_coord) 449 set(handles.XVarName,'Value',1) 450 end 451 set(handles.XVarName,'String',string_coord); 452 val=get(handles.ZVarName,'Value'); 453 if val>numel(string_coord) 454 set(handles.ZVarName,'Value',1) 455 end 456 set(handles.ZVarName,'String',string_coord); 457 val=get(handles.ZVarName,'Value'); 458 if val>numel(string_coord) 459 set(handles.ZVarName,'Value',1) 460 end 461 set(handles.YVarName,'String',string_coord); 462 260 463 261 464 %------------------------------------------------------------------------ … … 301 504 % update_UserData(handles) 302 505 303 %------------------------------------------------------------------------304 % --- Executes on selection change in scalar menu.305 function scalar_Callback(hObject, eventdata, handles)306 %------------------------------------------------------------------------307 index=get(handles.scalar,'Value');308 string=get(handles.scalar,'String');309 VarName=string{index};310 update_field(hObject, eventdata, handles,VarName)311 312 %eliminate time313 TimeDimName='';%default314 if strcmp(get(handles.TimeDimensionMenu,'Visible'),'on')315 TimeDimList=get(handles.TimeDimensionMenu,'String');316 TimeDimIndex=get(handles.TimeDimensionMenu,'Value');317 TimeDimName=TimeDimList{TimeDimIndex};318 end319 320 %check possible coordinates321 Field=get(handles.get_field,'UserData');322 dim_scalar=Field.VarDimName{index};%list of dimensions of the selected scalar323 test_coord=ones(size(Field.VarDimName)); %=1 when variable #ilist is eligible as coordinate324 for ilist=1:numel(Field.VarDimName)325 dimnames=Field.VarDimName{ilist}; %list of dimensions for variable #ilist326 if isequal(dimnames,{TimeDimName})327 test_coord(ilist)=0;%mark time variables fo elimination328 end329 for idim=1:numel(dimnames)330 if isempty(find(strcmp(dimnames{idim},dim_scalar),1))%dimension not found in the scalar variable331 test_coord(ilist)=0;332 break333 end334 end335 end336 test_coord(index)=0;%the coordinate variable must be different from the scalar337 338 string_coord=[{''};string(test_coord==1)];339 val=get(handles.XVarName,'Value');340 if val>numel(string_coord)341 set(handles.XVarName,'Value',1)342 end343 set(handles.XVarName,'String',string_coord);344 val=get(handles.ZVarName,'Value');345 if val>numel(string_coord)346 set(handles.ZVarName,'Value',1)347 end348 set(handles.ZVarName,'String',string_coord);349 val=get(handles.ZVarName,'Value');350 if val>numel(string_coord)351 set(handles.ZVarName,'Value',1)352 end353 set(handles.YVarName,'String',string_coord);354 506 355 507 … … 391 543 %check possible coordinates 392 544 Field=get(handles.get_field,'UserData'); 393 dim_var=Field.VarDimName{index};%list of dimensions of the selected scalar545 dim_var=Field.VarDimName{index};%list of dimensions of the selected variable 394 546 test_coord=ones(size(Field.VarDimName)); %=1 when variable #ilist is eligible as coordinate 395 547 test_component=ones(size(Field.VarDimName)); %=1 when variable #ilist is eligible as other vector component … … 429 581 set(handles.vec_color,'String',[{''};string(test_component==1)]) 430 582 string_coord=[{''};string(test_coord==1)]; 431 val=get(handles. coord_x_vectors,'Value');583 val=get(handles.XVarName,'Value'); 432 584 if val>numel(string_coord) 433 set(handles.coord_x_vectors,'Value',1) 434 end 435 set(handles.coord_x_vectors,'String',string_coord); 436 val=get(handles.coord_y_vectors,'Value'); 585 set(handles.XVarName,'Value',1) 586 end 587 set(handles.XVarName,'Visible','on'); 588 set(handles.XVarName,'String',string_coord); 589 val=get(handles.YVarName,'Value'); 437 590 if val>numel(string_coord) 438 set(handles.coord_y_vectors,'Value',1) 439 end 440 set(handles.coord_y_vectors,'String',string_coord); 591 set(handles.YVarName,'Value',1) 592 end 593 set(handles.YVarName,'Visible','on'); 594 set(handles.YVarName,'String',string_coord); 441 595 val=get(handles.TimeVarName,'Value'); 442 596 if val>numel(string_coord) … … 870 1024 delete(handles.get_field) 871 1025 872 %------------------------------------------------------------------------ 873 % --- Function for plotting the current subfield 874 function plot_get_field(SubField,handles) 875 %------------------------------------------------------------------------ 876 list_fig=get(handles.list_fig,'String'); 877 val=get(handles.list_fig,'Value'); 878 if strcmp(list_fig{val},'uvmat') 879 set(handles.inputfile,'Enable','off')% desactivate the input file edit box 880 set(handles.OK,'Visible','off')% RUN button not visible (passive mode, get_field used to define the field for uvamt) 881 set(handles.MenuOpen,'Visible','off') 882 set(handles.MenuExport,'Visible','off') 883 uvmat(get(handles.inputfile,'String')) 884 elseif strcmp(list_fig{val},'view_field') 885 view_field(SubField) 886 else 887 hfig=str2double(list_fig{val});% chosen figure number from tyhe GUI 888 if isnan(hfig) 889 hfig=figure; 890 list_fig=[list_fig;num2str(hfig)]; 891 set(handles.list_fig,'String',list_fig); 892 haxes=axes; 893 else 894 figure(hfig); 895 end 896 haxes=findobj(hfig,'Type','axes'); 897 plot_field(SubField,haxes) 898 end 899 900 % %------------------------------------------------ 901 % % --- Executes on button press in Plot_histo. 902 % %OK global histograms 903 % %------------------------------------------------- 904 % function RUN_histo_Callback(hObject, eventdata, handles) 905 % % hObject handle to OK (see GCBO) 906 % % eventdata reserved - to be defined in a future version of MATLAB 907 % % handles structure with handles and user data (see GUIDATA) 908 % 909 % %timename plots 910 % leg={}; 911 % n=0; 912 % if (get(handles.cm_switch,'Value')==1) 913 % Uval_p=Uval_cm; 914 % Vval_p=Vval_cm; 915 % Uhist_p=Uhist_cm; 916 % Vhist_p=Vhist_cm; 917 % xlab='velocity (cm/s)'; 918 % else 919 % Uval_p=Uval; 920 % Vval_p=Vval; 921 % Uhist_p=Uhist; 922 % Vhist_p=Vhist; 923 % xlab='velocity (pixels)'; 924 % end 925 % if (get(handles.vector_y,'Value') == 1) 926 % hhh=figure(2); 927 % hold on 928 % title([filebase ', ' strindex ', ' fieldtitle]) 929 % plot(Uval_p,Uhist_p,'b-') 930 % n=n+1; 931 % leg{n}='Uhist'; 932 % xlabel(xlab) 933 % end 934 % if (get(handles.Vhist_input,'Value') == 1) 935 % hhh=figure(2); 936 % hold on 937 % title([filebase ', ' strindex ', ' fieldtitle]) 938 % plot(Vval_p,Vhist_p,'r-') 939 % n=n+1; 940 % leg{n}='Vhist'; 941 % xlabel(xlab); 942 % end 943 % if (get(handles.Chist_input,'Value') == 1) 944 % hhhh=figure(3); 945 % hold on 946 % title([filebase ', ' strindex ', ' fieldtitle]) 947 % plot(Cval,Chist,'k-') 948 % leg{1}='Chist'; 949 % end 950 % % hold off 951 % grid on 952 % legend(leg); 953 954 % %------------------------------------------------------------- 955 % % --- Executes on button press in Save_input. 956 % function Save_input_Callback(hObject, eventdata, handles) 957 % list_str=get(handles.abscissa,'String'); 958 % val=get(handles.abscissa,'Value'); 959 % var=list_str{val}; 960 % hselect_field=get(handles.Save_input,'parent') 961 % set(hselect_field,'UserData',var); 962 % set(hselect_field,'Tag','idle') 963 964 % 965 % %------------------------------------------------------------- 966 % % --- Executes on button press in save_histo. 967 % function save_histo_Callback(hObject, eventdata, handles) 968 % global filebase 969 % 970 % pathstr = fileparts(filebase) 971 % if (get(handles.Chist_input,'Value') == 1) 972 % def = {[pathstr pathstr(1) 'PIV_corr_histo.fig']}; 973 % else 974 975 % def = {[pathstr pathstr(1) 'vel_histo.fig']}; 976 % end 977 % prompt={'save figure(2) as'} 978 % dlg_title = 'save figure'; 979 % num_lines= 1; 980 % answer = inputdlg(prompt,dlg_title,num_lines,def) 981 % saveas(2,answer{1}) 982 983 984 %%------------------------------------------------------- 985 % --- Executes on button press in peaklocking. 986 %------------------------------------------------- 987 function peaklocking(handles) 988 %evaluation of peacklocking errors 989 %use splinhist: give spline coeff cc for a smooth histo (call spline4) 990 %use histsmooth(x,cc): calculate the smooth histo for any value x 991 %use histder(x,cc): calculate the derivative of the smooth histo 992 global hfig1 hfig2 hfig3 993 global nbb Uval Vval Uhist Vhist % nbb resolution of the histogram nbb=10: 10 values in unity interval 994 global xval xerror yval yerror 995 996 set(handles.vector_y,'Value',1)% trigger the option Uhist on the interface 997 set(handles.Vhist_input,'Value',1) 998 set(handles.cm_switch,'Value',0) % put the switch to 'pixel' 999 1000 %adjust the extremal values of the histogram in U with respect to integer 1001 %values 1002 minimU=round(min(Uval)-0.5)+0.5; %first value of the histogram with integer bins 1003 maximU=round(max(Uval)-0.5)+0.5; 1004 minim_fin=(minimU-0.5+1/(2*nbb)); % first bin valueat the beginning of an integer interval 1005 maxim_fin=(maximU+0.5-1/(2*nbb)); % last integer value 1006 nb_bin_min= round(-(minim_fin - min(Uval))*nbb); % nbre of bins added below 1007 nb_bin_max=round((maxim_fin -max(Uval))*nbb); %nbre of bins added above 1008 Uval=[minim_fin:(1/nbb):maxim_fin]; 1009 histu_min=zeros(nb_bin_min,1); 1010 histu_max=zeros(nb_bin_max,1); 1011 Uhist=[histu_min; Uhist ;histu_max]; % column vector 1012 1013 %adjust the extremal values of the histogram in V 1014 minimV=round(min(Vval-0.5)+0.5); 1015 maximV=round(max(Vval-0.5)+0.5); 1016 minim_fin=minimV-0.5+1/(2*nbb); % first bin valueat the beginning of an integer interval 1017 maxim_fin=maximV+0.5-1/(2*nbb); % last integer value 1018 nb_bin_min=round((min(Vval) - minim_fin)*nbb); % nbre of bins added below 1019 nb_bin_max=round((maxim_fin -max(Vval))*nbb); 1020 Vval=[minim_fin:(1/nbb):maxim_fin]; 1021 histu_min=zeros(nb_bin_min,1); 1022 histu_max=zeros(nb_bin_max,1); 1023 Vhist=[histu_min; Vhist ;histu_max]; % column vector 1024 1025 % RUN_histo_Callback(hObject, eventdata, handles) 1026 % %adjust the histogram to integer values: 1027 1028 %histoU and V 1029 [Uhistinter,xval,xerror]=peaklock(nbb,minimU,maximU,Uhist); 1030 [Vhistinter,yval,yerror]=peaklock(nbb,minimV,maximV,Vhist); 1031 1032 % selection of value ranges such that histo>=10 (enough statistics) 1033 Uval_ind=find(Uhist>=10); 1034 ind_min=min(Uval_ind); 1035 ind_max=max(Uval_ind); 1036 U_min=Uval(ind_min);% minimum allowed value 1037 U_max=Uval(ind_max);%maximum allowed value 1038 1039 % selection of value ranges such that histo>=10 (enough statistics) 1040 Vval_ind=find(Vhist>=10); 1041 ind_min=min(Vval_ind); 1042 ind_max=max(Vval_ind); 1043 V_min=Vval(ind_min);% minimum allowed value 1044 V_max=Vval(ind_max);%maximum allowed value 1045 1046 figure(4)% plot U histogram with smoothed one 1047 plot(Uval,Uhist,'b') 1048 grid on 1049 hold on 1050 plot(Uval,Uhistinter,'r'); 1051 hold off 1052 1053 figure(5)% plot V histogram with smoothed one 1054 plot(Vval,Vhist,'b') 1055 grid on 1056 hold on 1057 plot(Vval,Vhistinter,'r'); 1058 hold off 1059 1060 figure(6)% plot pixel error in two subplots 1061 hfig4=subplot(2,1,1); 1062 hfig5=subplot(2,1,2); 1063 axes(hfig4) 1064 plot(xval,xerror) 1065 axis([U_min U_max -0.4 0.4]) 1066 xlabel('velocity u (pix)') 1067 ylabel('peaklocking error (pix)') 1068 grid on 1069 axes(hfig5) 1070 plot(yval,yerror) 1071 axis([V_min V_max -0.4 0.4]); 1072 xlabel('velocity v (pix)') 1073 ylabel('peaklocking error (pix)') 1074 grid on 1075 1076 1077 % ------------------------------------------------------------------ 1078 function variables_Callback(hObject, eventdata, handles) 1079 Tabchar={''};%default 1080 Tabcell=[]; 1081 hselect_field=get(handles.variables,'parent'); 1082 Field=get(handles.get_field,'UserData'); 1083 index=get(handles.variables,'Value');%index in the list 'variables' 1084 1085 %% list global TimeAttribute names and values if index=1 (blank TimeVariable display) is selected 1086 if isequal(index,1) 1087 set(handles.attributes_txt,'String','global attributes') 1088 if isfield(Field,'ListGlobalAttribute') && ~isempty(Field.ListGlobalAttribute) 1089 for iline=1:length(Field.ListGlobalAttribute) 1090 Tabcell{iline,1}=Field.ListGlobalAttribute{iline}; 1091 if isfield(Field, Field.ListGlobalAttribute{iline}) 1092 eval(['val=Field.' Field.ListGlobalAttribute{iline} ';']) 1093 if ischar(val);% attribute value is char string 1094 Tabcell{iline,2}=val; 1095 elseif size(val,1)==1 %attribute value is a number or matlab vector 1096 Tabcell{iline,2}=num2str(val); 1097 end 1098 end 1099 end 1100 Tabchar=cell2tab(Tabcell,'='); 1101 end 1102 %% list Attribute names and values associated to the Variable # index-1 1103 else 1104 list_var=get(handles.variables,'String'); 1105 var_select=list_var{index}; 1106 set(handles.attributes_txt,'String', ['attributes of ' var_select]) 1107 if isfield(Field,'VarAttribute')&& length(Field.VarAttribute)>=index-1 1108 % nbline=0; 1109 VarAttr=Field.VarAttribute{index-1}; 1110 if isstruct(VarAttr) 1111 attr_list=fieldnames(VarAttr); 1112 for iline=1:length(attr_list) 1113 Tabcell{iline,1}=attr_list{iline}; 1114 eval(['val=VarAttr.' attr_list{iline} ';']) 1115 if ischar(val); 1116 Tabcell{iline,2}=val; 1117 else 1118 Tabcell{iline,2}=num2str(val); 1119 end 1120 end 1121 end 1122 end 1123 1124 end 1125 if ~isempty(Tabcell) 1126 Tabchar=cell2tab(Tabcell,'='); 1127 Tabchar=[{''};Tabchar]; 1128 end 1129 set(handles.attributes,'Value',1);% select the first item 1130 set(handles.attributes,'String',Tabchar); 1131 1132 %% update dimensions; 1133 if isfield(Field,'ListDimName') 1134 Tabdim={};%default 1135 if isequal(index,1)%list all dimensions 1136 dim_indices=1:length(Field.ListDimName); 1137 set(handles.dimensions_txt,'String', 'dimensions') 1138 else 1139 DimCell=Field.VarDimName{index-1}; 1140 if ischar(DimCell) 1141 DimCell={DimCell}; 1142 end 1143 dim_indices=[]; 1144 for idim=1:length(DimCell) 1145 dim_index=strcmp(DimCell{idim},Field.ListDimName);%vector with size of Field.ListDimName, =0 1146 dim_index=find(dim_index,1); 1147 dim_indices=[dim_indices dim_index]; 1148 end 1149 set(handles.dimensions_txt,'String', ['dimensions of ' var_select]) 1150 end 1151 for iline=1:length(dim_indices) 1152 Tabdim{iline,1}=Field.ListDimName{dim_indices(iline)}; 1153 Tabdim{iline,2}=num2str(Field.DimValue(dim_indices(iline))); 1154 end 1155 Tabchar=cell2tab(Tabdim,' = '); 1156 Tabchar=[{''} ;Tabchar]; 1157 set(handles.dimensions,'Value',1) 1158 set(handles.dimensions,'String',Tabchar) 1159 end 1160 1161 %------------------------------------------------------------------------ 1162 % --- Executes on button press in CheckPlot1D. 1163 function CheckPlot1D_Callback(hObject, eventdata, handles) 1164 %------------------------------------------------------------------------ 1165 val=get(handles.CheckPlot1D,'Value'); 1166 if isequal(val,0) 1167 set(handles.Panel1Dplot,'Visible','off') 1168 else 1169 set(handles.Panel1Dplot,'Visible','on') 1170 set(handles.PanelScalar,'Visible','off') 1171 set(handles.CheckScalar,'Value',0) 1172 set(handles.PanelVectors,'Visible','off') 1173 set(handles.CheckVector,'Value',0) 1174 end 1175 1176 %------------------------------------------------------------------------ 1177 % --- Executes on button press in CheckScalar. 1178 function CheckScalar_Callback(hObject, eventdata, handles) 1179 %------------------------------------------------------------------------ 1180 val=get(handles.CheckScalar,'Value'); 1181 if isequal(val,0) 1182 set(handles.PanelScalar,'Visible','off') 1183 else 1184 set(handles.Panel1Dplot,'Visible','off') 1185 set(handles.CheckPlot1D,'Value',0) 1186 set(handles.PanelScalar,'Visible','on') 1187 set(handles.PanelVectors,'Visible','off') 1188 set(handles.CheckVector,'Value',0) 1189 end 1190 1191 %------------------------------------------------------------------------ 1192 % --- Executes on button press in CheckVector. 1193 function CheckVector_Callback(hObject, eventdata, handles) 1194 %------------------------------------------------------------------------ 1195 val=get(handles.CheckVector,'Value'); 1196 if isequal(val,0) 1197 set(handles.PanelVectors,'Visible','off') 1198 else 1199 set(handles.Panel1Dplot,'Visible','off') 1200 set(handles.CheckPlot1D,'Value',0) 1201 set(handles.PanelScalar,'Visible','off') 1202 set(handles.CheckScalar,'Value',0) 1203 set(handles.PanelVectors,'Visible','on') 1204 end 1026 1205 1027 1206 1028 % %------------------------------------------------------------------------ … … 1779 1601 menu=get(handles.SwitchVarIndexTime,'String'); 1780 1602 option=menu{get(handles.SwitchVarIndexTime,'Value')}; 1603 Field=get(handles.get_field,'UserData'); 1781 1604 switch option 1782 1605 case 'file index' … … 1785 1608 set(handles.TimeVarName, 'Visible','on') 1786 1609 time_index=[]; 1787 ListAttributes=get(handles.attributes,'String'); 1788 if ~isempty(ListAttributes) 1789 time_index=find(~cellfun('isempty',regexp(ListAttributes,'Time')));% index of the attributes containing the string 'Time' 1610 PreviousList=get(handles.TimeVarName, 'String'); 1611 index=[]; 1612 if ~isempty(PreviousList) 1613 PreviousAttr=PreviousList{get(handles.TimeVarName, 'Value')}; 1614 index=find(strcmp(PreviousAttr,Field.ListNumAttributes)); 1615 end 1616 if isempty(index) 1617 time_index=find(~cellfun('isempty',regexp(Field.ListNumAttributes,'Time')));% index of the attributes containing the string 'Time' 1790 1618 end 1791 1619 if ~isempty(time_index) … … 1794 1622 set(handles.TimeVarName,'Value',1) 1795 1623 end 1796 set(handles.TimeVarName, 'String', ListAttributes)1624 set(handles.TimeVarName, 'String',Field.ListNumAttributes) 1797 1625 case 'variable' 1798 ListDim=get(handles.dimensions,'String');1799 Field=get(handles.get_field,'UserData');1800 for idim=1:numel(ListDim)1801 var_count=[];1802 for ilist=1:numel(Field.VarDimName)1803 DimName=Field.VarDimName{ilist};1804 if strcmp(DimName,ListDim{idim})||strcmp(DimName,{ListDim{idim}}) %if the variable has a single dim ( 1D array)1805 var_count=[var_count ilist];1806 end1807 end1808 if numel(var_count)==11809 TimeVarName=[TimeVarName;Field.ListVarName{var_count}];1810 end1811 end1812 1626 set(handles.TimeVarName, 'Visible','on') 1627 TimeVarName=Field.SingleVarName; 1813 1628 List=get(handles.TimeVarName,'String'); 1814 1629 option=List{get(handles.TimeVarName,'Value')}; 1815 ind=find(strcmp(option, get(handles.dimensions,'String')));1630 ind=find(strcmp(option,TimeVarName)); 1816 1631 if isempty(ind) 1817 1632 set(handles.TimeVarName, 'Value',1); … … 1822 1637 case 'dim index' 1823 1638 set(handles.TimeVarName, 'Visible','on') 1639 TimeVarName=Field.SingleDimName; 1824 1640 List=get(handles.TimeVarName,'String'); 1825 1641 option=List{get(handles.TimeVarName,'Value')}; 1826 ind=find(strcmp(option, get(handles.dimensions,'String')));1642 ind=find(strcmp(option,TimeVarName)); 1827 1643 if isempty(ind) 1828 1644 set(handles.TimeVarName, 'Value',1); … … 1830 1646 set(handles.TimeVarName, 'Value',ind); 1831 1647 end 1832 set(handles.TimeVarName, 'String', get(handles.dimensions,'String'))1833 end 1834 1835 1648 set(handles.TimeVarName, 'String',TimeVarName) 1649 end 1650 1651 -
trunk/src/imadoc2struct.m
r565 r582 54 54 for k=1:length(Timing) 55 55 Frequency=1; 56 if isfield(Timing{k},'Fr equency')56 if isfield(Timing{k},'FrameFrequency') 57 57 Frequency=Timing{k}.FrameFrequency; 58 58 end -
trunk/src/plot_field.m
r581 r582 104 104 if ~isfield(PlotParam,'Coordinates') 105 105 PlotParam.Coordinates=[]; 106 if isfield(Data,'CoordUnit') 107 PlotParam.Coordinates.CheckFixAspectRatio=1; 108 PlotParam.Coordinates.AspectRatio=1; %set axes equal by default if CoordUnit is defined 109 end 106 110 end 107 111 PlotParamOut=PlotParam;%default -
trunk/src/read_civdata.m
r581 r582 198 198 % units={'pixel','pixel','pixel','pixel','pixel','pixel','','',''}; 199 199 case 'filter1' 200 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','Nb Sites';...200 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbCentres','NbCentres';... 201 201 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U_smooth','Civ1_V_smooth','Civ1_W','Civ1_C','Civ1_F','Civ1_FF',... 202 'Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps','Civ1_W_tps','Civ1_SubRange','Civ1_Nb Sites'};202 'Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps','Civ1_W_tps','Civ1_SubRange','Civ1_NbCentres','Civ1_NbSites'}; 203 203 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',... 204 'vector_y_tps','vector_z_tps','ancillary','ancillary' };205 % units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''};204 'vector_y_tps','vector_z_tps','ancillary','ancillary','ancillary'}; 205 % rmq: NbSites obsolete replaced by NbCentres, kept for consistency with previous data 206 206 case 'civ2' 207 207 var={'X','Y','Z','U','V','W','C','F','FF';... 208 208 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF'}; 209 209 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; 210 % units={'pixel','pixel','pixel','pixel','pixel','pixel','','',''};211 210 case 'filter2' 212 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','Nb Sites';...211 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbCentres','NbCentres';... 213 212 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U_smooth','Civ2_V_smooth','Civ2_W','Civ2_C','Civ2_F','Civ2_FF',... 214 'Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps','','Civ2_SubRange','Civ2_Nb Sites'};213 'Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps','','Civ2_SubRange','Civ2_NbCentres','Civ2_NbSites'}; 215 214 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',... 216 'vector_y_tps','vector_z_tps','ancillary','ancillary'}; 217 % units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 215 'vector_y_tps','vector_z_tps','ancillary','ancillary','ancillary'}; 218 216 end 219 217 if ~strcmp(ProjModeRequest,'interp_tps') -
trunk/src/uvmat.m
r581 r582 1844 1844 num_i2=str2num(get(handles.i2,'String')); 1845 1845 num_j2=stra2num(get(handles.j2,'String')); 1846 imaname_1=''; 1846 1847 if isempty(num_j2) 1847 if isempty(num_i2) 1848 msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie') 1849 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 1850 set(handles.movie_pair,'Value',0) 1851 return 1848 if isempty(num_i2) 1849 if strcmp(get(handles.j2,'Visible'),'on') %if the j box is visible 1850 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,Ext,NomType,num_i1,[],num_j1+1); 1851 end 1852 if exist(imaname_1,'file') 1853 num_j2=num_j1+1; 1854 set(handles.j2,'String',num2str(num_j2)); 1855 else 1856 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,Ext,NomType,num_i1+1,[],num_j1); 1857 if exist(imaname_1,'file') 1858 num_i2=num_i1+1; 1859 set(handles.i2,'String',num2str(num_i2)); 1860 else 1861 msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie') 1862 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 1863 set(handles.movie_pair,'Value',0) 1864 return 1865 end 1866 end 1852 1867 else 1853 1868 num_j2=num_j1;%repeat the index i1 by default … … 3050 3065 %% fill the coordinates and variables from selections in get_field 3051 3066 if isequal(field,'get_field...') 3067 ParamIn=[]; 3052 3068 if strcmp(get(handles.VelType,'Visible'),'on') 3053 3069 % we use the civ choice as default input … … 3060 3076 ParamIn.vector_x='Civ1_U'; 3061 3077 ParamIn.vector_y='Civ1_V'; 3078 ParamIn.vec_color='Civ1_C'; 3062 3079 case 'filter1' 3063 3080 ParamIn.TimeVarName='Civ1_Time'; … … 3072 3089 ParamIn.vector_x='Civ2_U_smooth'; 3073 3090 ParamIn.vector_y='Civ2_V_smooth'; 3091 ParamIn.vec_color='Civ2_C'; 3074 3092 end 3075 3093 end
Note: See TracChangeset
for help on using the changeset viewer.