source: trunk/src/check_files.m @ 828

Last change on this file since 828 was 828, checked in by sommeria, 9 years ago

'get_file_type' removed (replaced by get_file_info)
bug corrected in read_multimadoc (errormessage display)

File size: 11.9 KB
RevLine 
[357]1%'check_files': check the path, modification date and svn version for all the
2%  function in the toolbox UVMAT. Called at the opening of uvmat. Adds the
3%  uvmat path to the Matlab path if needed.
4%----------------------------------------------------------------------
[497]5% function [checkmsg,date_str,ver]=check_files
[357]6%
7% OUTPUT:
[497]8% checkmsg: error message listing functions whose paths are not in the directory of uvmat.m
[357]9% date_str: date of the most recent modification of a file in the toolbox
10% ver : svn version in case this is a  svn repository
11
[809]12%=======================================================================
13% Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
14%   http://www.legi.grenoble-inp.fr
15%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
16%
[357]17%     This file is part of the toolbox UVMAT.
18%
19%     UVMAT is free software; you can redistribute it and/or modify
[809]20%     it under the terms of the GNU General Public License as published
21%     by the Free Software Foundation; either version 2 of the license,
22%     or (at your option) any later version.
[357]23%
24%     UVMAT is distributed in the hope that it will be useful,
25%     but WITHOUT ANY WARRANTY; without even the implied warranty of
26%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
[809]27%     GNU General Public License (see LICENSE.txt) for more details.
28%=======================================================================
[357]29
[497]30function [checkmsg,date_str,svn_info]=check_files
31checkmsg={};%default
[357]32svn_info.rep_rev=[];
33svn_info.cur_rev=[];
34svn_info.status=[];
35list_fct={...
[646]36    'activate';...% emulate the mouse selection of a GUI element, for demo
[570]37    'browse_data';...% function for scanning directories in a project/campaign
38    'browse_data.fig';...% GUI corresponding to dataview
[515]39    'calc_field_interp';...% defines fields (velocity, vort, div...) from civx data and calculate them
40    'calc_field_tps';...% defines fields (velocity, vort, div...) and calculate them
[357]41    'cell2tab';... %transform a Matlab cell in a character array suitable for display in a table
42    'check_files';...
[646]43    'civ';...   %function associated with the interface 'civ.fig' for PIV and spline interpolation (to be replaced by civ_series)
[357]44    'civ.fig';...
[646]45    'civ_3D';... % function associated with the interface 'civ_3D.fig' for PIV in volume (TODO: combine with civ.m)
[357]46    'civ_3D.fig';...
47    'civ_matlab';...% civ programs, Matlab version (called by civ.m, option Civprogram/Matlab in the upper menu bar)
[646]48    'compile';...% compile a Matlab function, create a binary in a subdirectory /bin
[357]49    'copyfields';...% copy fields between two matlab structures
50    'create_grid';...% called by the GUI geometry_calib to create a physical grid
51    'create_grid.fig';...% GUI corresponding to create_grid.m
[667]52    'disp_uvmat';...% display a message using  msgbox_uvmat or on the log file in batch mode
[646]53    'editxml';...% display and edit xml files using a xls schema
54    'editxml.fig';...% interface for editxml
[357]55    'fileparts_uvmat';...% extracts the root name,field indexes and nomenclature type from an input filename
[497]56    'fill_GUI';...%  fill a GUI with a set of parameters from a Matlab structure
[476]57    'filter_tps';...% find the thin plate spline coefficients for interpolation-smoothing
[655]58    'find_field_bounds';... % find the boounds and typical meshs of coordinates
[512]59    'find_field_cells';...% group the variables of a 'field object' into 'field cells' and specify their structure
[646]60    'find_file_series';...% check the content of an input file and find the corresponding file series
[498]61    'find_imadoc';...% find the ImaDoc xml file associated with a given input file
[646]62    'fullfile_uvmat';...% creates a file name from a root name and indices.
63    'geometry_calib';...% performs geometric calibration from a set of reference points
64    'geometry_calib.fig';...% interface for geometry_calib
[357]65    'get_field';...% choose and plot a field from a Netcdf file
66    'get_field.fig';...%interface for get_field
[828]67    'get_file_info';...% determine info about a file (image, multimage, civdata,...) .
[380]68    'get_file_series';...% determine the list of file names and file indices for functions called by 'series'.
[357]69    'hist_update';...%  update of a current global histogram by inclusion of a new field
70    'imadoc2struct';...%convert the image documentation file ImaDoc into a Matlab structure
[646]71    'interp2_uvmat';...% linearly interpolate an image or scalar defined on a regular grid
[357]72    'keyboard_callback';... % function activated when a key is pressed on the keyboard
[646]73    'ListDir';... % scan the structure of the directory tree (for editxml.m)
74    'mask_proj';...% restrict input fields to a mask region, set to 0 outside
[357]75    'mouse_down';% function activated when the mouse button is pressed on a figure (callback for 'WindowButtonDownFcn')
76    'mouse_motion';...% permanently called by mouse motion over a figure (callback for 'WindowButtonMotionFcn')
77    'mouse_up';... % function to be activated when the mouse button is released (callback for 'WindowButtonUpFcn')
[646]78    'msgbox_uvmat';... % associated with GUI msgbox_uvmat.fig to display message boxes, for error, warning or input calls
[357]79    'msgbox_uvmat.fig';...
[646]80    'nomtype2pair';... creates nomenclature for index pairs knowing the image nomenclature, used by series fct
[357]81    'nc2struct';...% transform a netcdf file in a corresponding matlab structure
82    'num2stra';...% transform number to the corresponding character string depending on the nomenclature
83    'phys_XYZ';...% transform coordiantes from pixels to phys
84    'px_XYZ';...% transform coordiantes from phys to pixels
85    'plot_field';...%displays a vector field and/or scalar or images
86    'plot_object';...%draws a projection object (points, line, plane...)
87    'proj_field';...%project a field on a projection object (plane, line,...)
88    'read_civxdata';...reads civx data from netcdf files
89    'read_civdata';... reads new civ data from netcdf files
[498]90    'read_field';...% read the fields from files in different formats (netcdf files, images, video)
[497]91    'read_GUI';... %read a GUI and provide the data as a Matlab structure
[498]92    'read_image';...%read images or video objects
[477]93    'read_multimadoc';... %read a set of Imadoc files and compare their timing of different file series
[357]94    'read_xls';...%read excel files containing the list of the experiments
95    'reinit';...% suppress the personal parameter file 'uvmat_perso.mat'
96    'rotate_points';...%'rotate_points': associated with GUI rotate_points.fig to introduce (2D) rotation parameters
97    'rotate_points.fig';...
98    'RUN_STLIN';...% combine 2 displacement fields for stereo PIV
99    'series';...% master function for analysis field series, with interface 'series.fig'
100    'series.fig';...% interface for 'series'
101    'set_col_vec';...% sets the color code for vectors depending on a scalar and input parameters (used for plot_field)
[588]102    'set_field_list';...% set the menu of input fields
[357]103    'set_grid';...% creates a grid for PIV
104    'set_grid.fig';...% interface for set_grid
105    'set_object.m';...%  edit a projection object
106    'set_object.fig';...% interface for set_object
[581]107    'set_subdomains';...% sort a set of points defined by scattered coordinates in subdomains, as needed for tps interpolation
[357]108    'stra2num';...% transform letters (a, b, A, B,) or numerical strings ('1','2'..) to the corresponding numbers
109    'sub_field';...% combine the two input fields,
110    'struct2nc';...% %write fields in netcdf files
111    'struct2xml';... transform a matlab structure to a xml tree.
112    'tps_coeff';...% calculate the thin plate spline (tps) coefficients
[581]113    'tps_coeff_field';...% calculate the thin plate spline (tps) coefficients with subdomains for a field structure
[357]114    'tps_eval';... %calculate the thin plate spline (tps) interpolation at a set of points
115    'tps_eval_dxy';...% calculate the derivatives of thin plate spline (tps) interpolation at a set of points (limited to the 2D case)
116    'translate_points';...% associated with GUI translate_points.fig to display translation parameters
117    'translate_points.fig';...
[646]118    'uigetfile_uvmat';... browser, and display of directories, faster than the Matlab fct uigetfile
[357]119    'update_imadoc';...  %update the ImaDoc xml file
120    'update_waitbar';... update the waitbar display, used for ACTION functions in the GUI 'series'
121    'uvmat';...% master function for file scanning and visualisation of 2D fields
122    'uvmat.fig';...  %interface for uvmat
123    'view_field.m';...% function for visualisation of projected fields'
124    'view_field.fig';...%GUI for view_field
125    'xml2struct';...% read an xml file as a Matlab structure, converts numeric character strings into numbers
126    };
127dir_fct=which('uvmat');% path to uvmat
[497]128pathuvmat=fileparts(dir_fct);
[357]129
130%% add the uvmat path to matlab if needed
131if isempty(regexp(path,[pathuvmat '(:|\>)'],'once'))
132    addpath(pathuvmat);
133end
134
135
136%% loop on the list of functions in the uvmat package
137icount=0;
[679]138if ~exist(fullfile(pathuvmat,'@xmltree'),'dir')
[589]139    icount=icount+1;
140    checkmsg{icount}='ERROR installation: toolbox xmltree missing';
141end
[357]142datnum=zeros(1,length(list_fct));
143for i=1:length(list_fct)
144    dir_fct=which(list_fct{i});% path to fct
145    if isempty(dir_fct)
146        icount=icount+1;
[497]147        checkmsg{icount}=[list_fct{i} ' not found'];% test for function not found
[357]148    else
[497]149        pth=fileparts(dir_fct);
150        if ~isequal(pathuvmat,pth) && ~isequal(fullfile(pathuvmat,'private'),pth)
[357]151            icount=icount+1;
[497]152            checkmsg{icount}=[dir_fct ' overrides the package UVMAT'];% bad path for the function
[357]153        end
154        datfile=dir(dir_fct);
155        if isfield(datfile,'datenum')
156            datnum(i)= datfile.datenum;
157        end
158    end
159end
160date_str=datestr(max(datnum));
[497]161
162%% check svn status
[479]163[status,result]=system('svn --help');
[705]164if status==0 % if a svn line command is available
[479]165    svn_info.rep_rev=0;svn_info.cur_rev=0;
[705]166    [tild,result]=system(['svn info ' dir_fct]); %get info fromn the svn server
[710]167    t=regexp(result,'R.vision\s*:\s*(?<rev>\d+)','names');%detect 'rï¿œvision' or 'Revision' in the text
[479]168    if ~isempty(t)
[705]169        svn_info.cur_rev=str2double(t.rev); %version nbre of the current package
[357]170    end
[710]171    [tild,result]=system(['svn info -r ''HEAD'' '  pathuvmat]);
[479]172    t=regexp(result,'R.vision\s*:\s*(?<rev>\d+)','names');
173    if ~isempty(t)
[705]174        svn_info.rep_rev=str2double(t.rev); % version nbre available on the svn repository
[479]175    end
[710]176    [tild,result]=system(['svn status '  pathuvmat]);% '&' prevents the program to stop when the system asks password
[479]177    svn_info.status=result;
[705]178    checkmsg =[checkmsg {['SVN revision : ' num2str(svn_info.cur_rev)]}];%display version nbre of the current uvmat package
179    if svn_info.rep_rev>svn_info.cur_rev %if the repository has a more advanced version than the uvmat package, warning msge
[497]180        checkmsg =[checkmsg ...
[479]181            {['Repository now at revision ' num2str(svn_info.rep_rev) '. Please type svn update in uvmat folder']}];
182    end
[705]183    modifications=regexp(svn_info.status,'M\s[^(\n|\>)]+','match');% detect the files modified compared to the repository
[479]184    if ~isempty(modifications)
[497]185        for ilist=1:numel(modifications)
186            [tild,FileName,FileExt]=fileparts(modifications{ilist});
187            checkmsg=[checkmsg {[FileName FileExt ' modified']}];
188        end
[479]189    end
[705]190else % no svn line command available
[497]191    checkmsg=[checkmsg {'SVN not available'}];
[479]192end
[497]193checkmsg=checkmsg';
[357]194
[505]195%% check dates of compilation
[660]196% currentdir=pwd;
197% cd(pathuvmat)
198% list_compile=dir('*.sh');
199% for ilist=1:numel(list_compile)
200%     mfile=regexprep(list_compile(ilist).name,'.sh$','.m');
201%     if exist(mfile,'file')
202%         datfile=dir(mfile);
203%         if ~isempty(datfile) && isfield(datfile,'datenum') && datfile.datenum>list_compile(ilist).datenum
204%             checkmsg=[checkmsg;{[list_compile(ilist).name ' needs to be updated by compile_functions']}];
205%         end
206%     end
207% end
208% cd(currentdir)
[505]209
Note: See TracBrowser for help on using the repository browser.