Changeset 580
- Timestamp:
- Mar 7, 2013, 1:47:51 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r575 r580 1 %'calc_field': defines fields (velocity, vort, div...) from civx data (old conventions) and calculate them. 1 %'calc_field': defines fields (velocity, vort, div...) OBSOLETE: fusionner 2 %avec calc_field_interp et calc_field_tps 2 3 %--------------------------------------------------------------------- 3 4 % [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp) … … 44 45 'U';... %u velocity component 45 46 'V';... %v velocity component 46 ' w';... %w velocity component47 ' w_normal';... %w velocity component normal to the plane47 'W';... %w velocity component 48 'W_normal';... %w velocity component normal to the plane 48 49 'error'}; %error associated to a vector (for stereo or patch) 49 50 ColorList={'C';...%image correlation corresponding to a vel vector -
trunk/src/find_field_cells.m
r576 r580 205 205 VarDimName=Data.VarDimName(~check_select);%dimensions of remaining variables 206 206 check_coord_select= cellfun(@numel,VarDimName)==1|cellfun(@ischar,VarDimName)==1;% find remaining variables with a single dimension 207 check_coord(~check_select)=check_coord_select;208 ListCoordIndex=ivar_remain(check_coord );% indices of remaining variables with a single dimension209 ListCoordName= Data.ListVarName(ListCoordIndex);% corresponding names of remaining variables with a single dimension210 ListDimName= Data.VarDimName(ListCoordIndex);% dimension names of remaining variables with a single dimension207 %check_coord(~check_select)=check_coord_select; 208 ListCoordIndex=ivar_remain(check_coord_select);% indices of remaining variables with a single dimension 209 ListCoordName=ListVarName(check_coord_select);% corresponding names of remaining variables with a single dimension 210 ListDimName=VarDimName(check_coord_select);% dimension names of remaining variables with a single dimension 211 211 212 212 %remove redondant variables -> keep only one variable per dimension … … 222 222 end 223 223 end 224 ListCoordIndex=ListCoordIndex(check_ keep);% list of coordinate variable indices224 ListCoordIndex=ListCoordIndex(check_coord_select);% list of coordinate variable indices 225 225 ListCoordName=ListCoordName(check_keep);% list of coordinate variable names 226 226 ListDimName=ListDimName(check_keep);% list of coordinate dimension names -
trunk/src/read_civdata.m
r576 r580 2 2 %------------------------------------------------------------------ 3 3 % 4 % function [Field,VelTypeOut]=read_civ xdata(filename,FieldNames,VelType)4 % function [Field,VelTypeOut]=read_civdata(filename,FieldNames,VelType) 5 5 % 6 6 % OUTPUT: … … 26 26 % .FF: error flag, =0 for good vectors 27 27 % .C: scalar associated with velocity (used for vector colors) 28 % .DijU; matrix of spatial derivatives (DijU(1,1,:)=DUDX,29 % DijU(1,2,:)=DUDY, Dij(2,1,:)=DVDX, DijU(2,2,:)=DVDY30 28 % 31 29 % VelTypeOut: velocity type corresponding to the selected field: ='civ1','interp1','interp2','civ2'.... -
trunk/src/read_field.m
r576 r580 7 7 % ParamOut: structure representing parameters: 8 8 % .FieldName; field name 9 % .FieldList: menu of possible fields10 9 % .VelType 11 10 % .CivStage: stage of civx processing (=0, not Civx, =1 (civ1), =2 (fix1).... … … 131 130 if ~isempty(A) 132 131 if isstruct(ParamOut) 133 ParamOut.FieldName='image'; 134 ParamOut.FieldList={'image'}; 132 ParamOut.FieldName='image'; 135 133 end 136 134 Npz=1;%default 137 135 npxy=size(A); 138 % Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers139 % Rangy=[npxy(1)-0.5 0.5]; %136 % Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 137 % Rangy=[npxy(1)-0.5 0.5]; % 140 138 Field.NbDim=2;%default 141 139 Field.AName='image'; … … 147 145 Field.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 148 146 if isstruct(ParamOut) 149 ParamOut.Npx=npxy(2);% display image size on the interface150 ParamOut.Npy=npxy(1);147 ParamOut.Npx=npxy(2);% display image size on the interface 148 ParamOut.Npy=npxy(1); 151 149 end 152 150 Field.VarAttribute{3}.Mesh=1; … … 159 157 Field.AX=[0.5 npxy(3)-0.5]; % coordinates of the first and last pixel centers 160 158 if isstruct(ParamOut) 161 ParamOut.Npx=npxy(3);% display image size on the interface162 ParamOut.Npy=npxy(2);163 159 ParamOut.Npx=npxy(3);% display image size on the interface 160 ParamOut.Npy=npxy(2); 161 end 164 162 Field.VarAttribute{4}.Mesh=1; 165 163 end -
trunk/src/sub_field.m
r548 r580 105 105 end 106 106 107 % look for coordinates common to Field in Field_1107 %% look for coordinates common to Field in Field_1 108 108 ind_remove=zeros(size(Field_1.ListVarName)); 109 109 for ilist=1:numel(Field_1.ListVarName) … … 121 121 NewDim={NewDim}; 122 122 end 123 Field_1.VarDimName=regexprep_r(Field_1.VarDimName, OldDim{1},NewDim{1});123 Field_1.VarDimName=regexprep_r(Field_1.VarDimName,['^' OldDim{1} '$'],NewDim{1}); 124 124 end 125 125 end … … 130 130 Field_1.VarAttribute(find(ind_remove))=[]; 131 131 132 % append the other variables of the second field, modifying their name if needed132 %% append the other variables of the second field, modifying their name if needed 133 133 for ilist=1:numel(Field_1.ListVarName) 134 134 VarName=Field_1.ListVarName{ilist}; … … 138 138 else % variable name exists in Field 139 139 VarNameNew=[VarName '_1']; 140 if isfield(Field_1.VarAttribute{ilist},'FieldName') 141 Field_1.VarAttribute{ilist}.FieldName=regexprep_r(Field_1.VarAttribute{ilist}.FieldName,VarName,VarNameNew); 142 end 140 143 end 141 144 SubData.ListVarName=[SubData.ListVarName {VarNameNew}]; … … 146 149 end 147 150 148 %append the other variables of the second field, modifying their name if needed149 150 151 %% substrat fields when possible 151 152 %[CellVarIndex,NbDim,CellVarType,errormsg]=find_field_cells(SubData); 152 [CellInfo,NbDim,errormsg]=find_field_cells(SubData) 153 [CellInfo,NbDim,errormsg]=find_field_cells(SubData); 153 154 ind_remove=zeros(size(SubData.ListVarName)); 154 155 ivar=[]; … … 179 180 SubData.VarDimName(find(ind_remove))=[]; 180 181 SubData.VarAttribute(find(ind_remove))=[]; 182 %end 181 183 182 function OutputCell=regexprep_r(InputCell, dimname,dimname_new)184 function OutputCell=regexprep_r(InputCell,search_string,new_string) 183 185 for icell=1:numel(InputCell) 184 OutputCell{icell}=regexprep(InputCell{icell}, ['^' dimname '$'],dimname_new);186 OutputCell{icell}=regexprep(InputCell{icell},search_string,new_string); 185 187 end 186 188 -
trunk/src/uvmat.m
r579 r580 1025 1025 set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 1026 1026 set(handles_Fields,'Value',2) % set menu to 'velocity 1027 if index==1 1028 set(handles.FieldName_1,'Value',1); 1029 set(handles.FieldName_1,'String',[{''};{'image'};FieldList;{'get_field...'}]);%standard menu for civx data reproduced for the second field 1030 end 1027 1031 set(handles.ColorScalar,'Value',1) 1028 1032 set(handles.ColorScalar,'String',ColorList) … … 2138 2142 return 2139 2143 end 2140 Name=FileName_1;2144 % Name=FileName_1; 2141 2145 switch UvData.FileType{2} 2142 2146 case {'civx','civdata','netcdf'}; … … 2188 2192 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 2189 2193 if ~isequal(NomType_1,'*')&& isfield(UvData,'FileName_1') 2190 test_keepdata_1= strcmp(FileName_1,UvData.FileName_1) ; %&& strcmp(FieldName_1,UvData.FieldName_1);2194 test_keepdata_1= strcmp(FileName_1,UvData.FileName_1) ; 2191 2195 end 2192 2196 if test_keepdata_1 … … 2199 2203 ParamIn_1.GUIName='get_field_1'; 2200 2204 end 2201 [Field{2},ParamOut_1,errormsg] = read_field( Name,UvData.FileType{2},ParamIn_1,frame_index_1);2205 [Field{2},ParamOut_1,errormsg] = read_field(FileName_1,UvData.FileType{2},ParamIn_1,frame_index_1); 2202 2206 if ~isempty(errormsg) 2203 2207 errormsg=['error in reading ' FieldName_1 ' in ' FileName_1 ': ' errormsg]; … … 2256 2260 test_veltype_1=0; 2257 2261 if isempty(FileName_1) 2258 % set(handles.FieldName_1,'Value',1); %update the field menu2259 % if isstruct(ParamOut)2260 % set(handles.FieldName_1,'String',[{''};ParamOut.FieldList]); %update the field menu2261 % end2262 % set(handles.FieldName_1,'Value',1); %update the field menu 2263 % if isstruct(ParamOut) 2264 % set(handles.FieldName_1,'String',[{''};ParamOut.FieldList]); %update the field menu 2265 % end 2262 2266 elseif ~test_keepdata_1 2263 2267 if (~strcmp(UvData.FileType{2},'netcdf')&&~strcmp(UvData.FileType{2},'civdata')&&~strcmp(UvData.FileType{2},'civx'))|| isequal(FieldName_1,'get_field...') … … 2273 2277 % update the second field menu: the same quantity 2274 2278 if isstruct(ParamOut_1) 2275 set(handles.FieldName_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu 2276 % display the FieldName menu from the input file and pick the selected one: 2277 field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList); 2278 set(handles.FieldName_1,'Value',find(field_index,1)+1) 2279 end 2280 2279 % set(handles.FieldName_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu 2280 % display the FieldName menu from the input file and pick the selected one: 2281 FieldList=get(handles.FieldName_1,'String'); 2282 field_index=strcmp(ParamOut_1.FieldName,FieldList); 2283 if ~isempty(field_index) 2284 set(handles.FieldName_1,'Value',find(field_index,1)) 2285 end 2286 end 2281 2287 end 2282 2288 if test_veltype||test_veltype_1 2283 2289 set(handles.FixVelType,'Visible','on') 2284 2290 else 2285 2291 set(handles.FixVelType,'Visible','off') 2286 2292 end 2287 2293 … … 2963 2969 set(handles.VelType_1,'Value',1);%set to blank state 2964 2970 set(handles.num_Opacity,'String','')% desactivate opacity setting 2971 FieldList=get(handles.FieldName,'String'); 2972 if numel(FieldList)>1 % if a choice of fields exists 2973 set(handles.FieldName_1,'Value',1)% set second field choice to blank 2974 set(handles.FieldName_1,'String',[{''};FieldList])% reproduce the menu FieldName plus a blank option 2975 else 2976 set(handles.FieldName_1,'String',{''})% set second field choice to blank 2977 end 2965 2978 if ~strcmp(get(handles.VelType,'Visible'),'on') 2966 2979 set(handles.VelType_1,'Visible','off') … … 3194 3207 end 3195 3208 otherwise 3196 if check_new3197 UvData.FileType{2}=UvData.FileType{1};3209 check_refresh=1; 3210 if check_new% if a second field was not previously entered, we just read another field in the first input file 3198 3211 set(handles.FileIndex_1,'String',get(handles.FileIndex,'String')) 3199 3212 set(handles.FileExt_1,'String',get(handles.FileExt,'String')) 3213 3214 UvData.FileType{2}=UvData.FileType{1}; 3215 UvData.XmlData{2}= UvData.XmlData{1}; 3216 transform=get(handles.path_transform,'UserData'); 3217 if (~isa(transform,'function_handle')||nargin(transform)<3) 3218 set(handles.uvmat,'UserData',UvData) 3219 set(handles.transform_fct,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields 3220 transform_fct_Callback(hObject, eventdata, handles)% activate transform_fct_Callback and refresh current plot 3221 check_refresh=0; 3222 end 3200 3223 end 3201 3224 if ~isequal(field,'image') … … 3205 3228 end 3206 3229 set(handles.uvmat,'UserData',UvData) 3207 if ~(isfield(UvData,'NewSeries')&&isequal(UvData.NewSeries,1)) 3230 3231 if check_refresh && ~(isfield(UvData,'NewSeries')&&isequal(UvData.NewSeries,1)) 3208 3232 run0_Callback(hObject, eventdata, handles) 3209 3233 end … … 3280 3304 FileName_1='';% we plot the first input field without the second field 3281 3305 set(handles.SubField,'Value',0) 3282 SubField_Callback(hObject, eventdata, handles)% activate SubField_Callback and refresh current display, removing the second field3306 SubField_Callback(hObject, eventdata, handles)% activate SubField_Callback and refresh current plot, removing the second field 3283 3307 elseif get(handles.SubField,'Value')% if subfield is already 'on' 3284 3308 FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];% name of the second input file 3285 check_refresh=1;%will refresh the current display3309 check_refresh=1;%will refresh the current plot 3286 3310 else% we introduce the same file (with a different field) for the second series 3287 3311 FileName_1=FileName;% we compare two fields in the same file … … 3291 3315 transform=get(handles.path_transform,'UserData'); 3292 3316 if (~isa(transform,'function_handle')||nargin(transform)<3) 3293 set(handles.transform_fct,'value',2); % set transform to sub_field if the current fct doe not accept two input fields 3294 transform_fct_Callback(hObject, eventdata, handles)% activate transform_fct_Callback and refresh current display 3317 set(handles.uvmat,'UserData',UvData) 3318 set(handles.transform_fct,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields 3319 transform_fct_Callback(hObject, eventdata, handles)% activate transform_fct_Callback and refresh current plot 3295 3320 else 3296 3321 check_refresh=1; … … 3298 3323 end 3299 3324 3300 % refresh the current displayif it has not been done previously3325 % refresh the current plot if it has not been done previously 3301 3326 if check_refresh 3302 3327 UvData.FileName_1='';% desactivate the use of a constant second file … … 3321 3346 end 3322 3347 3323 %----------------------------------------------- 3348 3349 %----------------------------------------------------------------------- 3324 3350 % --- reset civ buttons 3325 3351 function reset_vel_type(handles_civ0,handle1) 3352 %----------------------------------------------------------------------- 3326 3353 for ibutton=1:length(handles_civ0) 3327 3354 set(handles_civ0(ibutton),'BackgroundColor',[0.831 0.816 0.784]) … … 3332 3359 end 3333 3360 3334 %------------------------------------------------------- 3361 %----------------------------------------------------------------------- 3335 3362 % --- Executes on button press in MENUVOLUME. 3336 %-------------------------------------------------------3337 3363 function VOLUME_Callback(hObject, eventdata, handles) 3364 %----------------------------------------------------------------------- 3338 3365 %errordlg('command VOL not implemented yet') 3339 3366 if ishandle(handles.UVMAT_title)
Note: See TracChangeset
for help on using the changeset viewer.