Changeset 1070 for trunk


Ignore:
Timestamp:
Jul 11, 2019, 7:02:27 PM (17 months ago)
Author:
sommeria
Message:

browse_data improved

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/browse_data.m

    r1069 r1070  
    2525function varargout = browse_data(varargin)
    2626
    27 % Last Modified by GUIDE v2.5 08-Jul-2019 23:32:39
     27% Last Modified by GUIDE v2.5 11-Jul-2019 18:52:06
    2828
    2929% Begin initialization code - DO NOT EDIT
     
    3535    'gui_LayoutFcn',  [] , ...
    3636    'gui_Callback',   []);
    37 if nargin && ischar(varargin{1}) && ~isempty(regexp(varargin{1},'_Callback','once'))
     37if nargin && ischar(varargin{1})
    3838    gui_State.gui_Callback = str2func(varargin{1});
    3939end
     
    4545end
    4646% End initialization code - DO NOT EDIT
     47
    4748
    4849%------------------------------------------------------------------------
     
    146147varargout{1} = handles.output;
    147148%%%%%%%%%%%%%%%%%%delete(handles.browse_data)
     149
     150%------------------------------------------------------------------------
     151% --- Executes on button press in SourceDir.
     152function SourceDir_Callback(hObject, eventdata, handles)
     153SourceDir=get(handles.SourceDir,'String');
     154ListExp=get(handles.ListExperiments,'String');
     155ListExp=ListExp(get(handles.ListExperiments,'Value'));
     156errormsg=scan_campaign(handles,SourceDir,ListExp);
     157if ~isempty(errormsg)
     158    msgbox_uvmat('ERROR',errormsg)
     159    return
     160end
     161%------------------------------------------------------------------------
    148162
    149163%------------------------------------------------------------------------
     
    397411
    398412%------------------------------------------------------------------------
    399 % Provide a list to display
     413% Provide the list (ListFilesTot) to display in DataSeries with the selected indices
    400414%------------------------------------------------------------------------
    401415function [ListFilesTot,indices]=list_dir_3(SourceDir,ListDir,ListSub,ListSubSub,check_fix)
     416% INPUT:
     417%SourceDir: path to the displayed directories
     418%ListDir: list of file and folder names under SourceDir (column 'Experiments')
     419%ListSub: list of file and folder in the second column 'Devices')
     420%ListSubSub: prvious list of file and folder in the third column 'DataSeries', used to mark the selected indices
    402421ListFilesTot={};
    403422for ilist=1:numel(ListDir)
     
    410429                ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
    411430                ListFiles=ListCells(1,:);
     431                check_xml=~cellfun('isempty',regexp(ListFiles,'(\.xml|~)$'));% detect non xml files and files not marked by ~
    412432                check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files
     433                nbfiles=numel(find(~check_xml & ~check_dir));% number of non xml files
     434                check_dir=check_dir & cellfun('isempty', regexp(ListFiles,'^(-|\.|\+/\.)'));% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . )
    413435                ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','+/$0');% put '+/' in front of dir name display
    414                 cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . )
    415                 check_keep=cellfun('isempty', cell_remove);
    416                 ListFilesTot=[ListFilesTot (ListFiles(check_keep))];
     436                %cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . )         
     437                ListFiles=ListFiles(check_dir | check_xml);           
     438                ListFilesTot=[ListFilesTot ListFiles];
     439                if nbfiles>0
     440                    ListFilesTot=[ListFilesTot {[num2str(nbfiles) ' files']}];
     441                end
    417442            end
    418443        end
     
    426451    for ilist=1:numel(ListSubSub)
    427452        index=find(strcmp(ListSubSub{ilist},ListFilesTot));
     453        if check_fix && isempty(index)
     454            ListFilesTot=[ListFilesTot {['---' ListSubSub{ilist}]}];
     455            index=numel(ListFilesTot);
     456        end
    428457        indices=[indices index];
    429458    end
     
    676705set(handles.ListDevices,'Value',list_val);%replace Devices by DataSeries
    677706
    678 [ListFiles,indices]=list_dir_3(SourceDirNew,ListDevices(DeviceIndices),DataSeries(list_val),[]);
     707[ListFiles,indices]=list_dir_3(SourceDirNew,ListDevices(DeviceIndices),DataSeries(list_val),[],0);
    679708set(handles.DataSeries,'String',ListFiles)
    680709set(handles.DataSeries,'Value',indices)% initialise the menu selection with the folder defined by the input
     
    777806%     set(handles.DataSeries,'Value',Index)
    778807% end
     808
     809
     810% --- Executes when user attempts to close browse_data.
     811function browse_data_CloseRequestFcn(hObject, eventdata, handles)
     812% hObject    handle to browse_data (see GCBO)
     813% eventdata  reserved - to be defined in a future version of MATLAB
     814% handles    structure with handles and user data (see GUIDATA)
     815
     816% Hint: delete(hObject) closes the figure
     817delete(hObject);
  • trunk/src/dir_uvmat.m

    r1061 r1070  
    2828
    2929function [ListFiles,errormsg] = dir_uvmat(DirName)
     30ListFiles=[];
    3031errormsg='';
     32if ~ischar(DirName)
     33    errormsg='the function dir_uvmat needs a character string input';
     34    return
     35end
    3136if regexp(DirName,'^http://')
    3237    % OpeNDAP case - read catalog.xml file
     
    3540    str=urlread(catalog);
    3641    catch ME
    37         ListFiles=[];
    3842        errormsg=ME.message;
    3943        return
  • trunk/src/series.m

    r1069 r1070  
    612612function REFRESH_Callback(hObject, eventdata, handles)
    613613%------------------------------------------------------------------------
     614check_input_file_series(handles)
     615
     616%% enable field and veltype menus, in accordance with the current action
     617ActionInput_Callback([],[], handles)
     618
     619
     620function check_input_file_series(handles)
    614621InputTable=get(handles.InputTable,'Data');
    615622set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch'
     
    676683set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch'
    677684
    678 %% enable field and veltype menus, in accordance with the current action
    679 ActionInput_Callback([],[], handles)
    680685
    681686
     
    16611666        Param.InputTable(:,1)=ListPath(:,iexp);
    16621667        Param.InputTable(:,2)=ListSubdir(:,iexp);
    1663         if size(Param.InputTable,1)==1% case of single input line
    1664         Param.OutputSubDir=ListSubdir{iexp};
    1665         end
    1666         set(handles.InputTable,'Data',Param.InputTable)
    1667 %         set(handles.OutputSubDir,'String',ListSubdir{iexp})
     1668        OutputSubDir=unique(ListSubdir(:,iexp));
     1669        Param.OutputSubDir=OutputSubDir{1};
     1670        if numel(OutputSubDir)>1% case
     1671            for iout=2:numel(OutputSubDir)
     1672                Param.OutputSubDir=[Param.OutputSubDir '-' OutputSubDir{iout}];
     1673            end               
     1674        end       
    16681675    end
    16691676    [xx,ExpName]=fileparts(Param.InputTable{1,1});
    16701677    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
    16711678    Param.IndexRange.last_i=str2num(get(handles.num_last_i,'String'));
    1672     %% create the output data directory if needed
     1679   
     1680    %% create the output data directory if needed, after chcking its existence
    16731681    OutputDir='';
    16741682    answer='';
    16751683    if isfield(Param,'OutputSubDir')% possibly update the output dir if it already exists
    1676         SubDirOut=[get(handles.OutputSubDir,'String') Param.OutputDirExt];
     1684        SubDirOut=[Param.OutputSubDir Param.OutputDirExt];
    16771685        SubDirOutNew=SubDirOut;
    16781686        detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir'); % test if  the dir  already exist
     
    17081716            continue
    17091717        end
    1710         Param.OutputDirExt=regexprep(SubDirOutNew,Param.OutputSubDir,'');
     1718        Param.OutputDirExt=regexprep(SubDirOutNew,['^' Param.OutputSubDir],'');
    17111719        Param.OutputRootFile=Param.InputTable{1,3}; % the first sorted RootFile taken for output
    1712         set(handles.OutputDirExt,'String',Param.OutputDirExt)
    1713         OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]) % full name (with path) of output directory
     1720        OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory
    17141721        if check_create    % create output directory if it does not exist
    17151722            [tild,msg1]=mkdir(OutputDir);
     
    17221729    elseif isfield(Param,'ActionInput')&&isfield(Param.ActionInput,'LogPath')% custom definition of the output dir
    17231730        OutputDir=Param.ActionInput.LogPath;
     1731    end
     1732   
     1733    set(handles.OutputSubDir,'String',Param.OutputSubDir)
     1734    set(handles.OutputDirExt,'String',Param.OutputDirExt)
     1735    drawnow
     1736    if get(handles.Replicate,'Value')
     1737        set(handles.InputTable,'Data',Param.InputTable)
     1738        check_input_file_series(handles)
    17241739    end
    17251740    DirXml=fullfile(OutputDir,'0_XML');
     
    22092224end
    22102225set(handles.Replicate,'BackgroundColor',[0 1 0])
    2211 if NbExp>1
    2212     set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta (input file features need to be updated)
    2213 end
     2226
    22142227%------------------------------------------------------------------------
    22152228function STOP_Callback(hObject, eventdata, handles)
     
    38163829% --- Executes on button press in MonitorCluster.
    38173830function MonitorCluster_Callback(hObject, eventdata, handles)
    3818 disp('format: R/W=run/wait, time lapsed, R=nbre of cores,W=walltime')
    3819 system('oarstat |grep N=UVmat')% check the list of jobs launched with uvmat
     3831
     3832[rr,ss]=system('oarstat |grep N=UVmat');% check the list of jobs launched with uvmat
     3833if isempty(ss)
     3834   disp( 'no job presently submitted with uvmat')
     3835else
     3836    disp('format: R/W=run/wait, time lapsed, R=nbre of cores,W=walltime')
     3837    disp(ss)
     3838end
    38203839
    38213840
Note: See TracChangeset for help on using the changeset viewer.