source: trunk/src/check_files.m @ 589

Last change on this file since 589 was 589, checked in by sommeria, 11 years ago

various minor corrections made

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