Changeset 1068 for trunk/src/series.m


Ignore:
Timestamp:
Jul 9, 2019, 10:10:18 AM (5 years ago)
Author:
sommeria
Message:

replicate updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r1067 r1068  
    15941594end
    15951595
    1596 %% Look for prcessing on multiple experiments set by the GUI browse_data
    1597 NbExp=1;
    1598 ListExp=Param.InputTable(1,1);
    1599 
     1596%% Look for processing on multiple experiments set by the GUI browse_data
     1597NbExp=1;% initiate the number of experiments set by the GUI browse_data, =1 otherwise
    16001598if get(handles.Replicate,'Value')
     1599    set(handles.Replicate,'BackgroundColor',[1 1 0])%paint Relicate button in yellow
    16011600    hh=findobj(allchild(0),'Tag','browse_data');
    16021601    BrowseData=guidata(hh);
    16031602    SourceDir=get(BrowseData.SourceDir,'String');
    16041603    ListExp=get(BrowseData.ListExperiments,'String');
    1605     ListExp=ListExp(get(BrowseData.ListExperiments,'Value'));
    1606     NbExp=numel(ListExp) % number of experiments set possibly by the GUI browse_data, =1 otherwise
    1607     for ilist=1:NbExp
    1608         ListExp{ilist}=regexprep(ListExp{ilist},'+','');
    1609         ListExp{ilist}= [SourceDir ListExp{ilist}];
    1610     end
    1611 end
    1612 
     1604    ExpIndices=get(BrowseData.ListExperiments,'Value');
     1605    ListExp=ListExp(ExpIndices);
     1606    ListDevices=get(BrowseData.ListDevices,'String');
     1607    DeviceIndices=get(BrowseData.ListDevices,'Value');
     1608    ListDevices=ListDevices(DeviceIndices);
     1609    ListDataSeries=get(BrowseData.DataSeries,'String');
     1610    DataSeriesIndices=get(BrowseData.DataSeries,'Value');
     1611    ListDataSeries=ListDataSeries(DataSeriesIndices);
     1612    NbExp=0; % counter of the number of experiments set by the GUI browse_data
     1613    for iexp=1:numel(ListExp)
     1614        if ~isempty(regexp(ListExp{iexp},'^\+/'))% if it is a folder
     1615            for idevice=1:numel(ListDevices)
     1616                if ~isempty(regexp(ListDevices{idevice},'^\+/'))% if it is a folder
     1617                    for isubdir=1:numel(ListDataSeries)
     1618                        if ~isempty(regexp(ListDataSeries{isubdir},'^\+/'))% if it is a folder
     1619                            lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),...
     1620                                regexprep(ListDevices{idevice},'^\+/',''));
     1621                            ldir= regexprep(ListDataSeries{isubdir},'^\+/','');
     1622                            if exist(fullfile(lpath,ldir),'dir')
     1623                                NbExp=NbExp+1;
     1624                                ListPath{NbExp}=lpath;
     1625                                ListSubdir{NbExp}=ldir;
     1626                                ExpIndex{NbExp}=iexp;
     1627                            end
     1628                        end
     1629                    end
     1630                end
     1631            end
     1632        end
     1633    end
     1634    answer=msgbox_uvmat('INPUT_Y-N-Cancel',['replicate the processing on ' num2str(NbExp) ' data series']);
     1635    if strcmp(answer,'Cancel')||strcmp(answer,'No')
     1636        return
     1637    end
     1638end
     1639%      set(handles.OutputSubDir,'String',SubDir)
     1640%      Param.OutputSubDir=SubDir;
    16131641%%%%%%%%%%%%%%%%%%% LOOP ON EXPERIMENTS POSSIBLY SET BY THE GUI browse_data, NbExp=1 otherwise %%%%%%%%%
    16141642for iexp=1:NbExp
    1615     Param.InputTable{1,1}=ListExp{iexp};
    1616     set(handles.InputTable,'Data',Param.InputTable)
    1617     [xx,ExpName]=fileparts(ListExp{iexp});
     1643    if get(handles.Replicate,'Value')
     1644        if ~strcmp(get(handles.RUN,'BusyAction'),'queue')% allow for STOP action
     1645            disp('program stopped by user')
     1646            return
     1647        end
     1648        set(BrowseData.ListExperiments,'Value',ExpIndex{iexp})
     1649        Param.InputTable{1,1}=ListPath{iexp};
     1650        Param.InputTable{1,2}=ListSubdir{iexp};
     1651        Param.OutputSubDir=ListSubdir{iexp};
     1652        set(handles.InputTable,'Data',Param.InputTable)
     1653%         set(handles.OutputSubDir,'String',ListSubdir{iexp})
     1654    end
     1655    [xx,ExpName]=fileparts(Param.InputTable{1,1});
    16181656    Param.IndexRange.first_i=str2num(get(handles.num_first_i,'String'));%reset the firrst_i and last_i for multiple experiments, modified by the splitting into NbProcess
    16191657    Param.IndexRange.last_i=str2num(get(handles.num_last_i,'String'));
     
    16211659    OutputDir='';
    16221660    answer='';
    1623     if isfield(Param,'OutputSubDir')
     1661    if isfield(Param,'OutputSubDir')% possibly update the output dir if it already exists
    16241662        SubDirOut=[get(handles.OutputSubDir,'String') Param.OutputDirExt];
    16251663        SubDirOutNew=SubDirOut;
     
    16591697        Param.OutputRootFile=Param.InputTable{1,3}; % the first sorted RootFile taken for output
    16601698        set(handles.OutputDirExt,'String',Param.OutputDirExt)
    1661         OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory
     1699        OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]) % full name (with path) of output directory
    16621700        if check_create    % create output directory if it does not exist
    16631701            [tild,msg1]=mkdir(OutputDir);
     
    16771715            errormsg=['cannot create ' DirXml ': ' msg1]; % error message for directory creation
    16781716            return
     1717        end
     1718        [success,msg] = fileattrib(DirXml,'+w','g','s'); % allow writing access for the group of users, recursively in the folder
     1719        if success==0
     1720            msgbox_uvmat('WARNING',{['unable to set group write access to ' DirXml ':']; msg}); % error message for directory creation
    16791721        end
    16801722    end
     
    18611903                return
    18621904            end
     1905            [success,msg] = fileattrib(DirExe,'+w','g','s'); % allow writing access for the group of users, recursively in the folder
     1906            if success==0
     1907                msgbox_uvmat('WARNING',{['unable to set group write access to ' DirExe ':']; msg}); % error message for directory creation
     1908            end
    18631909        end
    18641910        %create subdirectory for log files
     
    18691915                errormsg=['cannot create ' DirLog ': ' msg1]; % error message for directory creation
    18701916                return
     1917            end
     1918            [success,msg] = fileattrib(DirLog,'+w','g','s'); % allow writing access for the group of users, recursively in the folder
     1919            if success==0
     1920                msgbox_uvmat('WARNING',{['unable to set group write access to ' DirLog ':']; msg}); % error message for directory creation
    18711921            end
    18721922        end
     
    20242074            fclose(fid);
    20252075            if status==0
    2026             msgbox_uvmat('CONFIRMATION',[ActionFullName ' launched for ' ExpName ' as ' num2str(NbProcess) ' processes in cluster: press STATUS to see results'])
     2076                msgbox_uvmat('CONFIRMATION',[ActionFullName ' launched for ' ExpName ' as ' num2str(NbProcess) ' processes in cluster: press STATUS to see results'])
    20272077            else
    2028                msgbox_uvmat('ERROR',result)
     2078                msgbox_uvmat('ERROR',result)
    20292079            end
    20302080            %     case 'cluster_pbs' % for LMFA Kepler machine:  trqnsferred to fct
     
    21442194    end
    21452195end
     2196set(handles.Replicate,'BackgroundColor',[0 1 0])
     2197if NbExp>1
     2198    set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta (input file features need to be updated)
     2199end
    21462200%------------------------------------------------------------------------
    21472201function STOP_Callback(hObject, eventdata, handles)
     
    21602214Param=read_GUI(handles.series);
    21612215
    2162 %% clean the output structure by removing unused information 
     2216%% clean the output structure by removing unused information
    21632217if isfield(Param,'Pairs')
    21642218    Param=rmfield(Param,'Pairs'); % info Pairs not needed for output
     
    22032257ActionList=get(handles.ActionName,'String'); % list menu fields
    22042258ActionIndex=get(handles.ActionName,'Value');
    2205 if ~isequal(ActionIndex,1)% if we are not just opening series 
     2259if ~isequal(ActionIndex,1)% if we are not just opening series
    22062260    InputTable=get(handles.InputTable,'Data');
    22072261    if isempty(InputTable{1,4})
     
    23012355
    23022356set(handles.ActionInput,'BackgroundColor',[1 1 0])
     2357SeriesData=get(handles.series,'UserData'); % info on the input file series
    23032358
    23042359%% create the function handle for Action
     
    23082363if ~exist(ActionPath,'dir')
    23092364    ActionName_Callback(handles.ActionName, ActionPath, handles)% update the function
    2310 %     msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
    23112365    return
    23122366end
     
    23192373Param=read_GUI_series(handles); % read the parameters from the GUI series
    23202374Param.Action.RUN=0;
     2375Param.SeriesData=SeriesData;
    23212376ParamOut=h_fun(Param); % run the selected Action function to get the relevant input
    23222377
     
    23372392
    23382393%% Detect the types of input files and set menus and default options in 'VelType'
    2339 SeriesData=get(handles.series,'UserData'); % info on the input file series
    23402394iview_civ=find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));
    23412395iview_netcdf=find(strcmp('netcdf',SeriesData.FileType)|strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType)); % all nc files, icluding civ
     
    24692523    set(handles.MinIndex_j,'Data',MinIndex_j(iview,:));
    24702524    set(handles.MaxIndex_i,'Data',MaxIndex_i(iview,:));
    2471     set(handles.MaxIndex_j,'Data',MaxIndex_j(iview,:));
     2525    set(handles.MaxIndex_j,'Data',MaxIndex_j(iview,:));;
    24722526    TimeTable=get(handles.TimeTable,'Data');
    2473     set(handles.TimeTable,'Data',TimeTable(iview,:));
     2527    if size(TimeTable,1)<size(Param.InputTable,1)%if the time table is not complete, copy the missing lines from the previous ones
     2528        for iline=size(TimeTable,1)+1:size(Param.InputTable,1)
     2529            TimeTable(iline,:)=TimeTable(iline-1,:);
     2530        end
     2531    end
     2532    set(handles.TimeTable,'Data',TimeTable(iview,:));% sort the time tables
    24742533    PairString=get(handles.PairString,'Data');
    24752534    set(handles.PairString,'Data',PairString(iview,:));
Note: See TracChangeset for help on using the changeset viewer.