Changeset 672
- Timestamp:
- Aug 6, 2013, 3:47:07 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_imadoc.m
r507 r672 10 10 % RootPath,SubDir,RootFile,FileExt, as given from the input file name by fileparts_uvmat 11 11 function XmlFileName=find_imadoc(RootPath,SubDir,RootFile,FileExt) 12 SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 13 XmlFileName=[fullfile(RootPath,SubDirBase) '.xml'];%new convention: xml at the level of the image folder 12 SubDirBase=SubDir; 13 XmlFileName=fullfile(RootPath,[SubDir '.xml']); 14 if ~exist (XmlFileName,'file') 15 dotchar=regexp(SubDir,'\.'); 16 for idot=1:numel(dotchar) 17 XmlFileName=fullfile(RootPath,[SubDir(1:dotchar(end-idot+1)) '.xml']); 18 if exist(XmlFileName,'file') 19 SubDirBase=fullfile(RootPath,SubDir(1:dotchar(end-idot+1))); 20 break 21 end 22 end 23 end 24 % SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 25 % XmlFileName=[fullfile(RootPath,SubDirBase) '.xml'];%new convention: xml at the level of the image folder 14 26 if ~exist(XmlFileName,'file') 15 27 XmlFileName=[fullfile(RootPath,SubDirBase,RootFile) '.xml']; % old convention: xml inside the image folder, case of images or new civ files -
trunk/src/geometry_calib.m
r671 r672 60 60 'gui_LayoutFcn', [] , ... 61 61 'gui_Callback', []); 62 if nargin && ischar(varargin{1}) %&& ~isempty(regexp(varargin{1},'_Callback','once')) 62 if nargin 63 [pp,ff]=fileparts(which(varargin{1})); % name of the input file 64 if strcmp(ff,mfilename)% if we are activating a sub-function of geometry_calib 65 % ~isempty(regexp(varargin{1},'_Callback','once')) 63 66 gui_State.gui_Callback = str2func(varargin{1}); 67 end 64 68 end 65 69 … … 92 96 set(0,'Unit','pixels') 93 97 ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right 94 FigSize=get(handles.geometry_calib,'Position'); 95 96 Width=FigSize(3);% fig width in points (1/72 inch) 97 Height=FigSize(4); 98 Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40 99 Bottom=ScreenSize(4)-Height-40; %put fig at top right 100 set(handles.geometry_calib,'Position',[Left Bottom Width Height]) 101 102 % %set the position of the interface 103 % if exist('pos','var')&& length(pos)>=4 104 % set(hObject,'Position',pos); 105 % end 98 Left=ScreenSize(3)- 460; %right edge close to the right, with margin=40 (GUI width=420 px) 99 if ScreenSize(4)>880 100 Height=840;%default height of the GUI 101 Bottom=ScreenSize(4)-Height-40; %put fig at top right 102 else 103 Height=ScreenSize(4)-40; 104 Bottom=0; % GUI lies o the screen bottom 105 end 106 set(handles.calib_type,'Position',[1 Height-30 194 30])% rank 1 107 set(handles.APPLY,'Position',[197 Height-30 110 30])% rank 1 108 set(handles.REPLICATE,'Position',[309 Height-30 110 30])% rank 1 109 set(handles.Intrinsic,'Position',[1 Height-30-2-92 418 92])% rank 2 110 set(handles.Extrinsic,'Position',[1 Height-30-4-92-75 418 75])% rank 3 111 set(handles.PointLists,'Position',[1 Height-30-6-92-75-117 418 117]) % rank 4 112 set(handles.CheckEnableMouse,'Position',[3 Height-30-8-92-75-117-30 203 30])% rank 5 113 set(handles.PLOT,'Position',[3 Height-384 120 30])% rank 6 114 set(handles.Copy,'Position',[151 Height-384 120 30])% rank 6 115 set(handles.CLEAR_PTS,'Position',[297 Height-384 120 30])% rank 6 116 set(handles.phys_title,'Position',[38 Height-416 125 20])% rank 7 117 set(handles.CoordUnit,'Position',[151 Height-416 120 30])% rank 7 118 set(handles.px_title,'Position',[272 Height-416 125 20])% rank 7 119 set(handles.ListCoord,'Position',[1 20 418 Height-436])% rank 8 120 set(handles.geometry_calib,'Position',[Left Bottom 420 Height]) 106 121 107 122 %set menu of calibration options … … 150 165 if ~isempty(huvmat) 151 166 handles=guidata(huvmat); 167 set(handles.MenuCalib,'Checked','off') 152 168 hobject=findobj(handles.PlotAxes,'tag','calib_points'); 153 169 if ~isempty(hobject) -
trunk/src/get_field.m
r669 r672 93 93 Field.VarAttribute(numel(Field.VarAttribute)+1:NbVar)=cell(1,NbVar-numel(Field.VarAttribute)); 94 94 end 95 % Field.Display = list of variables and corresponding properties obtained after removal of singletons 95 96 Field.Display.ListVarName=Field.ListVarName(~Field.Check0D); 96 97 Field.Display.VarAttribute=Field.VarAttribute(~Field.Check0D); … … 137 138 set(handles.vector_x,'String',Field.Display.ListVarName)% fill the menu of x vector components 138 139 set(handles.vector_y,'String',Field.Display.ListVarName)% fill the menu of y vector components 139 set(handles.vector_z,'String',[{''} Field. ListVarName])% fill the menu of y vector components140 set(handles.vec_color,'String',[{''} Field. ListVarName])% fill the menu of y vector components140 set(handles.vector_z,'String',[{''} Field.Display.ListVarName])% fill the menu of y vector components 141 set(handles.vec_color,'String',[{''} Field.Display.ListVarName])% fill the menu of y vector components 141 142 set(handles.scalar,'Value',1)% fill the menu of y vector components 142 set(handles.scalar,'String',Field. ListVarName)% fill the menu of y vector components143 set(handles.scalar,'String',Field.Display.ListVarName)% fill the menu of y vector components 143 144 set(handles.ordinate,'Value',1)% fill the menu of y vector components 144 set(handles.ordinate,'String',Field. ListVarName)% fill the menu of y vector components145 set(handles.ordinate,'String',Field.Display.ListVarName)% fill the menu of y vector components 145 146 if isfield(Field,'Conventions')&& strcmp(Field.Conventions,'uvmat/civdata') 146 147 set(handles.FieldOption,'String',{'1D plot';'scalar';'vectors';'civdata...'}) 147 148 else 148 149 set(handles.FieldOption,'String',{'1D plot';'scalar';'vectors'}) 149 150 end 150 151 if Field.MaxDim>=2 % case of 2D (or 3D) fields … … 157 158 set(handles.FieldOption,'Value',2) 158 159 end 159 160 160 else % case of 1D fields 161 161 set(handles.FieldOption,'Value',1) … … 182 182 % end 183 183 184 %% Make choices in menus from input 185 % if exist('ParamIn','var')&&~isempty(ParamIn) 186 % fill_GUI(ParamIn,handles.get_field); 187 % end 188 %FieldOption_Callback([],[],handles) 189 184 %% Make choices of coordinates from input 185 if isfield(CellInfo{imax},'CoordIndex') 186 CoordIndex=CellInfo{imax}.CoordIndex; 187 if numel(CoordIndex)==2 188 YName=Field.ListVarName{CoordIndex(1)}; 189 XName=Field.ListVarName{CoordIndex(2)}; 190 ListCoord=get(handles.Coord_x,'String'); 191 XIndex=find(strcmp(XName,ListCoord)); 192 if ~isempty(XIndex) 193 set(handles.Coord_x,'Value',XIndex) 194 end 195 YIndex=find(strcmp(YName,ListCoord)); 196 if ~isempty(YIndex) 197 set(handles.Coord_y,'Value',YIndex) 198 end 199 end 200 end 190 201 191 202 %% put the GUI on the lower right of the sceen … … 218 229 end 219 230 220 221 222 %------------------------------------------------------------------------223 224 231 %------------------------------------------------------------------------ 225 232 % --- Outputs from this function are returned to the command line. 233 %------------------------------------------------------------------------ 226 234 function varargout = get_field_OutputFcn(hObject, eventdata, handles) 227 %------------------------------------------------------------------------ 235 228 236 varargout{1} = handles.output; 229 237 delete(handles.get_field) … … 242 250 end 243 251 244 %--------------------------------------------------------- 252 %------------------------------------------------------------------------ 245 253 % --- Executes on button press in OK. 246 254 %------------------------------------------------------------------------ … … 254 262 % ----------------------------------------------------------------------- 255 263 % --- Activated by selection in the list of variables 264 % ---------------------------------------------------------------------- 256 265 function variables_Callback(hObject, eventdata, handles) 257 % ----------------------------------------------------------------------- 266 258 267 Tabchar={''};%default 259 268 Tabcell=[]; … … 263 272 264 273 %% list global TimeAttribute names and values if index=1 (blank TimeVariable display) is selected 265 if isequal(index,1) 274 if isequal(index,1) 266 275 set(handles.attributes_txt,'String','global attributes') 267 276 if isfield(Field,'ListGlobalAttribute') && ~isempty(Field.ListGlobalAttribute) 268 277 for iline=1:length(Field.ListGlobalAttribute) 269 Tabcell{iline,1}=Field.ListGlobalAttribute{iline}; 278 Tabcell{iline,1}=Field.ListGlobalAttribute{iline}; 270 279 if isfield(Field, Field.ListGlobalAttribute{iline}) 271 280 val=Field.(Field.ListGlobalAttribute{iline}); … … 279 288 Tabchar=cell2tab(Tabcell,'='); 280 289 end 281 %% list Attribute names and values associated to the Variable # index-1 290 %% list Attribute names and values associated to the Variable # index-1 282 291 else 283 292 list_var=get(handles.variables,'String'); … … 285 294 set(handles.attributes_txt,'String', ['attributes of ' var_select]) 286 295 if isfield(Field,'VarAttribute')&& length(Field.VarAttribute)>=index-1 287 % nbline=0;296 % nbline=0; 288 297 VarAttr=Field.VarAttribute{index-1}; 289 298 if isstruct(VarAttr) … … 291 300 for iline=1:length(attr_list) 292 301 Tabcell{iline,1}=attr_list{iline}; 293 eval(['val=VarAttr.' attr_list{iline} ';']) 302 eval(['val=VarAttr.' attr_list{iline} ';']) 294 303 if ischar(val); 295 304 Tabcell{iline,2}=val; 296 305 else 297 306 Tabcell{iline,2}=num2str(val); 298 307 end 299 308 end 300 309 end 301 310 end 302 311 303 312 end 304 313 if ~isempty(Tabcell) 305 314 Tabchar=cell2tab(Tabcell,'='); 306 % Tabchar=[{''};Tabchar];315 % Tabchar=[{''};Tabchar]; 307 316 end 308 317 set(handles.attributes,'Value',1);% select the first item … … 319 328 if ischar(DimCell) 320 329 DimCell={DimCell}; 321 end 330 end 322 331 dim_indices=[]; 323 332 for idim=1:length(DimCell) 324 dim_index=strcmp(DimCell{idim},Field.ListDimName);%vector with size of Field.ListDimName, =0 333 dim_index=strcmp(DimCell{idim},Field.ListDimName);%vector with size of Field.ListDimName, =0 325 334 dim_index=find(dim_index,1); 326 335 dim_indices=[dim_indices dim_index]; … … 335 344 Tabchar=[{''} ;Tabchar]; 336 345 set(handles.dimensions,'Value',1) 337 set(handles.dimensions,'String',Tabchar) 338 end 346 set(handles.dimensions,'String',Tabchar) 347 end 339 348 340 349 %------------------------------------------------------------------------ … … 343 352 function FieldOption_Callback(hObject, eventdata, handles) 344 353 354 Field=get(handles.get_field,'UserData'); 345 355 FieldList=get(handles.FieldOption,'String'); 346 356 FieldOption=FieldList{get(handles.FieldOption,'Value')}; 347 357 switch FieldOption 358 348 359 case '1D plot' 349 360 set(handles.Coordinates,'Visible','on') … … 361 372 set(handles.Z_title,'Visible','off') 362 373 ordinate_Callback(hObject, eventdata, handles) 374 363 375 case 'scalar' 364 376 set(handles.Coordinates,'Visible','on') … … 373 385 set(handles.Coord_y,'Visible','on') 374 386 set(handles.Y_title,'Visible','on') 387 %default scalar selection 388 test_coord=zeros(size(Field.Display.VarDimName)); %=1 when variable #ilist is eligible as structured coordiante 389 for ilist=1:numel(Field.Display.VarDimName) 390 if isfield(Field.Display,'VarAttribute') && numel(Field.Display.VarAttribute)>=ilist && isfield(Field.Display.VarAttribute{ilist},'Role') 391 Role=Field.Display.VarAttribute{ilist}.Role; 392 if strcmp(Role,'coord_x')||strcmp(Role,'coord_y') 393 test_coord(ilist)=1; 394 end 395 end 396 dimnames=Field.Display.VarDimName{ilist}; %list of dimensions for variable #ilist 397 if numel(dimnames)==1 && strcmp(dimnames{1},Field.Display.ListVarName{ilist})%dimension variable 398 test_coord(ilist)=1; 399 end 400 end 401 scalar_index=find(~test_coord,1);%get the first variable not a coordiante 402 if isempty(scalar_index) 403 set(handles.scalar,'Value',1) 404 else 405 set(handles.scalar,'Value',scalar_index) 406 end 375 407 scalar_Callback(hObject, eventdata, handles) 408 376 409 case 'vectors' 377 410 set(handles.Coordinates,'Visible','on') … … 385 418 set(handles.PanelVectors,'Position',pos) 386 419 set(handles.Coord_y,'Visible','on') 387 set(handles.Y_title,'Visible','on') 420 set(handles.Y_title,'Visible','on') 421 %default vector selection 422 test_coord=zeros(size(Field.Display.VarDimName)); %=1 when variable #ilist is eligible as structured coordiante 423 for ilist=1:numel(Field.Display.VarDimName) 424 if isfield(Field.Display,'VarAttribute') && numel(Field.Display.VarAttribute)>=ilist && isfield(Field.Display.VarAttribute{ilist},'Role') 425 Role=Field.Display.VarAttribute{ilist}.Role; 426 if strcmp(Role,'coord_x')||strcmp(Role,'coord_y') 427 test_coord(ilist)=1; 428 end 429 end 430 dimnames=Field.Display.VarDimName{ilist}; %list of dimensions for variable #ilist 431 if numel(dimnames)==1 && strcmp(dimnames{1},Field.Display.ListVarName{ilist})%dimension variable 432 test_coord(ilist)=1; 433 end 434 end 435 vector_index=find(~test_coord,2);%get the first variable not a coordiante 436 if isempty(vector_index) 437 set(handles.vector_x,'Value',1) 438 set(handles.vector_y,'Value',2) 439 else 440 set(handles.vector_x,'Value',vector_index(1)) 441 set(handles.vector_y,'Value',vector_index(2)) 442 end 388 443 vector_Callback(handles) 444 389 445 case 'civdata...' 390 446 set(handles.PanelOrdinate,'Visible','off') … … 483 539 test_component=zeros(size(Field.Display.VarDimName));%=1 when variable #ilist is eligible as unstructured coordinate 484 540 test_coord=zeros(size(Field.Display.VarDimName)); %=1 when variable #ilist is eligible as structured coordiante 485 ListCoord={''};486 541 dim_var=Field.Display.VarDimName{scalar_index};%list of dimensions of the selected variable 487 488 542 for ilist=1:numel(Field.Display.VarDimName) 489 543 dimnames=Field.Display.VarDimName{ilist}; %list of dimensions for variable #ilist … … 494 548 end 495 549 end 496 var_component=find(test_component);% list of variable indices elligible as unstructured coordi antes550 var_component=find(test_component);% list of variable indices elligible as unstructured coordinates 497 551 var_coord=find(test_coord);% % list of variable indices elligible as structured coordinates 498 552 ListCoord=Field.Display.ListVarName([var_component var_coord]); … … 502 556 set(handles.SwitchVarIndexTime,'Value',3)% the last dim must be considered as time 503 557 end 504 if numel(var_component)<2 505 if numel(test_coord)<2 506 ListCoord={''}; 558 % if numel(var_component)<2 559 % if numel(test_coord)<2 560 % ListCoord={''}; 561 % else 562 % set(handles.Coord_x,'Value',2) 563 % set(handles.Coord_y,'Value',1) 564 % end 565 % else 566 coord_val=[0 0]; 567 % look for labelled unstructured coordinates 568 for ilist=1:numel(var_component) 569 ivar=var_component(ilist); 570 if isfield(Field.Display,'VarAttribute') && numel(Field.Display.VarAttribute)>=ivar && isfield(Field.Display.VarAttribute{ivar},'Role') 571 Role=Field.Display.VarAttribute{ivar}.Role; 572 if strcmp(Role,'coord_x') 573 coord_val(1)=ilist; 574 elseif strcmp(Role,'coord_y') 575 coord_val(2)=ilist; 576 end 577 end 578 end 579 if numel(find(coord_val))<2 580 if numel(var_coord)>=2 581 coord_val=[numel(var_component)+2 numel(var_component)+1]; 507 582 else 508 set(handles.Coord_x,'Value',2) 509 set(handles.Coord_y,'Value',1) 510 end 511 else 512 coord_val=[1 2]; 513 for ilist=1:numel(var_component) 514 ivar=var_component(ilist); 515 if isfield(Field.Display,'VarAttribute') && numel(Field.Display.VarAttribute)>=ivar && isfield(Field.Display.VarAttribute{ivar},'Role') 516 Role=Field.Display.VarAttribute{ivar}.Role; 517 if strcmp(Role,'coord_x') 518 coord_val(1)=ilist; 519 elseif strcmp(Role,'coord_y') 520 coord_val(2)=ilist; 521 end 522 end 523 end 524 set(handles.Coord_x,'Value',coord_val(1)) 525 set(handles.Coord_y,'Value',coord_val(2)) 526 end 527 583 coord_val=[1 2]; 584 end 585 end 586 set(handles.Coord_x,'Value',coord_val(1)) 587 set(handles.Coord_y,'Value',coord_val(2)) 528 588 set(handles.Coord_y,'String',ListCoord) 529 589 set(handles.Coord_x,'String',ListCoord) … … 559 619 %------------------------------------------------------------------------ 560 620 % --- Executes on selection change in vector_x. 621 %------------------------------------------------------------------------ 561 622 function vector_x_Callback(hObject, eventdata, handles) 562 %------------------------------------------------------------------------ 623 563 624 vector_x_menu=get(handles.vector_x,'String'); 564 625 vector_x_index=get(handles.vector_x,'Value'); … … 617 678 check_consistent=0; 618 679 end 680 % the two vector components have consistent dimensions 619 681 if check_consistent 620 682 for ilist=1:numel(Field.Display.VarDimName) … … 642 704 end 643 705 else 644 coord_val=[ 1 2];706 coord_val=[0 0]; 645 707 for ilist=1:numel(var_component) 646 708 ivar=var_component(ilist); … … 654 716 end 655 717 end 718 if isempty(coord_val) 719 coord_val=var_coord;% case of dimension coordinates 720 end 721 if numel(find(coord_val))<2 722 coord_val=[numel(var_component)+2 numel(var_component)+1]; 723 end 656 724 set(handles.Coord_x,'Value',coord_val(1)) 657 725 set(handles.Coord_y,'Value',coord_val(2)) … … 691 759 %------------------------------------------------------------------------ 692 760 % --- Executes on selection change in Coord_x. 761 %------------------------------------------------------------------------ 693 762 function Coord_x_Callback(hObject, eventdata, handles) 694 %------------------------------------------------------------------------ 763 695 764 index=get(handles.Coord_x,'Value'); 696 765 string=get(handles.Coord_x,'String'); … … 700 769 %------------------------------------------------------------------------ 701 770 % --- Executes on selection change in Coord_y. 771 %------------------------------------------------------------------------ 702 772 function Coord_y_Callback(hObject, eventdata, handles) 703 %------------------------------------------------------------------------ 773 704 774 index=get(handles.Coord_y,'Value'); 705 775 string=get(handles.Coord_y,'String'); … … 709 779 %------------------------------------------------------------------------ 710 780 % --- Executes on selection change in Coord_z. 781 %------------------------------------------------------------------------ 711 782 function Coord_z_Callback(hObject, eventdata, handles) 712 %------------------------------------------------------------------------ 783 713 784 index=get(handles.Coord_z,'Value'); 714 785 string=get(handles.Coord_z,'String'); … … 720 791 %------------------------------------------------------------------------ 721 792 function SwitchVarIndexTime_Callback(hObject, eventdata, handles) 793 722 794 Field=get(handles.get_field,'UserData'); 723 795 menu=get(handles.SwitchVarIndexTime,'String'); … … 781 853 end 782 854 783 %------------------------------------------------- 784 % give index numbers of the strings str in the list ListvarName 855 %------------------------------------------------------------------------ 856 % --- give index numbers of the strings str in the list ListvarName 857 % ----------------------------------------------------------------------- 785 858 function VarIndex_y=name2index(cell_str,ListVarName) 859 786 860 VarIndex_y=[]; 787 861 if ischar(cell_str) -
trunk/src/mask_proj.m
r667 r672 35 35 for icell=1:numel(CellInfo) 36 36 if NbDimArray(icell)==2 37 XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)}; 38 YName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)}; 39 if isfield(CellInfo{icell},'VarIndex_errorflag') 40 FFName=FieldData.ListVarName{CellInfo{icell}.VarIndex_errorflag}; 41 else 42 FFName='FF';%default error (mask) flag name (if not already used) 43 if isfield(FieldData,'FF') 44 ind=1; 45 while isfield(FieldData,['FF_' num2str(ind)]) 46 ind=ind+1; 47 end 48 FFName=['FF_' num2str(ind)];% append an index to the name of error flag, FF_1,FF_2... 49 end 50 ProjData.ListVarName=[FieldData.ListVarName {FFName}]; 51 ProjData.VarDimName=[FieldData.VarDimName FieldData.VarDimName(CellInfo{icell}.CoordIndex(1))]; 52 ProjData.VarAttribute{numel(FieldData.VarDimName)}.Role='errorflag'; 53 end 37 54 switch CellInfo{icell}.CoordType; 38 case 'scattered' 39 XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)}; 40 YName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)}; 55 case 'scattered' 41 56 mask_ind_i=round(0.5+(FieldData.(XName)-MaskData.AX(1))/DX);%nbpoint terms 42 57 mask_ind_j=round(0.5+(FieldData.(YName)-MaskData.AY(1))/DY);%nbpoint terms … … 46 61 MaskData.A=reshape(MaskData.A,1,[]); 47 62 checkfalse(MaskData.A(checkin)>200)=0; 48 if ~isfield(FieldData,'FF')49 FieldData.FF=zeros(size(FieldData.(XName)));50 FieldData.ListVarName=[FieldData.ListVarName {'FF'}];51 FieldData.VarDimName=[FieldData.VarDimName FieldData.VarDimName(CellInfo{icell}.CoordIndex(1))];52 FieldData.VarAttribute{numel(FieldData.VarDimName)}.Role='errorflag';53 end54 63 for ivar=1:numel(CellInfo{icell}.VarIndex) 55 64 VarName=FieldData.ListVarName{CellInfo{icell}.VarIndex(ivar)}; 56 FieldData.(VarName)(checkfalse)=0; 57 FieldData.FF(checkfalse)=1; 65 ProjData.(VarName)(checkfalse)=0; 58 66 end 67 if ~isfield(CellInfo{icell},'VarIndex_errorflag')% an error flag already exists in the current cell 68 ProjData.(FFName)=zeros(size(ProjData.(VarName))); 69 end 70 ProjData.(FFName)(checkfalse)=1; 59 71 case 'grid' 60 XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)};61 YName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)};62 72 Var1Name=FieldData.ListVarName{CellInfo{icell}.VarIndex(1)}; 63 73 [Npy_field,Npx_field]=size(FieldData.(Var1Name)); … … 70 80 [XMask,YMask]=meshgrid(XMask,YMask); 71 81 Mask = interp2(XMask,YMask,MaskData.A,XArray,YArray','nearest'); 72 % figure(1) 73 % image(MaskData.A) 74 Mask=Mask>200; 75 if ~isfield(FieldData,'FF') 76 FieldData.FF=zeros(size(FieldData.(XName))); 77 FieldData.ListVarName=[FieldData.ListVarName {'FF'}]; 78 FieldData.VarDimName=[FieldData.VarDimName FieldData.VarDimName(CellInfo{icell}.CoordIndex(1))]; 79 FieldData.VarAttribute{numel(FieldData.VarDimName)}.Role='errorflag'; 80 end 82 Mask=Mask>200; 81 83 for ivar=1:numel(CellInfo{icell}.VarIndex) 82 84 VarName=FieldData.ListVarName{CellInfo{icell}.VarIndex(ivar)}; 83 FieldData.(VarName)=FieldData.(VarName).*Mask; 84 FieldData.FF=~Mask; 85 if ~strcmp(VarName,FFName) 86 ProjData.(VarName)=FieldData.(VarName).*Mask; 87 end 88 end 89 if isfield(CellInfo{icell},'VarIndex_errorflag')% an error flag already exists in the current cell 90 ProjData.(FFName)=FieldData.(FFName) | ~Mask; 91 else 92 ProjData.(FFName)= ~Mask; 85 93 end 86 94 end 87 95 end 88 96 end 89 90 97 98 -
trunk/src/proj_field.m
r655 r672 1012 1012 else 1013 1013 %% case of a grid requested by the input field 1014 1015 1014 for icell=1:numel(CellInfo)% TODO: recalculate coordinates here to get the bounds in the rotated coordinates 1016 1015 if isfield(CellInfo{icell},'ProjModeRequest') … … 1545 1544 test_interp_tps=0; 1546 1545 end 1547 % ProjData.coord_y=[YMin YMax];%note that if projection is done on a grid, the Min and Max along each direction must have been defined1548 % ProjData.coord_x=[XMin XMax];1549 1546 coord_x_proj=XMin:DX:XMax; 1550 1547 coord_y_proj=YMin:DY:YMax; … … 1552 1549 XI=ObjectData.Coord(1,1)+(X)*cos(PlaneAngle(3))-YI*sin(PlaneAngle(3));%corresponding coordinates in the original system 1553 1550 YI=ObjectData.Coord(1,2)+(X)*sin(PlaneAngle(3))+YI*cos(PlaneAngle(3)); 1554 [X,Y]=meshgrid(Coord{2},Coord{1});%initial coordiantes 1551 Coord{1}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)}); 1552 Coord{2}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)}); 1553 if numel(Coord{1})==2% x coordiante defiend by its bounds, get the whole set 1554 Coord{1}=linspace(Coord{1}(1),Coord{1}(2),CellInfo{icell}.CoordSize(1)); 1555 end 1556 if numel(Coord{2})==2% y coordiante defiend by its bounds, get the whole set 1557 Coord{2}=linspace(Coord{2}(1),Coord{2}(2),CellInfo{icell}.CoordSize(2)); 1558 end 1559 [X,Y]=meshgrid(Coord{2},Coord{1});%initial coordinates 1560 %name of error flag variable 1561 FFName='FF';%default name (if not already used) 1562 if isfield(ProjData,'FF') 1563 ind=1; 1564 while isfield(ProjData,['FF_' num2str(ind)]) 1565 ind=ind+1; 1566 end 1567 FFName=['FF_' num2str(ind)];% append an index to the name of error flag, FF_1,FF_2... 1568 end 1569 % project all variables in the cell 1555 1570 for ivar=VarIndex 1556 1571 VarName=FieldData.ListVarName{ivar}; 1557 % if test_interp(1) || test_interp(2)%interpolate on a regular grid1558 1572 if size(FieldData.(VarName),3)==1 1559 1573 ProjData.(VarName)=interp2(X,Y,double(FieldData.(VarName)),XI,YI,'*linear'); 1560 1574 else 1561 1575 ProjData.(VarName)=interp2(X,Y,double(FieldData.(VarName)(:,:,1)),XI,YI,'*linear'); 1562 for icolor=2:size(FieldData.(VarName),3) 1576 for icolor=2:size(FieldData.(VarName),3)% project 'color' components 1563 1577 ProjData.(VarName)=cat(3,ProjData.(VarName),interp2(X,Y,double(FieldData.(VarName)(:,:,icolor)),XI,YI,'*linear')); %TO TEST 1564 1578 end … … 1570 1584 VarAttribute{length(ListVarName)+nbcoord}=FieldData.VarAttribute{ivar}; 1571 1585 end; 1572 end 1586 ProjData.(FFName)=isnan(ProjData.(VarName));%detact NaN (points outside the interpolation range) 1587 ProjData.(VarName)(ProjData.(FFName))=0; %set to 0 the NaN data 1588 end 1589 %update list of variables with error flag 1590 ListVarName=[ListVarName FFName]; 1591 VarDimName=[VarDimName {DimCell}]; 1592 VarAttribute{numel(ListVarName)}.Role='errorflag'; 1573 1593 elseif ~testangle 1574 1594 % unstructured z coordinate -
trunk/src/series.m
r669 r672 243 243 %% introduce the input file name(s) if defined from input Param 244 244 if isfield(Param,'FileName') 245 InputTable={'','','','',''}; % refresh the file input table 245 %InputTable={'','','','',''}; % refresh the file input table 246 InputTable={} 246 247 set(handles.InputTable,'Data',InputTable) 247 248 if isfield(Param,'FileName_1') … … 584 585 SeriesData=get(handles.series,'UserData'); 585 586 if strcmp(iview,'append') % display the input data as a new line in the table 586 iview=size(InputTable,1) ;% the next line in InputTable becomes the current line587 InputTable(iview+1,:)={'','','','',''};587 iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line 588 %InputTable(iview+1,:)={'','','','',''}; 588 589 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 589 590 elseif strcmp(iview,'one') % refresh the list of input file series 590 591 iview=1; %the first line in InputTable becomes the current line 591 InputTable=[{'','','','',''};{'','','','',''}]; 592 InputTable={'','','','',''}; 593 %InputTable=[{'','','','',''};{'','','','',''}]; 592 594 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 593 595 set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}]) … … 607 609 SeriesData.Time={}; 608 610 end 609 nbview=size(InputTable,1)-1;% rmq: the last line is set blank to allow manual addition of a line 611 %nbview=size(InputTable,1)-1;% rmq: the last line is set blank to allow manual addition of a line 612 nbview=size(InputTable,1); 610 613 set(handles.ListView,'String',mat2cell((1:nbview)',ones(nbview,1))) 611 614 set(handles.ListView,'Value',iview) … … 2156 2159 set(handles.OutputDirExt,'String',ParamOut.OutputDirExt) 2157 2160 OutputDirVisible='on'; 2158 SubDir=InputTable(1:end -1,2); %set of subdirectories sorted in alphabetical order2161 SubDir=InputTable(1:end,2); %set of subdirectories sorted in alphabetical order 2159 2162 SubDirOut=SubDir{1}; 2160 2163 if numel(SubDir)>1 … … 2485 2488 nbview=size(InputTable,1); 2486 2489 % MaskTable=cell(nbview,1); 2490 MaskTable=cell(nbview,1);%default 2491 ListMask=cell(nbview,1);%default 2487 2492 for iview=1:nbview 2493 ListMask{iview,1}=num2str(iview); 2488 2494 RootPath=InputTable{iview,1}; 2489 2495 if ~isempty(RootPath) … … 2500 2506 end 2501 2507 end 2502 nbview=size(MaskTable,1);2508 %nbview=size(MaskTable,1); 2503 2509 set(handles.MaskTable,'Data',MaskTable) 2504 2510 % set(handles.MaskTable,'ColumnFormat',{MaskTable'}) … … 2507 2513 set(handles.ListMask,'Visible','on') 2508 2514 set(handles.ListMask,'String',ListMask) 2509 set(handles.ListMask,'Value', numel(ListMask))2515 set(handles.ListMask,'Value',1) 2510 2516 else 2511 2517 set(handles.MaskTable,'Visible','off') -
trunk/src/uvmat.m
r671 r672 191 191 set(hObject,'Position',[LeftX LowY Width Height]) 192 192 UvData.OpenParam.PosColorbar=[0.80 0.02 0.018 0.445]; 193 UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib (TO IMPROVE) 193 % UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib 194 194 AxeData.LimEditBox=1; %initialise AxeData 195 195 set(handles.PlotAxes,'UserData',AxeData) … … 558 558 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1}); 559 559 hdir=dir(DirName); %list files and dirs 560 FileName=''; 560 561 for ilist=1:numel(hdir) 561 562 if ~isequal(hdir(ilist).isdir,1)%look for files, not dir … … 568 569 end 569 570 end 571 if isempty(FileName) 572 msgbox_uvmat('ERROR','no valid input file in the selected directory') 573 else 570 574 display_file_name(handles,fullfile(DirName,FileName)) 575 end 571 576 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0]) 572 577
Note: See TracChangeset
for help on using the changeset viewer.