Changeset 594


Ignore:
Timestamp:
Mar 26, 2013, 9:56:10 PM (12 years ago)
Author:
sommeria
Message:

bugs corrected. One step further for using compiled fcts and cluster with series

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ_matlab.m

    r591 r594  
    105105    Data.VarAttribute{5}.Role='warnflag';
    106106   
    107     if 'PIV volume'
     107    if strcmp(Param.ListCompareMode, 'PIV volume')
    108108        Data.ListVarName=[Data.ListVarName 'Civ1_Z'];
    109109        Data.Civ1_X=[];Data.Civ1_Y=[];Data.Civ1_Z=[];
  • trunk/src/mouse_down.m

    r575 r594  
    384384    if isequal(get(h_edit_append,'Value'),1) && ~isempty(haxes)
    385385        h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord');
    386         coord_value=get(hhuvmat.transform_fct,'Value');% set uvmat to pixel coordinates, run it again if not
     386        coord_value=get(hhuvmat.TransformName,'Value');% set uvmat to pixel coordinates, run it again if not
    387387        if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys)
    388             set(hhuvmat.transform_fct,'Value',1)
    389             uvmat('transform_fct_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
     388            set(hhuvmat.TransformName,'Value',1)
     389            uvmat('TransformName_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
    390390            set(hhuvmat.CheckFixedLimits,'Value',0)% put FixedLimits option to 'off'
    391391            set(hhuvmat.CheckFixedLimits,'BackgroundColor',[0.7 0.7 0.7])
  • trunk/src/read_civdata.m

    r582 r594  
    9696            Field.SubDomain=Field.Patch1_SubDomain;
    9797            Field.ListGlobalAttribute=[Field.ListGlobalAttribute {'SubDomain'}];
    98         end     
     98        end
     99        if isfield(Field,'Civ1_Dt')
    99100        Field.Dt=Field.Civ1_Dt;
     101        end
     102        if isfield(Field,'Civ1_Time')
    100103        Field.Time=Field.Civ1_Time;
     104        end
    101105    case{'civ2','filter2'}
    102106        if isfield(Field,'Patch2_SubDomain')
     
    104108            Field.ListGlobalAttribute=[Field.ListGlobalAttribute {'SubDomain'}];
    105109        end
     110        if isfield(Field,'Civ2_Dt')
    106111        Field.Dt=Field.Civ2_Dt;
     112        end
     113        if isfield(Field,'Civ2_Time')
    107114        Field.Time=Field.Civ2_Time;
     115        end
    108116end
    109117Field.ListGlobalAttribute=[Field.ListGlobalAttribute {'Dt','Time'}];
  • trunk/src/series.m

    r591 r594  
    186186
    187187%% Adjust the GUI according to the binaries available in PARAM.xml
    188 path_uvmat=fileparts(which('uvmat')); %path to civ
    189 addpath (path_uvmat) ; %add the path to civ, (useful in case of change of working directory after civ has been s opened in the working directory)
    190 errormsg=[];%default error message
    191 xmlfile='PARAM.xml';
    192 if exist(xmlfile,'file')
    193     try
    194         t=xmltree(xmlfile);
    195         sparam=convert(t);
    196     catch ME
    197         errormsg={' Unable to read the file PARAM.xml defining the  binaries:';ME.message};
    198     end
    199 else
    200     errormsg=[xmlfile ' not found: path to binaries undefined'];
    201 end
    202 if ~isempty(errormsg)
    203     msgbox_uvmat('WARNING',errormsg);
    204 end
    205 test_batch=0;%default: ,no batch mode available
    206 if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode')
    207     test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod
    208 end
    209 RUNVal=get(handles.RunMode,'Value');
    210 if test_batch==0
    211    if RUNVal>2
    212        set(handles.RunMode,'Value',1)
    213    end
    214    set(handles.RunMode,'String',{'local';'background'})
    215 else
    216     set(handles.RunMode,'String',{'local';'background';'cluster'})
    217 end
     188% path_uvmat=fileparts(which('uvmat')); %path to civ
     189% addpath (path_uvmat) ; %add the path to civ, (useful in case of change of working directory after civ has been s opened in the working directory)
     190% errormsg=[];%default error message
     191% xmlfile='PARAM.xml';
     192% if exist(xmlfile,'file')
     193%     try
     194%         t=xmltree(xmlfile);
     195%         sparam=convert(t);
     196%     catch ME
     197%         errormsg={' Unable to read the file PARAM.xml defining the  binaries:';ME.message};
     198%     end
     199% else
     200%     errormsg=[xmlfile ' not found: path to binaries undefined'];
     201% end
     202% if ~isempty(errormsg)
     203%     msgbox_uvmat('WARNING',errormsg);
     204% end
     205% test_batch=0;%default: ,no batch mode available
     206% if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode')
     207%     test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod
     208% end
     209% RUNVal=get(handles.RunMode,'Value');
     210% if test_batch==0
     211%    if RUNVal>2
     212%        set(handles.RunMode,'Value',1)
     213%    end
     214%    set(handles.RunMode,'String',{'local';'background'})
     215% else
     216%     set(handles.RunMode,'String',{'local';'background';'cluster'})
     217% end
    218218
    219219%% introduce the input file name(s) if defined from input Param
     
    13081308set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
    13091309drawnow
    1310 [h_fun,Series,filexml,errormsg]=prepare_jobs(handles);
     1310[Series,filexml,errormsg]=prepare_jobs(handles);
    13111311if ~isempty(errormsg)
    13121312    msgbox_uvmat('ERROR',errormsg)
     
    13201320ActionList=get(handles.ActionName,'String');
    13211321ActionName=ActionList{get(handles.ActionName,'Value')};
    1322 
     1322path_series=fileparts(which('series'));
     1323
     1324% create the Action fct handle if RunMode option = 'local'
     1325if strcmp(RunMode,'local')
     1326    if ~isequal(ActionPath,path_series)
     1327        eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION
     1328        if ~exist(ActionPath,'dir')
     1329            msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
     1330            return
     1331        end
     1332        if ~isequal(spath,ActionPath)
     1333            addpath(ActionPath)% add the prescribed path if not the current one
     1334        end
     1335    end
     1336    eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION
     1337    if ~isequal(ActionPath,path_series)
     1338        rmpath(ActionPath)% add the prescribed path if not the current one
     1339    end
     1340end
     1341
     1342%% Get RunTime code from the file PARAM.xml (needed to run compiled functions)
     1343errormsg='';%default error message
     1344xmlfile=fullfile(path_series,'PARAM.xml');
     1345test_batch=0;%default: ,no batch mode available
     1346if ~exist(xmlfile,'file')
     1347    [success,message]=copyfile(fullfile(path_series,'PARAM.xml.default'),xmlfile);
     1348end
     1349RunTime='';
     1350if strcmp(ActionExt,'.sh')
     1351    if exist(xmlfile,'file')
     1352        s=xml2struct(xmlfile);
     1353        if strcmp(RunMode,'cluster') && isfield(s,'BatchParam')
     1354            if isfield(s.BatchParam,'RunTime')
     1355                RunTime=s.BatchParam.RunTime;
     1356            end
     1357            if isfield(s.BatchParam,'NbCore')
     1358                NbCore=s.BatchParam.NbCore;
     1359            end
     1360        elseif (strcmp(RunMode,'background')||strcmp(RunMode,'local')) && isfield(s,'RunParam')
     1361            if isfield(s.RunParam,'RunTime')
     1362                RunTime=s.RunParam.RunTime;
     1363            end
     1364            if isfield(s.RunParam,'NbCore')
     1365                NbCore=s.RunParam.NbCore;
     1366            end
     1367        end
     1368    end
     1369    if isempty(RunTime) && strcmp(RunMode,'cluster')
     1370        msgbox_uvmat('ERROR','RunTime name not found in PARAM.xml, compiled version .sh cannot run on cluster')
     1371        return
     1372    end
     1373    Series.RunTime=RunTime;
     1374end
     1375   
    13231376%% set nbre of processes
    1324 if isfield(Series,'NbSlice')&&~isempty(Series.NbSlice)
    1325     NbProcess=Series.NbSlice;
    1326 else
     1377if ~isfield(Series,'NbSlice')
     1378    Series.NbSlice=[];
     1379end
     1380if isempty(Series.NbSlice)
    13271381    switch RunMode
    13281382        case {'local','background'}
     
    13381392    end
    13391393    NbProcess=NbCore;% choose one process per core
    1340 end
     1394else
     1395    NbProcess=Series.NbSlice;% the nbre of run processes is equal to the number of slices
     1396end
     1397
     1398%% read index ranges
     1399first_i=1;
     1400last_i=1;
     1401incr_i=1;
     1402first_j=1;
     1403last_j=1;
     1404incr_j=1;
     1405if isfield(Series.IndexRange,'first_i')
     1406    first_i=Series.IndexRange.first_i;
     1407    incr_i=Series.IndexRange.incr_i;
     1408    last_i=Series.IndexRange.last_i;
     1409end
     1410if isfield(Series.IndexRange,'first_j')
     1411    first_j=Series.IndexRange.first_j;
     1412    last_j=Series.IndexRange.last_j;
     1413end
     1414if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),...
     1415    set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return
     1416else
     1417    BlockLength=ceil(numel(first_i:incr_i:last_i)/NbProcess);
     1418end
     1419
     1420%% main processing
    13411421for iprocess=1:NbProcess% TOD0
    13421422%     split the input files
     
    13461426switch RunMode
    13471427    case 'local'
    1348         switch ActionExt
    1349             case '.m'
    1350                 for iprocess=1:NbProcess
    1351                     if ~isempty(filexml)
    1352                         t=struct2xml(Series);
    1353                         t=set(t,1,'name','Series');
    1354                         save(t,filexml);
    1355                     end
    1356                     Series.RUNHandle=handles.RUN;
    1357                     Series.WaitbarHandle=handles.Waitbar;
    1358                     Series=h_fun(Series);
     1428        Series.RUNHandle=handles.RUN;
     1429        Series.WaitbarHandle=handles.Waitbar;
     1430        for iprocess=1:NbProcess
     1431            if isempty(Series.NbSlice)
     1432                Series.IndexRange.first_i=first_i+(iprocess-1)*BlockLength;
     1433                Series.IndexRange.last_i=first_i+(iprocess)*BlockLength-1;
     1434            else
     1435                Series.IndexRange.first_i= first_i+iprocess-1;
     1436                Series.IndexRange.incr_i=incr_i*Series.NbSlice;
     1437            end
     1438            if ~isempty(filexml)
     1439                t=struct2xml(Series);
     1440                t=set(t,1,'name','Series');
     1441                if isequal(Series.IndexRange.last_i,Series.IndexRange.first_i)
     1442                    term_i=num2str(Series.IndexRange.first_i);
     1443                else
     1444                    term_i=[num2str(Series.IndexRange.first_i) '-' num2str(Series.IndexRange.last_i)];
    13591445                end
    1360             case '.sh'
    1361                 for iprocess=1:NbProcess
    1362                     CivmBin=fullfile(ActionPath,[ActionName '.sh']); %path to the source directory of uvmat
     1446                if isequal(Series.IndexRange.last_j,Series.IndexRange.first_j)
     1447                    term_j=num2str(Series.IndexRange.first_j);
     1448                else
     1449                    term_j=[num2str(Series.IndexRange.first_j) '-' num2str(Series.IndexRange.last_j)];
     1450                end
     1451                save(t,[filexml '_' term_i '_' term_j '.xml']);
     1452            end
     1453            switch ActionExt
     1454                case '.m'
     1455                    h_fun(Series);
     1456                case '.sh'
    13631457                    switch computer
    1364                         case {'PCWIN','PCWIN64'}
     1458                        case {'PCWIN','PCWIN64'} %Windows system
    13651459                            filename=regexprep(filename,'\\','\\\\');% add '\' so that '\' are left as characters
    13661460                            % TODO launch command in DOS
    1367                         case {'GLNX86','GLNXA64','MACI64'}
    1368                             cmd=['#!/bin/bash \n '...
    1369                                 '#$ -cwd \n '...
    1370                                 'hostname && date \n '...
    1371                                 'umask 002 \n'...
    1372                                 CivmBin ' ' Param.xml.RunTime ' ' regexprep(filename,'(.+)([/\\])(.+$)','$1$20_XML$2$3.xml') ' ' Param.OutputFile '.nc'];%allow writting access to created files for user group
     1461                        case {'GLNX86','GLNXA64','MACI64'}%Linux  system
     1462%                             cmd=['#!/bin/bash \n '...
     1463%                                 '#$ -cwd \n '...
     1464%                                 'hostname && date \n '...
     1465%                                 'umask 002 \n'...
     1466%                                 fullfile(ActionPath,[ActionName '.sh']) ' ' Series.RunTime ' ' filexml '_' term_i '_' term_j '.xml'];%allow writting access to created files for user group
     1467                             system([fullfile(ActionPath,[ActionName '.sh']) ' ' Series.RunTime ' ' filexml '_' term_i '_' term_j '.xml']);
    13731468                    end
    1374                 end
     1469            end
    13751470        end
    13761471    case 'background'
     
    13841479            t=set(t,1,'name','Series');
    13851480            save(t,filexml);
    1386             path_uvmat=fileparts(which('uvmat'));
    13871481           
    13881482            filename_bat=regexprep(filexml,'.xml$','.bat');% create executable file to run program in background
     
    14011495                        '. /etc/sysprofile \n'...
    14021496                        'matlab -nodisplay -nosplash -nojvm -logfile ''' filelog ''' <<END_MATLAB \n'...
    1403                         'addpath(''' path_uvmat '''); \n'...
     1497                        'addpath(''' path_series '''); \n'...
    14041498                        'addpath(''' Series.Action.ActionPath '''); \n'...
    14051499                        '' Series.Action.ActionName  '( ''' filexml '''); \n'...
     
    14131507                case {'PCWIN','PCWIN64'}
    14141508                    text_matlabscript=['matlab -automation -logfile ' regexprep(filelog,'\\','\\\\')...
    1415                         ' -r "addpath(''' regexprep(path_uvmat,'\\','\\\\') ''');'...
     1509                        ' -r "addpath(''' regexprep(path_series,'\\','\\\\') ''');'...
    14161510                        'addpath(''' regexprep(Series.Action.ActionPath,'\\','\\\\') ''');'...
    14171511                        '' Series.Action.ActionName  '( ''' regexprep(filexml,'\\','\\\\') ''');exit"'];
     
    15771671% --- Main launch command, called by RUN and BATCH
    15781672
    1579 function [h_fun,Series,filexml,errormsg]=prepare_jobs(handles,run)
     1673function [Series,filexml,errormsg]=prepare_jobs(handles)
    15801674%INPUT:
    15811675% handles: handles of graphic objects on the GUI series
     
    15841678
    15851679%------------------------------------------------------------------------
    1586 h_fun=[];
    15871680filexml='';
    15881681errormsg='';
    1589 if ~exist('run','var')
    1590     run=1;
    1591 end
     1682
    15921683%% Read parameters from series
    15931684Series=read_GUI(handles.series);
     
    15961687end
    15971688
    1598 %% read index ranges
    1599 first_i=1;
    1600 last_i=1;
    1601 incr_i=1;
    1602 first_j=1;
    1603 last_j=1;
    1604 incr_j=1;
    1605 if isfield(Series.IndexRange,'first_i')
    1606     first_i=Series.IndexRange.first_i;
    1607     incr_i=Series.IndexRange.incr_i;
    1608     last_i=Series.IndexRange.last_i;
    1609 end
    1610 if isfield(Series.IndexRange,'first_j')
    1611     first_j=Series.IndexRange.first_j;
    1612     incr_j=Series.IndexRange.incr_j;
    1613     last_j=Series.IndexRange.last_j;
    1614 end
    1615 
    1616 %% read input file parameters and set menus
    1617 menu_coord_state=get(handles.TransformName,'Visible');
    1618 if isequal(menu_coord_state,'on')
    1619     menu_index=get(handles.TransformName,'Value');
    1620     transform_list=get(handles.TransformName,'UserData');
    1621     Series.FieldTransform.TransformHandle=transform_list{menu_index};% transform function handles
    1622 end
    1623 
    1624 if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),...
    1625     set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
    16261689
    16271690%% projection object
    1628 if isfield(Series,'CheckObject')
    1629     if Series.CheckObject
    1630         hset_object=findobj(allchild(0),'tag','set_object');
    1631         Series.ProjObject=read_GUI(hset_object);
    1632         CheckObject_Callback([], [], handles)
    1633     end
    1634 else
    1635     Series.CheckObject=0;
    1636 end
     1691% if isfield(Series,'CheckObject')
     1692%     if Series.CheckObject
     1693%         hset_object=findobj(allchild(0),'tag','set_object');
     1694%         Series.ProjObject=read_GUI(hset_object);
     1695%         CheckObject_Callback([], [], handles)
     1696%     end
     1697% else
     1698%     Series.CheckObject=0;
     1699% end
    16371700
    16381701%% get_field GUI
     
    16441707end
    16451708
    1646 if ~run
    1647     return
    1648 end
    1649 
    16501709%% defining the ActionName function handle
    1651 list_action=get(handles.ActionName,'String');% list menu action
    1652 index=get(handles.ActionName,'Value');
    1653 action= list_action{index}; % selected string
    1654 %Series.hseries=handles.series; % handles to the series GUI
    1655 path_series=which('series');
    1656 ActionPathList=get(handles.ActionName,'UserData');
    1657 ActionPath=ActionPathList{index}; %path stored for the function ACTION
    1658 if ~isequal(ActionPath,path_series)
    1659     eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION
    1660     if ~exist(ActionPath,'dir')
    1661         errormsg=['The prescribed function path ' ActionPath ' does not exist'];
    1662         return
    1663     end
    1664     if ~isequal(spath,ActionPath)
    1665         addpath(ActionPath)% add the prescribed path if not the current one
    1666     end
    1667 end
    1668 eval(['h_fun=@' action ';'])%create a function handle for ACTION
    1669 if ~isequal(ActionPath,path_series)
    1670         rmpath(ActionPath)% add the prescribed path if not the current one   
    1671 end
     1710% list_action=get(handles.ActionName,'String');% list menu action
     1711% index=get(handles.ActionName,'Value');
     1712% action= list_action{index}; % selected string
     1713% %Series.hseries=handles.series; % handles to the series GUI
     1714% path_series=which('series');
     1715% ActionPathList=get(handles.ActionName,'UserData');
     1716% ActionPath=ActionPathList{index}; %path stored for the function ACTION
     1717% if ~isequal(ActionPath,path_series)
     1718%     eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION
     1719%     if ~exist(ActionPath,'dir')
     1720%         errormsg=['The prescribed function path ' ActionPath ' does not exist'];
     1721%         return
     1722%     end
     1723%     if ~isequal(spath,ActionPath)
     1724%         addpath(ActionPath)% add the prescribed path if not the current one
     1725%     end
     1726% end
     1727% eval(['h_fun=@' action ';'])%create a function handle for ACTION
     1728% if ~isequal(ActionPath,path_series)
     1729%         rmpath(ActionPath)% add the prescribed path if not the current one   
     1730% end
    16721731
    16731732%% create the output data directory and write in it the xml file from the GUI config
     
    17121771        end
    17131772    end
    1714     filexml=fullfile(OutputDir,[Series.InputTable{1,3} '.xml']);% name of the parameter xml file set in this directory
     1773    filexml=fullfile(OutputDir,Series.InputTable{1,3});% name of the parameter xml file set in this directory
    17151774end
    17161775%removes redondant information
     
    18161875
    18171876%% check the current ActionPath to the selected function
    1818 PathName=ActionPathList{ActionIndex};%current recorded path
    1819 set(handles.ActionPath,'String',PathName); %show the path to the senlected function
     1877ActionPath=ActionPathList{ActionIndex};%current recorded path
     1878set(handles.ActionPath,'String',ActionPath); %show the path to the senlected function
    18201879
    18211880%% reinitialise the waitbar
     
    18291888set(handles.Mask,'Visible','off')
    18301889
    1831 %% run the current action function to prepare the input GUI
    1832 [h_fun,Series,tild,errormsg]=prepare_jobs(handles);
     1890%% create the function handle for Action
     1891path_series=which('series');
     1892if ~isequal(ActionPath,path_series)
     1893    eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION
     1894    if ~exist(ActionPath,'dir')
     1895        errormsg=['The prescribed function path ' ActionPath ' does not exist'];
     1896        return
     1897    end
     1898    if ~isequal(spath,ActionPath)
     1899        addpath(ActionPath)% add the prescribed path if not the current one
     1900    end
     1901end
     1902eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION
     1903if ~isequal(ActionPath,path_series)
     1904        rmpath(ActionPath)% add the prescribed path if not the current one   
     1905end
     1906
     1907%% prepare the input param
     1908[Series,tild,errormsg]=prepare_jobs(handles);
    18331909if ~isempty(errormsg)
    18341910    msgbox_uvmat('ERROR',errormsg)
     
    18771953        end
    18781954    end
     1955else
     1956% check index ranges
     1957first_i=1;last_i=1;first_j=1;last_j=1;
     1958if isfield(Series.IndexRange,'first_i')
     1959    first_i=Series.IndexRange.first_i;
     1960    last_i=Series.IndexRange.last_i;
     1961end
     1962if isfield(Series.IndexRange,'first_j')
     1963    first_j=Series.IndexRange.first_j;
     1964    last_j=Series.IndexRange.last_j;
     1965end
     1966if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),...
     1967    set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
    18791968end
    18801969
     
    22482337function MenuExportConfig_Callback(hObject, eventdata, handles)
    22492338global Series
    2250 [tild,Series,errormsg]=prepare_jobs(handles,0);
     2339[tild,Series,errormsg]=prepare_jobs(handles);
    22512340% Series=read_GUI(handles.series);
    22522341
     
    24922581ActionName=ActionList{get(handles.ActionName,'Value')};
    24932582if strcmp(ActionExt,'.sh')
    2494     ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName ActionExt]);
     2583    ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']);
    24952584    if ~exist(ActionFullName,'file')
    24962585        answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?');
     
    25022591        end
    25032592    end
     2593    currentdir=pwd;
     2594    cd(get(handles.ActionPath,'String'))
     2595    sh_file=dir([ActionName '.sh']);
     2596    m_file=dir([ActionName '.m']);
     2597    if isfield(m_file,'datenum') && m_file.datenum>sh_file.datenum
     2598        set(handles.ActionExt,'BackgroundColor',[1 1 0])
     2599        answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']);
     2600        if strcmp(answer,'Yes')
     2601            compile(ActionName)
     2602        end
     2603        set(handles.ActionExt,'BackgroundColor',[1 1 1])
     2604    end
     2605    cd(currentdir)
    25042606end
    25052607
  • trunk/src/series/aver_stat.m

    r592 r594  
    6262
    6363%%%%%%%%%%%%  STANDARD PART  %%%%%%%%%%%%
     64ParamOut=[];
    6465%% read input parameters from an xml file if input is a file name (batch mode)
    6566checkrun=1;
  • trunk/src/series/check_data_files.m

    r592 r594  
    3434function ParamOut=check_data_files(Param)
    3535
    36 % %% set the input elements needed on the GUI series when the action is selected in the menu ActionName
    37 % if ~exist('Param','var') % case with no input parameter
    38 %     ParamOut={'NbViewMax';'';...% max nbre of input file series (default='' , no limitation)
    39 %         'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default)
    40 %         'NbSlice';'on'; ...%nbre of slices ('off' by default)
    41 %         'VelType';'off';...% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
    42 %         'FieldName';'off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
    43 %         'FieldTransform'; 'off';...%can use a transform function
    44 %         'ProjObject';'off';...%can use projection object(option 'off'/'on',
    45 %         'Mask';'off';...%can use mask option   (option 'off'/'on', 'off' by default)
    46 %         'OutputDirExt';'';...%set the output dir extension
    47 %                ''};
    48 %         return
    49 % end
    5036%% input preparation mode (no RUN)
    5137if isstruct(Param) && isequal(Param.Action.RUN,0)
    52     ParamOut.AllowInputSort='off';...% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
    53     ParamOut.WholeIndexRange='off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
    54     ParamOut.NbSlice='on'; ...%nbre of slices ('off' by default)
    55     ParamOut.VelType='off';...% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
    56     ParamOut.FieldName='off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
    57     ParamOut.FieldTransform = 'off';...%can use a transform function
    58     ParamOut.ProjObject='off';...%can use projection object(option 'off'/'on',
    59     ParamOut.Mask='off';...%can use mask option   (option 'off'/'on', 'off' by default)
     38    ParamOut.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
     39    ParamOut.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
     40    ParamOut.NbSlice='on';%nbre of slices ('off' by default)
     41    ParamOut.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
     42    ParamOut.FieldName='off';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
     43    ParamOut.FieldTransform = 'off';%can use a transform function
     44    ParamOut.ProjObject='off';%can use projection object(option 'off'/'on',
     45    ParamOut.Mask='off';%can use mask option   (option 'off'/'on', 'off' by default)
    6046    ParamOut.OutputDirExt='';%set the output dir extension (blank=no output dir)
    6147return
    6248end
    6349%%%%%%%%%%%%  STANDARD PART  %%%%%%%%%%%%
    64 %% select different modes,  RUN, parameter input, BATCH
    65 % BATCH  case: read the xml file for batch case
     50
     51%% read input parameters from an xml file if input is a file name (batch mode)
     52checkrun=1;
    6653if ischar(Param)
    67         Param=xml2struct(Param);
    68         checkrun=0;
    69 % RUN case: parameters introduced as the input structure Param
    70 else
    71     if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
    72         checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
    73     else
    74         checkrun=2; % indicate the RUN option is used
    75     end
    76     hseries=guidata(Param.hseries);%handles of the GUI series
     54    Param=xml2struct(Param);% read Param as input file (batch case)
     55    checkrun=0;
    7756end
    78 ParamOut=Param; %default output
    79 %OutputDir=[Param.OutputSubDir Param.OutputDirExt];NO OUTPUT FILE
    80    
     57
    8158%% root input file(s) and type
    8259RootPath=Param.InputTable(:,1);
     
    126103        Tabchar{4}=FileInfo.ImageType;
    127104        Tabchar{5}=['  compression' FileInfo.VideoCompression];
    128         Tabchar{6}=[ 'quality ' num2str(FileInfo.Quality)];   
     105        Tabchar{6}=[ 'quality ' num2str(FileInfo.Quality)];
    129106    else
    130107        Tabchar={};
     
    135112            datnum=zeros(1,nbfield_j);
    136113            for ifile=1:nbfield_i
    137                 stopstate=get(hseries.RUN,'BusyAction');
     114                if checkrun
     115                    stopstate=get(Param.RUNHandle,'BusyAction');
     116                    update_waitbar(Param.WaitbarHandle,ifile/nbfield_i)
     117                else
     118                    stopstate='queue';
     119                end
    138120                if isequal(stopstate,'queue')% enable STOP command
    139                     update_waitbar(hseries.Waitbar,ifile/nbfield_i)         
    140121                    file=filecell{iview,index_slice(ifile)};
    141122                    [Path,Name,ext]=fileparts(file);
     
    148129                            datnum(ifile)=datfile.datenum;
    149130                            filefound(ifile)={datfile.name};
    150                         end                     
     131                        end
    151132                        lastfield='';
    152133                        [FileType{iview},FileInfo,Object]=get_file_type(file);
    153134                        if strcmp(FileType{iview},'civx')||strcmp(FileType{iview},'civdata')
    154135                            if isfield(FileInfo,'CivStage')
    155                             liststage={'civ1','fix1','patch1','civ2','fix2','patch2'};
    156                             lastfield=liststage{FileInfo.CivStage};
     136                                liststage={'civ1','fix1','patch1','civ2','fix2','patch2'};
     137                                lastfield=liststage{FileInfo.CivStage};
    157138                            end
    158139                        end
    159                         lastfield=[FileType{iview} ', ' lastfield];                   
     140                        lastfield=[FileType{iview} ', ' lastfield];
    160141                    end
    161142                    Tabchar(1,i_slice)={['slice #' num2str(i_slice)]};
     
    168149                message=['no set of ' num2str(NbSlice) ' (NbSlices) files found'];
    169150            else
    170                  message='no file found';
     151                message='no file found';
    171152            end
    172153        else
     
    177158            message={['oldest modification:  ' filefound{ind} ' : ' datestr(first)];...
    178159                ['latest modification:  ' filefound{indlast} ' : ' datestr(last)]};
    179         end 
     160        end
    180161        if ~isempty(Tabchar)
    181           Tabchar=reshape(Tabchar,NbSlice*(nbfield_i+1),1);
     162            Tabchar=reshape(Tabchar,NbSlice*(nbfield_i+1),1);
    182163        end
    183164    end
Note: See TracChangeset for help on using the changeset viewer.