Changeset 764 for trunk/src/series.m


Ignore:
Timestamp:
May 2, 2014, 2:03:44 AM (10 years ago)
Author:
sommeria
Message:

improvement of movie-pair for uvmat and introduction of a separate window SetPair? in series.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r760 r764  
    582582    errormsg=['input file ' fileinput  ' does not exist'];
    583583    msgbox_uvmat('ERROR',errormsg)
    584     set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
     584    set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH  button to magenta color (refresh still needed)
    585585    return
    586586end
     
    594594    errormsg='no input file in the series';
    595595    msgbox_uvmat('ERROR',errormsg)
    596     set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
     596    set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH  button to magenta color (end of activation)
    597597    return
    598598end
    599599if strcmp(FileType,'txt')
    600600    edit(fileinput)
    601     set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
     601    set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH  button to  magenta color (end of activation)
    602602    return
    603603elseif strcmp(FileType,'xml')
    604604    editxml(fileinput)
    605     set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
     605    set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH  button to magenta color (end of activation)
    606606     return
    607607elseif strcmp(FileType,'figure')
    608608    open(fileinput)
    609     set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
     609    set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH  button to magenta color (end of activation)
    610610     return
    611611end
     
    624624
    625625
    626 
    627626%% fill the list of file series
    628627InputTable=get(handles.InputTable,'Data');
     
    630629if strcmp(iview,'append') % display the input data as a new line in the table
    631630    iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line
    632     %InputTable(iview+1,:)={'','','','',''};
    633631    InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    634632elseif strcmp(iview,'one') % refresh the list of  input  file series
    635633    iview=1; %the first line in InputTable becomes the current line
    636634    InputTable={'','','','',''};
    637     %InputTable=[{'','','','',''};{'','','','',''}];
    638635    InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    639636    set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}])
     
    653650    SeriesData.Time={};
    654651end
    655 %nbview=size(InputTable,1)-1;% rmq: the last line is set blank to allow manual addition of a line
    656652nbview=size(InputTable,1);
    657653set(handles.ListView,'String',mat2cell((1:nbview)',ones(nbview,1)))
    658654set(handles.ListView,'Value',iview)
     655SeriesData.ListViewValue=iview;
     656SeriesData.ListViewMenu=mat2cell((1:nbview)',ones(nbview,1));
    659657set(handles.InputTable,'Data',InputTable)
    660658
     
    668666ref_i=floor((i1+i2)/2);% reference image number corresponding to the file
    669667set(handles.num_ref_i,'String',num2str(ref_i));
    670 % set(handles.num_ref_i,'UserData',[i1 i2])%store the indices for future opening
    671668if isempty(j1)
    672669    j1=1;
     
    981978MaxIndex_i=max(MaxIndex_i);
    982979range_index=MaxIndex_i-MinIndex_i+1;
    983 % scale_y=Position(4)/nbview;
    984 % scale_x=Position(3)/range_index;
    985 %x=(0.5:range_index-0.5)*Position(3)/range_index;% set of abscissa representing the whole i index range
    986 % y=(0.5:nbview-0.5)*Position(4)/nbview;
    987980range_y=max(1,floor(Position(4)/nbview));
    988981npx=floor(Position(3));
     
    10101003    set(handles.Pairs,'Visible','on')
    10111004    set(handles.PairString,'Visible','on')
     1005    set(handles.SetPairs,'Visible','on')
    10121006else
    10131007    set(handles.Pairs,'Visible','off')
    10141008    set(handles.PairString,'Visible','off')
     1009    set(handles.SetPairs,'Visible','off')
    10151010end
    10161011
     
    10251020switch FileType
    10261021    case {'civx','civdata'}
    1027         [FieldList,ColorList]=set_field_list('U','V','C');
    1028         set(handles.FieldName,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data
    1029         set(handles.FieldName,'Value',2) % set menu to 'velocity
     1022        FieldList=set_field_list('U','V','C');
     1023        set(handles.FieldName,'String',[FieldList;{'get_field...'}]);%standard menu for civx data
     1024        set(handles.FieldName,'Value',1) % set menu to 'velocity
    10301025        set(handles.Coord_x,'Value',1);
    10311026        set(handles.Coord_x,'String',{'X'});
     
    12331228% check_burst=0;
    12341229if isempty(j2_series)% no j pair
     1230    ModeValue=1;
    12351231    if isempty(i2_series)
    1236         set(handles.mode,'Value',1)
    12371232        set(handles.mode,'String',{''})% no pair menu to display
    12381233    else   
    12391234        set(handles.mode,'Value',1)
    1240         set(handles.mode,'String',{'series(Di)'}) % pair menu with only option Di
     1235        ModeMenu={'series(Di)'}; % pair menu with only option Di
    12411236    end
    12421237else %existence of j pairs
     
    12491244    MinIndex_j=min(find(i_max))-1;% min ref index i
    12501245    if MaxIndex_j==MinIndex_j
    1251         set(handles.mode,'Value',1);
    1252         set(handles.mode,'String',{'bursts'})
    1253 %         check_burst=1;
     1246        ModeValue=1;
     1247        ModeMenu={'bursts'};
    12541248    elseif MaxIndex_i==MinIndex_i
    1255         set(handles.mode,'Value',1);
    1256         set(handles.mode,'String',{'series(Dj)'})
     1249    ModeValue=1;
     1250    ModeMenu={'series(Dj)'};
    12571251    else
    1258         set(handles.mode,'String',{'bursts';'series(Dj)'})
     1252        ModeMenu={'bursts';'series(Dj)'};
    12591253        if (MaxIndex_j-MinIndex_j)>10
    1260             set(handles.mode,'Value',2);%set mode to series(Dj) if more than 10 j values
     1254            ModeValue=2;%set mode to series(Dj) if more than 10 j values
    12611255        else
    1262             set(handles.mode,'Value',1);
    1263 %             check_burst=1;
    1264         end
    1265     end
    1266 end
     1256            ModeValue=1;
     1257        end
     1258    end
     1259end
     1260
     1261set(handles.mode,'String',ModeMenu)
     1262set(handles.mode,'Value',ModeValue)
     1263SeriesData=get(handles.series,'UserData');
     1264SeriesData.ModeMenu=ModeMenu;
     1265SeriesData.ModeValue=ModeValue;
     1266set(handles.series,'UserData',SeriesData)
    12671267fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time)
    12681268ListPairs_Callback([],[],handles)
     
    13691369
    13701370%% display list of pairstring
     1371SeriesData=get(handles.series,'UserData');
    13711372displ_pair_list=get(handles.ListPairs,'String');
    13721373NewVal=[];
     
    13771378if ~isempty(NewVal)
    13781379    set(handles.ListPairs,'Value',NewVal)
     1380    SeriesData.ListPairsValue=NewVal;
    13791381else
    13801382    set(handles.ListPairs,'Value',1)
     1383    SeriesData.ListPairsValue=1;
    13811384end
    13821385set(handles.ListPairs,'String',displ_pair)
     1386SeriesData.ListPairsMenu=displ_pair;
     1387set(handles.series,'UserData',SeriesData);
    13831388
    13841389%-------------------------------------
     
    14221427Param=read_GUI_series(handles);%displayed parameters
    14231428SeriesData=get(handles.series,'UserData');%hidden parameters
     1429
     1430
     1431
     1432%% select the Action mode, 'local', 'background' or 'cluster' (if available)
     1433RunMode='local';%default (needed for first opening of the GUI series)
     1434if isfield(Param.Action,'RunMode')
     1435    RunMode=Param.Action.RunMode;
     1436end
     1437ActionExt='.m';%default
     1438if isfield(Param.Action,'ActionExt')
     1439    ActionExt=Param.Action.ActionExt;% '.m' or '.sh' (compiled)
     1440end
     1441ActionName=Param.Action.ActionName;
     1442ActionPath=Param.Action.ActionPath;
     1443path_series=fileparts(which('series'));
     1444
     1445%% create the Action fct handle if RunMode option = 'local'
     1446if strcmp(RunMode,'local')
     1447    if ~isequal(ActionPath,path_series)
     1448        eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION
     1449        if ~exist(ActionPath,'dir')
     1450            msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
     1451            return
     1452        end
     1453        if ~isequal(spath,ActionPath)
     1454            addpath(ActionPath)% add the prescribed path if not the current one
     1455        end
     1456    end
     1457    eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION
     1458    if ~isequal(ActionPath,path_series)
     1459        rmpath(ActionPath)% add the prescribed path if not the current one
     1460    end
     1461end
     1462
     1463%% Get RunTime code from the file PARAM.xml (needed to run compiled functions)
     1464errormsg='';%default error message
     1465xmlfile=fullfile(path_series,'PARAM.xml');
     1466test_batch=0;%default: ,no batch mode available
     1467if ~exist(xmlfile,'file')
     1468    [success,message]=copyfile(fullfile(path_series,'PARAM.xml.default'),xmlfile);
     1469end
     1470RunTime='';
     1471if strcmp(ActionExt,'.sh')
     1472    if exist(xmlfile,'file')
     1473        s=xml2struct(xmlfile);
     1474        if strcmp(RunMode,'cluster_oar') && isfield(s,'BatchParam')
     1475            if isfield(s.BatchParam,'RunTime')
     1476                RunTime=s.BatchParam.RunTime;
     1477            end
     1478            if isfield(s.BatchParam,'NbCore')
     1479                NbCore=s.BatchParam.NbCore;
     1480            end
     1481        elseif (strcmp(RunMode,'background')||strcmp(RunMode,'local')) && isfield(s,'RunParam')
     1482            if isfield(s.RunParam,'RunTime')
     1483                RunTime=s.RunParam.RunTime;
     1484            end
     1485            if isfield(s.RunParam,'NbCore')
     1486                NbCore=s.RunParam.NbCore;
     1487            end
     1488        end
     1489    end
     1490    if isempty(RunTime) && strcmp(RunMode,'cluster_oar')
     1491        msgbox_uvmat('ERROR','RunTime name not found in PARAM.xml, compiled version .sh cannot run on cluster')
     1492        return
     1493    end
     1494end
     1495
     1496%% If a compiled version has been selected (ext .sh) check weather it needs to be recompiled
     1497% ActionExtList=get(handles.ActionExt,'String');
     1498% ActionExt=ActionExtList{get(handles.ActionExt,'Value')};
     1499% ActionList=get(handles.ActionName,'String');
     1500% ActionName=ActionList{get(handles.ActionName,'Value')};
     1501% TransformPath='';
     1502% if ~isempty(get(handles.ActionExt,'UserData'))
     1503%     TransformPath=get(handles.ActionExt,'UserData');
     1504% end
     1505if strcmp(ActionExt,'.sh')
     1506    TransformPath='';
     1507    if ~isempty(get(handles.ActionExt,'UserData'))
     1508        TransformPath=get(handles.ActionExt,'UserData');
     1509    end
     1510    set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch'
     1511    set(handles.ActionExt,'BackgroundColor',[1 1 0])
     1512    ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']);
     1513    if ~exist(ActionFullName,'file')
     1514        answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?');
     1515        if strcmp(answer,'Yes')
     1516            set(handles.ActionExt,'BackgroundColor',[1 1 0])
     1517            path_uvmat=fileparts(which('series'));
     1518            currentdir=pwd;
     1519            cd(get(handles.ActionPath,'String'))% go to the directory of Action
     1520            %  addpath(get(handles.TransformPath,'String'))
     1521            addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
     1522           % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
     1523            compile(ActionName,TransformPath)
     1524            cd(currentdir)
     1525        end       
     1526    else
     1527        sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']));
     1528        m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m']));
     1529        if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum
     1530            set(handles.ActionExt,'BackgroundColor',[1 1 0])
     1531            drawnow
     1532            answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']);
     1533            if strcmp(answer,'Yes')
     1534                path_uvmat=fileparts(which('series'));
     1535                currentdir=pwd;
     1536                cd(get(handles.ActionPath,'String'))% go to the directory of Action
     1537                %  addpath(get(handles.TransformPath,'String'))
     1538                addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
     1539                addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
     1540                compile(ActionName,TransformPath)
     1541                cd(currentdir)
     1542            end
     1543        end
     1544    end
     1545    set(handles.ActionExt,'BackgroundColor',[1 1 1])
     1546     set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch
     1547end
     1548
     1549%% set nbre of cluster cores and processes
     1550switch RunMode
     1551    case {'local','background'}
     1552        NbCore=1;% no need to split the calculation
     1553    case 'cluster_oar'
     1554        if strcmp(Param.Action.ActionExt,'.m')% case of Matlab function (uncompiled)
     1555            NbCore=1;% one core used only (limitation of Matlab licences)
     1556            msgbox_uvmat('WARNING','Number of cores =1: select the compiled version civ_matlab.sh for multi-core processing');
     1557            extra_oar='';
     1558        else
     1559            answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''});
     1560            NbCore=str2double(answer{1});
     1561            extra_oar=answer{2};
     1562        end
     1563end
     1564if ~isfield(Param.IndexRange,'NbSlice')
     1565    Param.IndexRange.NbSlice=[];
     1566end
     1567if isempty(Param.IndexRange.NbSlice)
     1568    NbProcess=NbCore;% choose one process per core
     1569else
     1570    NbProcess=Param.IndexRange.NbSlice;% the nbre of run processes is equal to the number of slices
     1571    NbCore=min(NbCore,NbProcess);% at least one process per core
     1572end
    14241573
    14251574%% create the output data directory if needed
     
    14781627        end
    14791628    end
    1480 end
    1481 
    1482 %% select the Action mode, 'local', 'background' or 'cluster' (if available)
    1483 RunMode='local';%default (needed for first opening of the GUI series)
    1484 if isfield(Param.Action,'RunMode')
    1485     RunMode=Param.Action.RunMode;
    1486 end
    1487 ActionExt='.m';%default
    1488 if isfield(Param.Action,'ActionExt')
    1489     ActionExt=Param.Action.ActionExt;% '.m' or '.sh' (compiled)
    1490 end
    1491 ActionName=Param.Action.ActionName;
    1492 ActionPath=Param.Action.ActionPath;
    1493 path_series=fileparts(which('series'));
    1494 
    1495 %% create the Action fct handle if RunMode option = 'local'
    1496 if strcmp(RunMode,'local')
    1497     if ~isequal(ActionPath,path_series)
    1498         eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION
    1499         if ~exist(ActionPath,'dir')
    1500             msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
    1501             return
    1502         end
    1503         if ~isequal(spath,ActionPath)
    1504             addpath(ActionPath)% add the prescribed path if not the current one
    1505         end
    1506     end
    1507     eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION
    1508     if ~isequal(ActionPath,path_series)
    1509         rmpath(ActionPath)% add the prescribed path if not the current one
    1510     end
    1511 end
    1512 
    1513 %% Get RunTime code from the file PARAM.xml (needed to run compiled functions)
    1514 errormsg='';%default error message
    1515 xmlfile=fullfile(path_series,'PARAM.xml');
    1516 test_batch=0;%default: ,no batch mode available
    1517 if ~exist(xmlfile,'file')
    1518     [success,message]=copyfile(fullfile(path_series,'PARAM.xml.default'),xmlfile);
    1519 end
    1520 RunTime='';
    1521 if strcmp(ActionExt,'.sh')
    1522     if exist(xmlfile,'file')
    1523         s=xml2struct(xmlfile);
    1524         if strcmp(RunMode,'cluster_oar') && isfield(s,'BatchParam')
    1525             if isfield(s.BatchParam,'RunTime')
    1526                 RunTime=s.BatchParam.RunTime;
    1527             end
    1528             if isfield(s.BatchParam,'NbCore')
    1529                 NbCore=s.BatchParam.NbCore;
    1530             end
    1531         elseif (strcmp(RunMode,'background')||strcmp(RunMode,'local')) && isfield(s,'RunParam')
    1532             if isfield(s.RunParam,'RunTime')
    1533                 RunTime=s.RunParam.RunTime;
    1534             end
    1535             if isfield(s.RunParam,'NbCore')
    1536                 NbCore=s.RunParam.NbCore;
    1537             end
    1538         end
    1539     end
    1540     if isempty(RunTime) && strcmp(RunMode,'cluster_oar')
    1541         msgbox_uvmat('ERROR','RunTime name not found in PARAM.xml, compiled version .sh cannot run on cluster')
    1542         return
    1543     end
    1544 end
    1545 
    1546 %% set nbre of cluster cores and processes
    1547 switch RunMode
    1548     case {'local','background'}
    1549         NbCore=1;% no need to split the calculation
    1550     case 'cluster_oar'
    1551         if strcmp(Param.Action.ActionExt,'.m')% case of Matlab function (uncompiled)
    1552             NbCore=1;% one core used only (limitation of Matlab licences)
    1553             msgbox_uvmat('WARNING','Number of cores =1: select the compiled version civ_matlab.sh for multi-core processing');
    1554             extra_oar='';
    1555         else
    1556             answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''});
    1557             NbCore=str2double(answer{1});
    1558             extra_oar=answer{2};
    1559         end
    1560 end
    1561 if ~isfield(Param.IndexRange,'NbSlice')
    1562     Param.IndexRange.NbSlice=[];
    1563 end
    1564 if isempty(Param.IndexRange.NbSlice)
    1565     NbProcess=NbCore;% choose one process per core
    1566 else
    1567     NbProcess=Param.IndexRange.NbSlice;% the nbre of run processes is equal to the number of slices
    1568     NbCore=min(NbCore,NbProcess);% at least one process per core
    15691629end
    15701630       
     
    22452305    Param=read_GUI(handles.series);
    22462306    Param.InputTable=Param.InputTable(1,:);
    2247      % check the existence of the first file in the series
     2307    % check the existence of the first file in the series
    22482308    first_j=[];
    22492309    if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
     
    22552315    FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},...
    22562316        Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2);
    2257 %     filecell=get_file_series(Param);
    2258 %     
    22592317    if exist(FirstFileName,'file')
    22602318        ParamIn.SeriesInput=1;
     
    22662324                VName=GetFieldData.PanelVectors.vector_y;
    22672325                YName={GetFieldData.Coordinates.Coord_y};
    2268                 CName=GetFieldData.PanelVectors.vec_color;
    22692326                FieldList={['vec(' UName ',' VName ')'];...
    22702327                    ['norm(' UName ',' VName ')'];...
    22712328                    UName;VName};
    2272                 VecColorList={['norm(' UName ',' VName ')'];...
    2273                     UName;VName};
    2274                 if ~isempty(CName)
    2275                     VecColorList=[{CName};VecColorList];
    2276                 end
    2277             case 'scalar'
     2329            case {'scalar','pick variables'}
    22782330                FieldList=GetFieldData.PanelScalar.scalar;
    22792331                YName={GetFieldData.Coordinates.Coord_y};
    22802332                if ischar(FieldList)
    2281                 FieldList={FieldList};
     2333                    FieldList={FieldList};
    22822334                end
    22832335            case '1D plot'
    22842336                YName=GetFieldData.PanelOrdinate.ordinate;
    2285 %             case 'civdata...'%reinitiate input, return to automatic civ data reading
    2286 %                 display_file_name(handles,FileName,1)
     2337            case 'civdata...'
     2338                FieldList=set_field_list('U','V','C');
     2339                set(handles.FieldName,'Value',2) % set menu to 'velocity
     2340                XName='X';
     2341                YName='y';
    22872342        end
    22882343        if ~strcmp(GetFieldData.FieldOption,'civdata...')
     
    23072362                    ParamIn.TimeDimName=GetFieldData.Time.TimeName;
    23082363            end
    2309             set(handles.Coord_x,'String',{XName})
    2310             set(handles.Coord_y,'String',YName)
    2311             set(handles.FieldName,'Value',1)
    2312             set(handles.FieldName,'String',[FieldList; {'get_field...'}]);
    2313         end
     2364        end
     2365        set(handles.Coord_x,'String',{XName})
     2366        set(handles.Coord_y,'String',YName)
     2367        set(handles.FieldName,'Value',1)
     2368        set(handles.FieldName,'String',[FieldList; {'get_field...'}]);
    23142369    end
    23152370end
     
    23212376field_str=get(handles.FieldName_1,'String');
    23222377field_index=get(handles.FieldName_1,'Value');
    2323 field=field_str{field_index};
    2324 if isequal(field,'get_field...')   
    2325      hget_field=findobj(allchild(0),'name','get_field_1');
    2326      if ~isempty(hget_field)
    2327          delete(hget_field)
    2328      end
    2329      SeriesData=get(handles.series,'UserData');
    2330      filename=SeriesData.CurrentInputFile_1;
    2331      if exist(filename,'file')
    2332         hget_field=get_field(filename);
    2333         set(hget_field,'name','get_field_1')
    2334      end
    2335 % elseif isequal(field,'more...')
    2336 %     str=calc_field;
    2337 %     [ind_answer,v] = listdlg('PromptString','Select a file:',...
    2338 %                 'SelectionMode','single',...
    2339 %                 'ListString',str);
    2340 %        % edit the choice in the fields and actionname menu
    2341 %      scalar=cell2mat(str(ind_answer));
    2342 %      update_menu(handles.FieldName_1,scalar)
     2378field=field_str{field_index(1)};
     2379if isequal(field,'get_field...')
     2380    hget_field=findobj(allchild(0),'name','get_field');
     2381    if ~isempty(hget_field)
     2382        delete(hget_field)%delete opened versions of get_field
     2383    end
     2384    Param=read_GUI(handles.series);
     2385    Param.InputTable=Param.InputTable(1,:);
     2386    % check the existence of the first file in the series
     2387    first_j=[];
     2388    if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
     2389    if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end
     2390    PairString='';
     2391    if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end
     2392    [i1,i2,j1,j2] = get_file_index(Param.IndexRange.first_i,first_j,PairString);
     2393    FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},...
     2394        Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2);
     2395    if exist(FirstFileName,'file')
     2396        ParamIn.SeriesInput=1;
     2397        GetFieldData=get_field(FirstFileName,ParamIn);
     2398        FieldList={};
     2399        switch GetFieldData.FieldOption
     2400            case 'vectors'
     2401                UName=GetFieldData.PanelVectors.vector_x;
     2402                VName=GetFieldData.PanelVectors.vector_y;
     2403                FieldList={['vec(' UName ',' VName ')'];...
     2404                    ['norm(' UName ',' VName ')'];...
     2405                    UName;VName};
     2406            case {'scalar','pick variables'}
     2407                FieldList=GetFieldData.PanelScalar.scalar;
     2408                if ischar(FieldList)
     2409                    FieldList={FieldList};
     2410                end
     2411            case '1D plot'
     2412
     2413            case 'civdata...'
     2414                FieldList=set_field_list('U','V','C');
     2415                set(handles.FieldName,'Value',2) % set menu to 'velocity
     2416        end
     2417        if ~strcmp(GetFieldData.FieldOption,'civdata...')
     2418            TimeNameStr=GetFieldData.Time.SwitchVarIndexTime;
     2419            switch TimeNameStr
     2420                case 'file index'
     2421                    set(handles.TimeName,'String','');
     2422                case 'attribute'
     2423                    set(handles.TimeName,'String',['att:' GetFieldData.Time.TimeName]);
     2424                case 'variable'
     2425                    set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName])
     2426                    set(handles.NomType,'String','*')
     2427                    set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% A VERIFIER !!!!!!
     2428                    set(handles.FileIndex,'String','')
     2429                    ParamIn.TimeVarName=GetFieldData.Time.TimeName;
     2430                case 'matrix_index'
     2431                    set(handles.TimeName,'String',['dim:' GetFieldData.Time.TimeName]);
     2432                    set(handles.NomType,'String','*')
     2433                    set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])
     2434                    set(handles.FileIndex,'String','')
     2435                    ParamIn.TimeDimName=GetFieldData.Time.TimeName;
     2436            end
     2437        end
     2438        set(handles.FieldName_1,'Value',1)
     2439        set(handles.FieldName_1,'String',[FieldList; {'get_field...'}]);
     2440    end
    23432441end   
    23442442
     
    29273025ActionList=get(handles.ActionName,'String');
    29283026ActionName=ActionList{get(handles.ActionName,'Value')};
    2929 TransformPath='';
    2930 if ~isempty(get(handles.ActionExt,'UserData'))
    2931     TransformPath=get(handles.ActionExt,'UserData');
    2932 end
    2933 if strcmp(ActionExt,'.sh')
    2934     set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch'
    2935     set(handles.ActionExt,'BackgroundColor',[1 1 0])
    2936     ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']);
    2937     if ~exist(ActionFullName,'file')
    2938         answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?');
    2939         if strcmp(answer,'Yes')
    2940             set(handles.ActionExt,'BackgroundColor',[1 1 0])
    2941             path_uvmat=fileparts(which('series'));
    2942             currentdir=pwd;
    2943             cd(get(handles.ActionPath,'String'))% go to the directory of Action
    2944             %  addpath(get(handles.TransformPath,'String'))
    2945             addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
    2946            % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
    2947             compile(ActionName,TransformPath)
    2948             cd(currentdir)
    2949         end       
    2950     else
    2951         sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']));
    2952         m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m']));
    2953         if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum
    2954             set(handles.ActionExt,'BackgroundColor',[1 1 0])
    2955             drawnow
    2956             answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']);
    2957             if strcmp(answer,'Yes')
    2958                 path_uvmat=fileparts(which('series'));
    2959                 currentdir=pwd;
    2960                 cd(get(handles.ActionPath,'String'))% go to the directory of Action
    2961                 %  addpath(get(handles.TransformPath,'String'))
    2962                 addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
    2963                 addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
    2964                 compile(ActionName,TransformPath)
    2965                 cd(currentdir)
    2966             end
    2967         end
    2968     end
    2969     set(handles.ActionExt,'BackgroundColor',[1 1 1])
    2970      set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch
    2971 end
    2972 
    2973 
     3027% TransformPath='';
     3028% if ~isempty(get(handles.ActionExt,'UserData'))
     3029%     TransformPath=get(handles.ActionExt,'UserData');
     3030% end
     3031% if strcmp(ActionExt,'.sh')
     3032%     set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch'
     3033%     set(handles.ActionExt,'BackgroundColor',[1 1 0])
     3034%     ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']);
     3035%     if ~exist(ActionFullName,'file')
     3036%         answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?');
     3037%         if strcmp(answer,'Yes')
     3038%             set(handles.ActionExt,'BackgroundColor',[1 1 0])
     3039%             path_uvmat=fileparts(which('series'));
     3040%             currentdir=pwd;
     3041%             cd(get(handles.ActionPath,'String'))% go to the directory of Action
     3042%             %  addpath(get(handles.TransformPath,'String'))
     3043%             addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
     3044%            % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
     3045%             compile(ActionName,TransformPath)
     3046%             cd(currentdir)
     3047%         end       
     3048%     else
     3049%         sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']));
     3050%         m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m']));
     3051%         if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum
     3052%             set(handles.ActionExt,'BackgroundColor',[1 1 0])
     3053%             drawnow
     3054%             answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']);
     3055%             if strcmp(answer,'Yes')
     3056%                 path_uvmat=fileparts(which('series'));
     3057%                 currentdir=pwd;
     3058%                 cd(get(handles.ActionPath,'String'))% go to the directory of Action
     3059%                 %  addpath(get(handles.TransformPath,'String'))
     3060%                 addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
     3061%                 addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
     3062%                 compile(ActionName,TransformPath)
     3063%                 cd(currentdir)
     3064%             end
     3065%         end
     3066%     end
     3067%     set(handles.ActionExt,'BackgroundColor',[1 1 1])
     3068%      set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch
     3069% end
    29743070
    29753071
     
    30223118function series_WindowButtonMotionFcn(hObject, eventdata, handles)
    30233119set(hObject,'Pointer','arrow');
     3120
     3121
     3122% --- Executes on button press in SetPairs.
     3123function SetPairs_Callback(hObject, eventdata, handles)
     3124
     3125%% create the GUI set_pairs
     3126set(0,'Unit','points')
     3127ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
     3128Width=300;% fig width in points (1/72 inch)
     3129Height=min(0.8*ScreenSize(4),300);
     3130Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40
     3131Bottom=ScreenSize(4)-Height-40; %put fig at top right
     3132hfig=findobj(allchild(0),'Tag','set_slice');
     3133if ~isempty(hfig),delete(hfig), end; %delete existing version of the GUI
     3134hfig=figure('name','set_pairs','tag','set_pairs','MenuBar','none','NumberTitle','off','Unit','points','Position',[Left,Bottom,Width,Height]);
     3135BackgroundColor=get(hfig,'Color');
     3136hh=0.14; % box height (relative)
     3137ii=0.01; % gap between uicontrols
     3138
     3139ww=0.9; % box width (relative)
     3140SeriesData=get(handles.series,'UserData');
     3141% first raw of the GUI
     3142uicontrol('Style','text','Units','normalized', 'Position', [0.02 0.9 0.5 0.1],'BackgroundColor',BackgroundColor,...
     3143    'String','row to edit #','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');%title
     3144uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.54 0.8 0.3 0.2],'tag','ListView','BackgroundColor',[1 1 1],...
     3145    'String',SeriesData.ListViewMenu,'Value',SeriesData.ListViewValue,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''ListView'':choice of the file series w for pair display');
     3146% second raw of the GUI
     3147uicontrol('Style','text','Units','normalized', 'Position', [0.02 0.8 0.7 0.1],'BackgroundColor',BackgroundColor,...
     3148    'String','mode of index pairing:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left');%title
     3149uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.02 0.58 ww 0.2],'tag','Mode','BackgroundColor',[1 1 1],'Callback',@(hObject,eventdata)ModeMenu_Callback(hObject,eventdata),...
     3150    'String',SeriesData.ModeMenu,'Value',SeriesData.ModeValue,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''Mode'': choice of the image pair mode');
     3151% third raw
     3152uicontrol('Style','text','Units','normalized', 'Position', [0.02 0.6 0.7 0.1],'BackgroundColor',BackgroundColor,...
     3153    'String','pair choice:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left');%title
     3154uicontrol('Style','listbox','Units','normalized', 'Position', [0.02 0.16 ww 0.4],'tag','ListPairs','BackgroundColor',[1 1 1],'Callback',@(hObject,eventdata)ListPairsMenu_Callback(hObject,eventdata),...
     3155    'String',SeriesData.ListPairsMenu,'Value',SeriesData.ListPairsValue,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''ListPairs'': menu for selecting the image pair');
     3156%  last raw  of the GUI: pushbuttons
     3157wwp=(1-4*ii)/3; %width of the push buttons
     3158uicontrol('Style','pushbutton','Units','normalized', 'Position', [ii ii wwp hh],'BackgroundColor',[0 1 0],'String','OK','Callback',@(hObject,eventdata)OK_Callback(hObject,eventdata),...
     3159    'FontWeight','bold','FontUnits','points','FontSize',12,'TooltipString','''OK'': apply the output to the current field series in uvmat');
     3160drawnow
     3161
     3162function ModeMenu_Callback(hObject,eventdata)
     3163hseries=findobj(allchild(0),'tag','series');
     3164hhseries=guidata(hseries);
     3165SeriesData=get(hseries,'UserData');
     3166hListView=findobj(get(hObject,'parent'),'Tag','ListView');
     3167iview=get(hListView,'Value');
     3168hMode=findobj(get(hObject,'parent'),'Tag','Mode');
     3169mode_list=get(hMode,'String');
     3170mode=mode_list{get(hMode,'Value')};
     3171if isequal(mode,'bursts')
     3172    enable_i(hhseries,'On')
     3173    enable_j(hhseries,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice)
     3174else
     3175    enable_i(hhseries,'On')
     3176    enable_j(hhseries,'Off')
     3177end
     3178fill_ListPair(hhseries,SeriesData.i1_series{iview},SeriesData.i2_series{iview},...
     3179    SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview})
     3180ListPairs_Callback([],[],hhseries)
     3181
     3182%-------------------------------------------------------------
     3183% --- Executes on selection in ListPairs.
     3184function ListPairsMenu_Callback(hObject,eventdata)
     3185%------------------------------------------------------------
     3186list_pair=get(hObject,'String');%get the menu of image pairs
     3187if isempty(list_pair)
     3188    string='';
     3189else
     3190    string=list_pair{get(hObject,'Value')};
     3191    string=regexprep(string,',.*','');%removes time indication (after ',')
     3192end
     3193hseries=findobj(allchild(0),'tag','series');
     3194hPairString=findobj(hseries,'tag','PairString');
     3195PairString=get(hPairString,'Data');
     3196hListView=findobj(get(hObject,'parent'),'Tag','ListView');
     3197iview=get(hListView,'Value');
     3198PairString{iview,1}=string;
     3199% report the selected pair string to the table PairString
     3200set(hPairString,'Data',PairString)
     3201
     3202%-------------------------------------------------------------
     3203% --- Executes on selection in ListPairs.
     3204function OK_Callback(hObject,eventdata)
     3205%------------------------------------------------------------
     3206delete(get(hObject,'parent'))
     3207
Note: See TracChangeset for help on using the changeset viewer.