Changeset 996 for trunk


Ignore:
Timestamp:
Feb 6, 2017, 4:02:20 PM (4 years ago)
Author:
sommeria
Message:

button ActionInput? introduced in series

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r994 r996  
    133133
    134134%% Read the parameter file series.xml, or created from series.xml.default if it does not exist
     135SeriesData=[];
    135136[path_series,name,ext]=fileparts(which('series'));% path to the GUI series
    136137xmlfile=fullfile(path_series,'series.xml');
     
    140141if exist(xmlfile,'file')
    141142    SeriesData.SeriesParam=xml2struct(xmlfile);
    142 %     if ismember(RunMode,{'cluster_oar','cluster_pbs','cluster_sge'}) && isfield(s,'BatchParam')
    143 %         if isfield(s.BatchParam,'NbCoreDefault')
    144 %             NbCoreDefault=s.BatchParam.NbCoreDefault;
    145 %         end
    146 %     elseif ismember(RunMode,{'background','local'}) && isfield(s,'RunParam')
    147 %         if isfield(s.RunParam,'NbCore')
    148 %             NbCoreDefault=s.RunParam.NbCoreDefault;
    149 %         end
    150 %     end
    151143end
    152144
     
    291283
    292284%% introduce the input file name(s) if defined from input Param,
    293 set(handles.series,'UserData',[])% initiate Userdata
     285set(handles.series,'UserData',SeriesData)% initiate Userdata
    294286if isfield(Param,'InputFile')
    295287   
     
    593585end
    594586set(handles.InputLine,'String',num2str(iline));
    595 % set(handles.InputTable,'UserData',iline);
    596587
    597588%------------------------------------------------------------------------
     
    678669set(handles.TimeTable,'Data',TimeTable(1:nbview,:));
    679670
    680 %% enable field and veltype menus, in accordance with the current action
    681 ActionName_Callback([],[], handles)
    682 
    683671%% set length of waitbar
    684672displ_time(handles)
    685 
    686673set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (indicate activation finished)
    687674set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch'
     675
     676%% enable field and veltype menus, in accordance with the current action
     677ActionInput_Callback([],[], handles)
     678
    688679
    689680%------------------------------------------------------------------------
     
    14381429
    14391430%% settings of the button RUN
     1431if ~isequal(get(handles.ActionInput,'BackgroundColor'),[1 0 0])
     1432    msgbox_uvmat('ERROR','first activate the button ActionInput')
     1433    return
     1434end
    14401435set(handles.RUN,'BusyAction','queue'); % activation of STOP button will set BusyAction to 'cancel'
    14411436set(handles.RUN, 'Enable','Off')% avoid further RUN action until the current one is finished
     
    15731568        NbCore=1; % no need to split the calculation
    15741569    case 'cluster_oar'
    1575         NbCoreDefault=SeriesData.SeriesParam.ClusterParam{1}.NbCoreDefault;%proposed number of cores (for cluster)
    1576         %%%%% TEST A REMETTRE%%%%%
    1577  %       if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
    1578 %             NbCore=1; % one core used only (limitation of Matlab licences)
    1579 %             answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
    1580 %             if ~strcmp(answer,'Yes')
    1581 %                 errormsg='Action launch interrupted by user';
    1582 %                 return
    1583 %             end
    1584 %             extra_oar='';
    1585  %       else
    1586             answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{num2str(NbCoreDefault),''});
     1570        NbCoreDefault=SeriesData.OarParam.NbCoreDefault;%proposed number of cores (for cluster)
     1571            if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
     1572            warning_string=', preferably use .sh option to save Matlab licences';
     1573            else
     1574                warning_string='';
     1575            end
     1576            answer=inputdlg({['Number of cores (max 36)' warning_string],'extra oar options'},'oarsub parameter',1,{num2str(NbCoreDefault),''});
    15871577            if isempty(answer)
    15881578                                errormsg='Action launch interrupted by user';
     
    16841674    last_i=Param.IndexRange.last_i;
    16851675end
    1686 if isfield(Param.IndexRange,'first_j')
     1676if isfield(Param.IndexRange,'incr_j')
    16871677    first_j=Param.IndexRange.first_j;
    16881678    last_j=Param.IndexRange.last_j;
     
    21452135end
    21462136if exist(OutputDir,'dir')
    2147     [SUCCESS,MESSAGE,MESSAGEID] = fileattrib (OutputDir)
     2137    [SUCCESS,MESSAGE,MESSAGEID] = fileattrib (OutputDir);
    21482138    if MESSAGE.GroupWrite~=1
    21492139    [success,msg] = fileattrib(OutputDir,'+w','g','s'); % allow writing access for the group of users, recursively in the folder
     
    22932283update_waitbar(handles.Waitbar,0)
    22942284
    2295 %% create the function handle for Action
    2296 if ~exist(ActionPath,'dir')
    2297     msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
    2298     return
    2299 end
    2300 current_dir=pwd; % current working dir
    2301 cd(ActionPath)
    2302 h_fun=str2func(ActionName);
    2303 cd(current_dir)
    2304 
    2305 %
    2306 % checkaddpath=0;
    2307 % path_series=which('series');
    2308 % %eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION
    2309 % spath=fileparts(which(ActionName)); % spath = current path of the selected function ACTION
    2310 % if ~exist(ActionPath,'dir')
    2311 %     msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
    2312 %     return
    2313 % end
    2314 % if ~strcmp(spath,ActionPath)
    2315 %     if strcmp(pwd,spath)
    2316 %         msgbox_uvmat('ERROR',[ 'a function called ' ActionName ' on your working space oversets the selected one']);
    2317 %         return
    2318 %     else
    2319 %         addpath(ActionPath)% add the prescribed path if not the current one
    2320 %         checkaddpath=1;
    2321 %     end
    2322 % end
    2323 % eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION
    2324 % if checkaddpath && ~isequal(ActionPath,path_series)
    2325 %     rmpath(ActionPath)% add the prescribed path if not the current one
    2326 % end
    2327 
    2328 %% Activate the Action fct to adapt the configuration of the GUI series and bring specific parameters in SeriesData
    2329 Param=read_GUI_series(handles); % read the parameters from the GUI series
    2330 ParamOut=h_fun(Param); % run the selected Action function to get the relevant input
    2331 
    23322285%% Put the first line of the selected Action fct as tooltip help
    23332286try
     
    23372290    set(handles.ActionName,'ToolTipString',InputText{1}{1})% put the first line of the selected function as tooltip help
    23382291end
     2292set(handles.ActionName,'BackgroundColor',[1 1 1])
     2293set(handles.ActionInput,'BackgroundColor',[1 0 1])% set ActionInput button to magenta color to indicate that input refr
     2294
     2295
     2296% --- Executes on button press in ActionInput.
     2297function ActionInput_Callback(hObject, eventdata, handles)
     2298
     2299set(handles.ActionInput,'BackgroundColor',[1 1 0])
     2300
     2301%% create the function handle for Action
     2302ActionPath=get(handles.ActionPath,'String');
     2303ActionList=get(handles.ActionName,'String');
     2304ActionName= ActionList{get(handles.ActionName,'Value')}; % selected function name
     2305if ~exist(ActionPath,'dir')
     2306    msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
     2307    return
     2308end
     2309current_dir=pwd; % current working dir
     2310cd(ActionPath)
     2311h_fun=str2func(ActionName);
     2312cd(current_dir)
     2313
     2314%% Activate the Action fct to adapt the configuration of the GUI series and bring specific parameters in SeriesData
     2315Param=read_GUI_series(handles); % read the parameters from the GUI series
     2316ParamOut=h_fun(Param); % run the selected Action function to get the relevant input
    23392317
    23402318
     
    25422520
    25432521%% NbSlice visibility
    2544 %NbSliceVisible='off'; % default
    25452522if isfield(ParamOut,'NbSlice') && (strcmp(ParamOut.NbSlice,'on')||isnumeric(ParamOut.NbSlice))
    25462523    set(handles.num_NbSlice,'Visible','on')
     
    25492526    set(handles.num_NbSlice,'Visible','off')
    25502527    set(handles.NbSlice_title,'Visible','off')
    2551     %     set(handles.num_NbProcess,'String',get(handles.num_NbSlice,'String'))% the nbre of processes is imposed as the nbre of slices
    2552     % else
    2553     %     set(handles.num_NbProcess,'String','')% free nbre of processes
    25542528end
    25552529if isnumeric(ParamOut.NbSlice)
     
    25592533    set(handles.num_NbSlice,'Enable','on'); % NbSlice can be modified on the GUI series
    25602534end
    2561 % set(handles.num_NbSlice,'Visible',NbSliceVisible)
    2562 % set(handles.NbSlice_title,'Visible',NbSliceVisible)
    2563 
    2564 
    25652535
    25662536%% Visibility of FieldTransform menu
     
    26122582    OutputSubDirMode=ParamOut.OutputSubDirMode;
    26132583end
     2584InputTable=get(handles.InputTable,'Data');
    26142585switch OutputSubDirMode
    26152586    case 'auto'; % default
     
    26652636%% definition of an additional parameter set, determined by an ancillary GUI
    26662637if isfield(ParamOut,'ActionInput')
    2667     set(handles.ActionInput,'Visible','on')
     2638%     set(handles.ActionInput,'Visible','on')
    26682639    ParamOut.ActionInput.Program=ActionName; % record the program in ActionInput
    26692640    SeriesData.ActionInput=ParamOut.ActionInput;
    26702641else
    2671     set(handles.ActionInput,'Visible','off')
     2642%     set(handles.ActionInput,'Visible','off')
    26722643    if isfield(SeriesData,'ActionInput')
    26732644        SeriesData=rmfield(SeriesData,'ActionInput');
     
    26752646end
    26762647set(handles.series,'UserData',SeriesData)
    2677 set(handles.ActionName,'BackgroundColor',[1 1 1])
     2648set(handles.ActionInput,'BackgroundColor',[1 0 0])
    26782649
    26792650%------------------------------------------------------------------------
     
    33003271end       
    33013272if isfield(Param,'ActionInput')%  introduce  parameters specific to an Action fct, for instance PIV parameters
    3302     set(handles.ActionInput,'Visible','on')
    3303     set(handles.ActionInput,'Value',0)
     3273%     set(handles.ActionInput,'Visible','on')
     3274%     set(handles.ActionInput,'Value',0)
    33043275    Param.ActionInput.ConfigSource=filexml; % record the source of config for future info
    33053276    SeriesData.ActionInput=Param.ActionInput;
     
    37703741% --- Executes on button press in DiskQuota.
    37713742function DiskQuota_Callback(hObject, eventdata, handles)
    3772 system('quota -s -g -A')
     3743SeriesData=get(handles.series,'UserData');
     3744system(SeriesData.SeriesParam.DiskQuotaCmd)
     3745
     3746
     3747
  • trunk/src/series.xml.default

    r993 r996  
    11<?xml version="1.0"?>
    22<SeriesParam>
    3 <ClusterParam>
    4 <Name>cluster_oar</Name>!-- Cluster name to be displayed in the menu
    5 <CheckString>s=system('oarstat')</CheckString>!-- Matlab command for detecting the cluster
    6 <NbCoreDefault>16</NbCoreDefault>!-- proposed number of cores by default
    7 </ClusterParam>
    8 <ClusterParam>
    9 <Name>cluster_pbs</Name>!-- Cluster name to be displayed in the menu
    10 </ClusterParam>
    11 <ClusterParam>
    12 <Name>cluster_sge</Name>!-- Cluster name to be displayed in the menu
    13 CheckString>[s,w]=system('oarstat')</CheckString>
    14 </ClusterParam>
     3   <DiskQuotaCmd>quota -s -g -A</DiskQuotaCmd>
     4<OarParam>
     5   <NbCoreDefault>16</NbCoreDefault><!--proposed default number of parallel cores for a job -->
     6   <MinEstimatedCPUTime unit="minute">20</MinEstimatedCPUTime><!--used to group the iterations into jobs of sufficient CPU time-->
     7   <MaxJobNumber>500</MaxJobNumber><!--maximum number of jobs allowed (will group the iterations to fit in)-->
     8   <JobStatCmd>oarstat |grep N=UVmat</JobStatCmd>   
     9</OarParam>
     10<SgeParam>
     11</SgeParam>
    1512</SeriesParam>
  • trunk/src/series/civ_series.m

    r995 r996  
    439439                end
    440440            end
    441             par_civ1.ImageWidth=size(par_civ1.ImageA,2);%FileInfo_A.Width;
    442             par_civ1.ImageHeight=size(par_civ1.ImageA,1);%FileInfo_A.Height;
     441            par_civ1.ImageWidth=size(par_civ1.ImageA,2);
     442            par_civ1.ImageHeight=size(par_civ1.ImageA,1);
    443443            list_param=(fieldnames(Param.ActionInput.Civ1))';
    444444            list_param(strcmp('TestCiv1',list_param))=[];% remove the parameter TestCiv1 from the list
Note: See TracChangeset for help on using the changeset viewer.