Changeset 526 for trunk/src/uvmat.m


Ignore:
Timestamp:
Aug 20, 2012, 12:32:31 PM (9 years ago)
Author:
sommeria
Message:

bugs corrected; Posiibility of usual 1D plots introduced with the new way of using get_field. time_series and aver_stat updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r525 r526  
    99%INPUT:
    1010% input: input file name (if character chain), or input image matrix to
    11 % visualize, or Matlab structure representing  netcdf fields (with fields
     11% visualize, or Matlab structure representing  netcdf fieldname (with fieldname
    1212% ListVarName....)
    1313%
     
    4242%          .MovieObject: current movie object
    4343%          .TimeUnit: unit for time
    44 %          .XmlData: cell array of 1 or 2 structures representing the xml files associated with the input fields (containing timing  and geometry calibration)
     44%          .XmlData: cell array of 1 or 2 structures representing the xml files associated with the input fieldname (containing timing  and geometry calibration)
    4545%          .Field: cell array of 1 or 2 structures representing the current  input field(s)
    4646%          .PlotAxes: field structure representing the current field plotted  on the main axes  (used for mouse operations)
     
    5454% 2) These functions call 'uvmat/display_file_name.m' which detects the file series, and fills the file index boxes
    5555% 3) Then 'uvmat/update_rootinfo.m' Updates information about a new field series (indices to scan, timing, calibration from an xml file)
    56 % 4) Then fields are opened and visualised by the main sub-function 'uvmat/refresh_field.m'
     56% 4) Then fieldname are opened and visualised by the main sub-function 'uvmat/refresh_field.m'
    5757% The function first reads the name of the input file(s) (one or two) from the edit boxes  of the GUI
    5858% It then reads the input file(s) with the function read_field.m and perform the following list of operations:
     
    6666%                 Field{1}            Field{2}               
    6767%                    |                   |                                 
    68 %                    --->transform fct<---             transform (e.g. phys.m) and combine input fields 
     68%                    --->transform fct<---             transform (e.g. phys.m) and combine input fieldname 
    6969%                            |                                   
    7070%                        (calc_tps.m)               calculate tps coefficients (for filter projection or spatial derivatives).
     
    7777%         UvData.PlotAxes          ViewData.PlotAxes (on view_field)
    7878%              |                          |
    79 %       plot_field.m (uvmat)       plot_field.m (view_field)      plot the projected fields
     79%       plot_field.m (uvmat)       plot_field.m (view_field)      plot the projected fieldname
    8080%
    8181%
     
    200200% set(handles.ListObject_1,'Value',1)% default: empty projection objectproj_field
    201201% set(handles.ListObject_1,'String',{''})
    202 set(handles.Fields,'Value',1)
    203 set(handles.Fields,'string',{''})
     202set(handles.FieldName,'Value',1)
     203set(handles.FieldName,'string',{''})
    204204UvData.Object={[]};
    205205
     
    294294    testinputfield=1;
    295295end
    296 
    297 %% plot input field if exists
    298 % if testinputfield
    299 %     %delete drawn objects
    300 %     hother=findobj(handles.PlotAxes,'Tag','proj_object');%find all the proj objects
    301 %     for iobj=1:length(hother)
    302 %         delete_object(hother(iobj))
    303 %     end 
    304 %     if isempty(inputfile)
    305 %         errormsg=refresh_field(handles,[],[],[],[],[],[],{Field});
    306 %         set(handles.MenuTools,'Enable','on')
    307 %         set(handles.OBJECT_txt,'Visible','on')
    308 %         set(handles.edit_object,'Visible','on')
    309 % %         set(handles.ListObject_1,'Visible','on')
    310 %         set(handles.frame_object,'Visible','on')
    311 %         if ~isempty(errormsg)
    312 %             msgbox_uvmat('ERROR',errormsg)
    313 %         end
    314 %     end
    315 % end
    316296
    317297set_vec_col_bar(handles) %update the display of color code for vectors
     
    530510function SubDir_Callback(hObject, eventdata, handles)
    531511%------------------------------------------------------------------------
    532 %refresh the menu of input fields
     512%refresh the menu of input fieldname
    533513Fields_Callback(hObject, eventdata, handles);
    534514% refresh the current field view
     
    779759if index==1
    780760    handles_RootPath=handles.RootPath;
    781     handles_Fields=handles.Fields;
     761    handles_Fields=handles.FieldName;
    782762elseif index==2
    783763    handles_RootPath=handles.RootPath_1;
    784     handles_Fields=handles.Fields_1;
     764    handles_Fields=handles.FieldName_1;
    785765end
    786766
    787767set(handles_RootPath,'BackgroundColor',[1 1 0])
    788768drawnow
    789 set(handles.Fields,'UserData',[])% reinialize data from uvmat opening
     769set(handles.FieldName,'UserData',[])% reinialize data from uvmat opening
    790770UvData=get(handles.uvmat,'UserData');%huvmat=handles of the uvmat interface
    791771UvData.NewSeries=1; %flag for run0: begin a new series
     
    990970end
    991971
    992 %% set default options in menu 'Fields'
     972%% set default options in menu 'FieldName'
    993973switch FileType
    994974    case {'civx','civdata'}
     
    14261406%------------------------------------------------------------------------
    14271407% --- Executes on button press in runplus: make one step forward and call
    1428 % --- run0. The step forward is along the fields series 1 or 2 depending on
     1408% --- run0. The step forward is along the fieldname series 1 or 2 depending on
    14291409% --- the scan_i and scan_j check box (exclusive each other)
    14301410function runplus_Callback(hObject, eventdata, handles)
     
    14461426%------------------------------------------------------------------------
    14471427% --- Executes on button press in runmin: make one step backward and call
    1448 % --- run0. The step backward is along the fields series 1 or 2 depending on
     1428% --- run0. The step backward is along the fieldname series 1 or 2 depending on
    14491429% --- the scan_i and scan_j check box (exclusive each other)
    14501430function runmin_Callback(hObject, eventdata, handles)
     
    17831763set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow
    17841764drawnow
    1785 list_fields=get(handles.Fields,'String');% list menu fields
    1786 index_fields=get(handles.Fields,'Value');% selected string index
     1765list_fields=get(handles.FieldName,'String');% list menu fields
     1766index_fields=get(handles.FieldName,'Value');% selected string index
    17871767FieldName=list_fields{index_fields}; % selected field
    17881768UvData=get(handles.uvmat,'UserData');
     
    17921772    NomType=get(handles.NomType,'String');
    17931773else
    1794     list_fields=get(handles.Fields_1,'String');% list menu fields
    1795     index_fields=get(handles.Fields_1,'Value');% selected string index
     1774    list_fields=get(handles.FieldName_1,'String');% list menu fields
     1775    index_fields=get(handles.FieldName_1,'Value');% selected string index
    17961776    FieldName=list_fields{index_fields}; % selected field
    17971777    if isequal(FieldName,'image')
     
    20262006ParamIn.ColorVar='';%default variable name for vector color
    20272007frame_index=1;%default
    2028 % if ~isempty(FileName)
    20292008FieldName='';%default
    20302009VelType='';%default
    2031 %     FileType=UvData.FileType{1};
    20322010switch UvData.FileType{1}
    20332011    case {'civx','civdata','netcdf'};
    2034         list_fields=get(handles.Fields,'String');% list menu fields
    2035         FieldName= list_fields{get(handles.Fields,'Value')}; % selected field
     2012        list_fields=get(handles.FieldName,'String');% list menu fields
     2013        FieldName= list_fields{get(handles.FieldName,'Value')}; % selected field
    20362014        if ~strcmp(FieldName,'get_field...')
    20372015            if get(handles.FixVelType,'Value')
     
    20752053    ParamIn.VelType=VelType;
    20762054    XNameMenu=get(handles.Coord_x,'String');
    2077     ParamIn.CoordName=XNameMenu{get(handles.Coord_x,'Value')};
     2055    ParamIn.Coord_x=XNameMenu(get(handles.Coord_x,'Value'));
    20782056    YNameMenu=get(handles.Coord_y,'String');
    2079     ParamIn.CoordName={ParamIn.CoordName, YNameMenu{get(handles.Coord_y,'Value')}};
     2057    ParamIn.Coord_y=YNameMenu(get(handles.Coord_y,'Value'));
    20802058end
    20812059check_tps = 0;         
     
    21152093    switch UvData.FileType{2}
    21162094        case {'civx','civdata','netcdf'};
    2117             list_fields=get(handles.Fields_1,'String');% list menu fields
     2095            list_fields=get(handles.FieldName_1,'String');% list menu fields
    21182096            if ischar(list_fields),list_fields={list_fields};end
    2119             FieldName_1= list_fields{get(handles.Fields_1,'Value')}; % selected field
     2097            FieldName_1= list_fields{get(handles.FieldName_1,'Value')}; % selected field
    21202098            if ~strcmp(FieldName,'get_field...')
    21212099                if get(handles.FixVelType,'Value')
     
    22202198    set(handles.VelType,'Visible','off')
    22212199end
    2222 % display the Fields menu from the input file and pick the selected one:
     2200% display the FieldName menu from the input file and pick the selected one:
    22232201% if isstruct(ParamOut)
    22242202%     field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);
    2225 %     set(handles.Fields,'String',ParamOut.FieldList); %update the field menu
    2226 %     set(handles.Fields,'Value',find(field_index,1))
     2203%     set(handles.FieldName,'String',ParamOut.FieldList); %update the field menu
     2204%     set(handles.FieldName,'Value',find(field_index,1))
    22272205% end
    22282206
     
    22302208test_veltype_1=0;
    22312209if isempty(FileName_1)
    2232 %     set(handles.Fields_1,'Value',1); %update the field menu
     2210%     set(handles.FieldName_1,'Value',1); %update the field menu
    22332211%     if isstruct(ParamOut)
    2234 %     set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu
     2212%     set(handles.FieldName_1,'String',[{''};ParamOut.FieldList]); %update the field menu
    22352213%     end
    22362214elseif ~test_keepdata_1
     
    22472225    % update the second field menu: the same quantity
    22482226    if isstruct(ParamOut_1)
    2249     set(handles.Fields_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu
    2250     % display the Fields menu from the input file and pick the selected one:
     2227    set(handles.FieldName_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu
     2228    % display the FieldName menu from the input file and pick the selected one:
    22512229    field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);
    2252     set(handles.Fields_1,'Value',find(field_index,1)+1) 
     2230    set(handles.FieldName_1,'Value',find(field_index,1)+1) 
    22532231    end
    22542232   
     
    22612239
    22622240% field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);
    2263 % set(handles.Fields,'String',ParamOut.FieldList); %update the field menu
    2264 % set(handles.Fields,'Value',find(field_index,1))
     2241% set(handles.FieldName,'String',ParamOut.FieldList); %update the field menu
     2242% set(handles.FieldName,'Value',find(field_index,1))
    22652243   
    22662244%% introduce w as background image by default for a new series (only for nbdim=2)
     
    22772255        set(handles.FileIndex_1,'String',indices)
    22782256        set(handles.FileExt_1,'String','"');
    2279         set(handles.Fields_1,'Visible','on');
    2280         set(handles.Fields_1,'Visible','on');
     2257        set(handles.FieldName_1,'Visible','on');
     2258        set(handles.FieldName_1,'Visible','on');
    22812259        set(handles.RootPath_1,'Visible','on')
    22822260        set(handles.RootFile_1,'Visible','on')
     
    22842262        set(handles.FileIndex_1,'Visible','on');
    22852263        set(handles.FileExt_1,'Visible','on');
    2286         set(handles.Fields_1,'Visible','on');
     2264        set(handles.FieldName_1,'Visible','on');
    22872265        Field{1}.AName='w';
    22882266end           
     
    23642342
    23652343
    2366 %% store the current open names, fields and vel types in uvmat interface
     2344%% store the current open names, fieldname and vel types in uvmat interface
    23672345UvData.FileName_1=FileName_1;
    23682346UvData.ParamOut_1=ParamOut_1;
     
    25892567    write_plot_param(handles,PlotParamOut) %update the auto plot parameters
    25902568   
    2591 %% 2D or 3D fields are generally projected
     2569%% 2D or 3D fieldname are generally projected
    25922570else
    25932571    set(handles.Objects,'Visible','on')
     
    30102988    set(handles.FileIndex_1,'Visible','off');
    30112989    set(handles.FileExt_1,'Visible','off');
    3012     set(handles.Fields_1,'Value',1);%set to blank state
     2990    set(handles.FieldName_1,'Value',1);%set to blank state
    30132991    set(handles.VelType_1,'Value',1);%set to blank state
    30142992    set(handles.num_Opacity,'String','')% desactivate opacity setting
     
    30763054end
    30773055%------------------------------------------------------------------------
    3078 % --- Executes on menu selection Fields
    3079 function Fields_Callback(hObject, eventdata, handles)
    3080 %------------------------------------------------------------------------
    3081 list_fields=get(handles.Fields,'String');% list menu fields
    3082 index_fields=get(handles.Fields,'Value');% selected string index
     3056% --- Executes on menu selection FieldName
     3057function FieldName_Callback(hObject, eventdata, handles)
     3058%------------------------------------------------------------------------
     3059list_fields=get(handles.FieldName,'String');% list menu fields
     3060index_fields=get(handles.FieldName,'Value');% selected string index
    30833061field= list_fields{index_fields(1)}; % selected string
    30843062if isequal(field,'get_field...')
     
    30923070        delete(hget_field)
    30933071    end
    3094     hget_field=get_field(FileName);
    3095 %     set(hget_field,'Name','get_field')
    3096 %     hhget_field=guidata(hget_field);
    3097 %     set(hhget_field.list_fig,'Value',1)
    3098 %     set(hhget_field.list_fig,'String',{'uvmat'})
    3099   %  set(handles.transform_fct,'Value',1)% no transform by default
    3100   %  set(handles.path_transform,'String','')
     3072    get_field(FileName);
    31013073    return %no further action
    31023074end
     
    31513123
    31523124%common to Fields_1_Callback
    3153 list_fields_1=get(handles.Fields_1,'String');% list menu fields
     3125list_fields_1=get(handles.FieldName_1,'String');% list menu fields
    31543126field_1='';
    31553127if ~isempty(list_fields_1)
    3156 field_1= list_fields_1{get(handles.Fields_1,'Value')}; % selected string
     3128field_1= list_fields_1{get(handles.FieldName_1,'Value')}; % selected string
    31573129end
    31583130if isequal(field,'image')||isequal(field_1,'image')
     
    31723144
    31733145%---------------------------------------------------
    3174 % --- Executes on menu selection Fields
    3175 function Fields_1_Callback(hObject, eventdata, handles)
     3146% --- Executes on menu selection FieldName
     3147function FieldName_1_Callback(hObject, eventdata, handles)
    31763148%-------------------------------------------------
    31773149%% read input data
     
    31853157end
    31863158UvData.FileName_1='';% desactivate the use of a constant second file
    3187 list_fields=get(handles.Fields,'String');% list menu fields
    3188 field= list_fields{get(handles.Fields,'Value')}; % selected string
    3189 list_fields=get(handles.Fields_1,'String');% list menu fields
    3190 field_1= list_fields{get(handles.Fields_1,'Value')}; % selected string for the second field
     3159list_fields=get(handles.FieldName,'String');% list menu fields
     3160field= list_fields{get(handles.FieldName,'Value')}; % selected string
     3161list_fields=get(handles.FieldName_1,'String');% list menu fields
     3162field_1= list_fields{get(handles.FieldName_1,'Value')}; % selected string for the second field
    31913163if isempty(field_1)%||(numel(UvData.FileType)>=2 && strcmp(UvData.FileType{2},'image'))
    31923164    set(handles.SubField,'Value',0)
     
    48374809series; %first display of the GUI to fill waiting time
    48384810[RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
    4839 param.FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
     4811Param.FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];%first input file name
    48404812if isequal(get(handles.SubField,'Value'),1)
    48414813    [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles);
    48424814    FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];
    4843     if ~isequal(FileName_1,param.FileName)
    4844         param.FileName_1=FileName_1;
    4845     end
    4846 end
    4847 param.NomType=get(handles.NomType,'String');
    4848 param.NomType_1=get(handles.NomType_1,'String');
    4849 param.CheckFixPair=get(handles.CheckFixPair,'Value');
    4850 huvmat=get(handles.MenuSeries,'parent');
    4851 UvData=get(huvmat,'UserData');
     4815    if ~isequal(FileName_1,Param.FileName)
     4816        Param.FileName_1=FileName_1;%second input file name if relevant
     4817    end
     4818end
     4819Param.NomType=get(handles.NomType,'String');
     4820Param.NomType_1=get(handles.NomType_1,'String');
     4821Param.CheckFixPair=get(handles.CheckFixPair,'Value');
     4822UvData=get(handles.uvmat,'UserData');
    48524823if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'Time')
    4853     param.Time=UvData.XmlData{1}.Time;
     4824    Param.Time=UvData.XmlData{1}.Time;
    48544825end
    48554826if isequal(get(handles.scan_i,'Value'),1)
    4856     param.incr_i=str2num(get(handles.num_IndexIncrement,'String'));
     4827    Param.incr_i=str2num(get(handles.num_IndexIncrement,'String'));
    48574828elseif isequal(get(handles.scan_j,'Value'),1)
    4858     param.incr_j=str2num(get(handles.num_IndexIncrement,'String'));
    4859 end
    4860 param.list_fields=get(handles.Fields,'String');% list menu fields
    4861 FieldName=param.list_fields{get(handles.Fields,'Value')};
    4862 ind_image=find(strcmp('image',param.list_fields));
    4863 if ~isempty(ind_image) && numel(param.list_fields)>1
    4864 param.list_fields(ind_image)=[]; %suppress  'image' option
    4865 end
    4866 param.index_fields=find(strcmp(FieldName,param.list_fields));% selected string index
    4867 % if param.index_fields>1
    4868 %     param.index_fields=param.index_fields-1;
    4869 % end
    4870 param.list_fields_1=get(handles.Fields_1,'String');% list menu fields
    4871 if ischar(param.list_fields_1),param.list_fields_1={param.list_fields_1};end
    4872 FieldName_1=param.list_fields_1{get(handles.Fields_1,'Value')};
    4873 ind_image=find(strcmp('image',param.list_fields_1));
    4874 if ~isempty(ind_image) && numel(param.list_fields_1)>1
    4875 param.list_fields_1(ind_image)=[]; %suppress  'image' option
    4876 end
    4877 param.index_fields_1=find(strcmp(FieldName_1,param.list_fields_1));% selected string index
    4878 %param.index_fields=find(strcmp(FieldName,param.list_fields));% selected string index
    4879 % param.index_fields_1=get(handles.Fields_1,'Value')-1;% selected string index
    4880 % if param.index_fields_1>1
    4881 %     param.index_fields_1=param.index_fields_1-1;
    4882 % end
    4883 param.menu_coord_str=get(handles.transform_fct,'String');
    4884 param.menu_coord_val=get(handles.transform_fct,'Value');
    4885 series(param); %run the series interface
     4829    Param.incr_j=str2num(get(handles.num_IndexIncrement,'String'));
     4830end
     4831
     4832%% transfer fields and coordinate names
     4833Param.list_fields=get(handles.FieldName,'String');% list menu fields
     4834FieldName=Param.list_fields{get(handles.FieldName,'Value')};
     4835ind_image=find(strcmp('image',Param.list_fields));
     4836if ~isempty(ind_image) && numel(Param.list_fields)>1
     4837    Param.list_fields(ind_image)=[]; %suppress  'image' option
     4838end
     4839Param.index_fields=find(strcmp(FieldName,Param.list_fields));% selected string index
     4840Param.list_fields_1=get(handles.FieldName_1,'String');% list menu fields
     4841if ischar(Param.list_fields_1),Param.list_fields_1={Param.list_fields_1};end
     4842FieldName_1=Param.list_fields_1{get(handles.FieldName_1,'Value')};
     4843ind_image=find(strcmp('image',Param.list_fields_1));
     4844if ~isempty(ind_image) && numel(Param.list_fields_1)>1
     4845    Param.list_fields_1(ind_image)=[]; %suppress  'image' option
     4846end
     4847Param.index_fields_1=find(strcmp(FieldName_1,Param.list_fields_1));% selected string index
     4848Param.transform_str=get(handles.transform_fct,'String');
     4849Param.transform_val=get(handles.transform_fct,'Value');
     4850Param.Coord_x_str=get(handles.Coord_x,'String');
     4851Param.Coord_x_val=get(handles.Coord_x,'Value');
     4852Param.Coord_y_str=get(handles.Coord_y,'String');
     4853Param.Coord_y_val=get(handles.Coord_y,'Value');
     4854series(Param); %run the series interface
    48864855
    48874856%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.