Changeset 845 for trunk/src/series.m


Ignore:
Timestamp:
Dec 17, 2014, 12:32:52 PM (9 years ago)
Author:
sommeria
Message:

stereo_civ updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r844 r845  
    13081308function RUN_Callback(hObject, eventdata, handles)
    13091309
    1310 %% read the data on the GUI series
    1311 Param=read_GUI_series(handles);%displayed parameters
    1312 SeriesData=get(handles.series,'UserData');%hidden parameters
    1313 if ~isfield(SeriesData,'i1_series')
    1314     msgbox_uvmat('ERROR','The input field series needs to be refreshed: press REFRESH')
    1315     return
    1316 end
    1317 if isfield(Param,'InputFields')&& isequal(Param.InputFields.FieldName,'get_field...')
    1318     msgbox_uvmat('ERROR','input field name(s) not defined, select get_field...')
    1319     return
    1320 end
    1321 
    13221310%% settings of the button RUN
    13231311set(handles.RUN,'BusyAction','queue');% activation of STOP button will set BusyAction to 'cancel'
     
    13261314drawnow
    13271315set(handles.status,'Value',0)% desable status display if relevant
    1328 status_Callback(hObject, eventdata, handles)
     1316status_Callback([], eventdata, handles)
     1317
     1318%% launch action
     1319errormsg=launch_action(handles);
     1320if ~isempty(errormsg)
     1321     msgbox_uvmat('ERROR',errormsg)
     1322end
     1323
     1324%% reset the GUI series
     1325update_waitbar(handles.Waitbar,1); % put the waitbar to end position to indicate launching is finished
     1326set(handles.RUN, 'Enable','On')
     1327set(handles.RUN,'BackgroundColor',[1 0 0])
     1328set(handles.RUN, 'Value',0)
     1329
     1330%------------------------------------------------------------------------
     1331% --- called by RUN_Callback
     1332%------------------------------------------------------------------------
     1333function errormsg=launch_action(handles)
     1334errormsg='';%default
     1335
     1336%% read the data on the GUI series
     1337Param=read_GUI_series(handles);%displayed parameters
     1338SeriesData=get(handles.series,'UserData');%hidden parameters
     1339if ~isfield(SeriesData,'i1_series')
     1340    errormsg='The input field series needs to be refreshed: press REFRESH';
     1341    return
     1342end
     1343if isfield(Param,'InputFields')&& isequal(Param.InputFields.FieldName,'get_field...')
     1344    errormsg='input field name(s) not defined, select get_field...';
     1345    return
     1346end
    13291347
    13301348%% select the Action mode, 'local', 'background' or 'cluster' (if available)
     
    13411359ActionName=Param.Action.ActionName;
    13421360ActionPath=Param.Action.ActionPath;
    1343 
    13441361path_series=fileparts(which('series'));
    13451362
     
    13491366        eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION
    13501367        if ~exist(ActionPath,'dir')
    1351             msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
     1368            errormsg=['The prescribed function path ' ActionPath ' does not exist'];
    13521369            return
    13531370        end
     
    13901407    end
    13911408    if isempty(RunTime) && strcmp(RunMode,'cluster_oar')
    1392         msgbox_uvmat('ERROR','RunTime name not found in PARAM.xml, compiled version .sh cannot run on cluster')
     1409       errormsg='RunTime name not found in PARAM.xml, compiled version .sh cannot run on cluster';
    13931410        return
    13941411    end
     
    14631480
    14641481%% create the output data directory if needed
    1465 OutpuDir='';
     1482OutputDir='';
    14661483if isfield(Param,'OutputSubDir')
    14671484    SubDirOut=[get(handles.OutputSubDir,'String') Param.OutputDirExt];
     
    14721489        answer=msgbox_uvmat('INPUT_Y-N',['use existing ouput directory: ' fullfile(Param.InputTable{1,1},SubDirOutNew) ', possibly delete previous data']);
    14731490        if strcmp(answer,'Cancel')
    1474             errormsg='Cancel';
     1491            set(handles.RUN,'backgroundcolor',[1 0 0])
    14751492            return
    14761493        elseif strcmp(answer,'Yes')
     
    14951512        [tild,msg1]=mkdir(OutputDir);
    14961513        if ~strcmp(msg1,'')
    1497             msgbox_uvmat('ERROR',['cannot create ' OutputDir ': ' msg1]);%error message for directory creation
     1514            errormsg=['cannot create ' OutputDir ': ' msg1];%error message for directory creation
    14981515            return
    14991516        end
     
    15011518        if success==0
    15021519            msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg1});%error message for directory creation
    1503             return
    15041520        end
    15051521    end
     
    15121528    [tild,msg1]=mkdir(DirXml);
    15131529    if ~strcmp(msg1,'')
    1514         msgbox_uvmat('ERROR',['cannot create ' DirXml ': ' msg1]);%error message for directory creation
     1530        errormsg=['cannot create ' DirXml ': ' msg1];%error message for directory creation
    15151531        return
    15161532    end
     
    15401556end
    15411557if last_i < first_i || last_j < first_j
    1542     msgbox_uvmat('ERROR', 'series/Run_Callback:last field index must be larger or equal to the first one')
    1543     set(handles.RUN, 'Enable','On'),
    1544     set(handles.RUN,'BackgroundColor',[1 0 0])
     1558    errormsg= 'series/Run_Callback:last field index must be larger or equal to the first one';
    15451559    return
    15461560end
     
    16261640        end
    16271641    end
    1628 % elseif strcmp(get(handles.OutputDirExt,'Visible'),'off')
    1629 %     msgbox_uvmat('ERROR',['no output file for Action ' ActionName ', use run mode = local']);% a output dir is needed for background option
    1630 %     return
    16311642else
    16321643    %% processing on a different session of the same computer (background) or cluster, create executable files
     
    16431654        [tild,msg1]=mkdir(DirBat);
    16441655        if ~strcmp(msg1,'')
    1645             msgbox_uvmat('ERROR',['cannot create ' DirBat ': ' msg1]);%error message for directory creation
     1656            errormsg=['cannot create ' DirBat ': ' msg1];%error message for directory creation
    16461657            return
    16471658        end
     
    16521663        [tild,msg1]=mkdir(DirLog);
    16531664        if ~strcmp(msg1,'')
    1654             msgbox_uvmat('ERROR',['cannot create ' DirLog ': ' msg1]);%error message for directory creation
     1665            errormsg=['cannot create ' DirLog ': ' msg1];%error message for directory creation
    16551666            return
    16561667        end
     
    16841695        [fid,message]=fopen(filebat,'w');% create the executable file
    16851696        if isequal(fid,-1)
    1686             msgbox_uvmat('ERROR', ['creation of .bat file: ' message]);
     1697            errormsg=['creation of .bat file: ' message];
    16871698            return
    16881699        end
     
    17421753        for iprocess=1:NbProcess
    17431754            system([batch_file_list{iprocess} ' &'])% directly execute the command file for each process
    1744             msgbox_uvmat('CONFIRMATION',[ActionName 'launched in background: press STATUS to see results'])
     1755            msgbox_uvmat('CONFIRMATION',[ActionName ' launched in background: press STATUS to see results'])
    17451756        end
    17461757    case 'cluster_oar' % option 'oar-parexec' used
     
    17551766            [tild,msg1]=mkdir(DirOAR);
    17561767            if ~strcmp(msg1,'')
    1757                 msgbox_uvmat('ERROR',['cannot create ' DirOAR ': ' msg1]);%error message for directory creation
     1768                errormsg=['cannot create ' DirOAR ': ' msg1];%error message for directory creation
    17581769                return
    17591770            end
     
    17851796        msgbox_uvmat('CONFIRMATION',[ActionName ' launched in cluster: press STATUS to see results'])
    17861797end
    1787 
    1788 %% reset the GUI series
    1789 update_waitbar(handles.Waitbar,1); % put the waitbar to end position to indicate launching is finished
    1790 set(handles.RUN, 'Enable','On')
    1791 set(handles.RUN,'BackgroundColor',[1 0 0])
    1792 set(handles.RUN, 'Value',0)
    17931798
    17941799%------------------------------------------------------------------------
     
    21922197    end
    21932198    set(handles.OutputDirExt,'String',OutputDirExt)
    2194     OutputDirVisible='off';
    2195     OutputSubDirMode='auto';%default
    2196     SubDirOut='';
    2197     if isfield(ParamOut,'OutputSubDirMode')
    2198         OutputSubDirMode=ParamOut.OutputSubDirMode;
    2199     end
    2200     switch OutputSubDirMode
    2201         case 'auto';%default
    2202             OutputDirVisible='on';
    2203             SubDir=InputTable(1:end,2); %set of subdirectories
    2204             SubDirOut=SubDir{1};
    2205             if numel(SubDir)>1
    2206                 for ilist=2:numel(SubDir)
    2207                     SubDirOut=[SubDirOut '-' SubDir{ilist}];
    2208                 end
     2199end
     2200OutputDirVisible='off';
     2201OutputSubDirMode='auto';%default
     2202SubDirOut='';
     2203if isfield(ParamOut,'OutputSubDirMode')
     2204    OutputSubDirMode=ParamOut.OutputSubDirMode;
     2205end
     2206switch OutputSubDirMode
     2207    case 'auto';%default
     2208        OutputDirVisible='on';
     2209        SubDir=InputTable(1:end,2); %set of subdirectories
     2210        SubDirOut=SubDir{1};
     2211        if numel(SubDir)>1
     2212            for ilist=2:numel(SubDir)
     2213                SubDirOut=[SubDirOut '-' SubDir{ilist}];
    22092214            end
    2210         case 'first'
    2211             OutputDirVisible='on';
    2212             SubDirOut=InputTable{1,2}; %use the first subdir name (+OutputDirExt) as output  subdirectory
    2213         case 'last'
    2214             OutputDirVisible='on';
    2215             SubDirOut=InputTable{end,2}; %use the last subdir name (+OutputDirExt) as output  subdirectory
    2216     end
    2217     set(handles.OutputSubDir,'String',SubDirOut)
    2218     set(handles.OutputDirExt,'Visible',OutputDirVisible)
    2219     set(handles.OutputSubDir,'Visible',OutputDirVisible)
    2220     set(handles.OutputDir_title,'Visible',OutputDirVisible)
    2221     SeriesData.ActionName=ActionName;%record ActionName for next use
    2222    
    2223    
    2224     %% visibility of the run mode (local or background or cluster)
    2225     if strcmp(OutputSubDirMode,'none')
    2226         RunModeVisible='off';% only local mode available if no output file is produced
    2227     else
    2228         RunModeVisible='on';
    2229     end
    2230     set(handles.RunMode,'Visible',RunModeVisible)
    2231     set(handles.ActionExt,'Visible',RunModeVisible)
    2232     set(handles.RunMode_title,'Visible',RunModeVisible)
    2233     set(handles.ActionExt_title,'Visible',RunModeVisible)
    2234 end
     2215        end
     2216    case 'first'
     2217        OutputDirVisible='on';
     2218        SubDirOut=InputTable{1,2}; %use the first subdir name (+OutputDirExt) as output  subdirectory
     2219    case 'last'
     2220        OutputDirVisible='on';
     2221        SubDirOut=InputTable{end,2}; %use the last subdir name (+OutputDirExt) as output  subdirectory
     2222end
     2223set(handles.OutputSubDir,'String',SubDirOut)
     2224set(handles.OutputDirExt,'Visible',OutputDirVisible)
     2225set(handles.OutputSubDir,'Visible',OutputDirVisible)
     2226set(handles.OutputDir_title,'Visible',OutputDirVisible)
     2227SeriesData.ActionName=ActionName;%record ActionName for next use
     2228
     2229
     2230%% visibility of the run mode (local or background or cluster)
     2231if strcmp(OutputSubDirMode,'none')
     2232    RunModeVisible='off';% only local mode available if no output file is produced
     2233else
     2234    RunModeVisible='on';
     2235end
     2236set(handles.RunMode,'Visible',RunModeVisible)
     2237set(handles.ActionExt,'Visible',RunModeVisible)
     2238set(handles.RunMode_title,'Visible',RunModeVisible)
     2239set(handles.ActionExt_title,'Visible',RunModeVisible)
     2240
    22352241
    22362242%% Expected nbre of output files
     
    29872993    if ~isfield(Param,'OutputSubDir')   
    29882994        msgbox_uvmat('ERROR','no standard sub-directory definition for output files, use a browser to check the output')
     2995        set(handles.status,'BackgroundColor',[0 1 0])
    29892996        return
    29902997    end
Note: See TracChangeset for help on using the changeset viewer.