source: trunk/src/check_files.m @ 623

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

waitbar system for series improved to aloow use as stand alone fcts.

to add at the head of series fcts:
hseries=findobj(allchild(0),'Tag','series');
RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
WaitbarHandle?=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series

call to waitbar:

update_waitbar(WaitbarHandle?,index/nbfield)
if ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction?'),'queue')

disp('program stopped by user')
break

end

File size: 10.8 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
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
[497]28function [checkmsg,date_str,svn_info]=check_files
29checkmsg={};%default
[357]30svn_info.rep_rev=[];
31svn_info.cur_rev=[];
32svn_info.status=[];
33list_fct={...
[570]34    'browse_data';...% function for scanning directories in a project/campaign
35    'browse_data.fig';...% GUI corresponding to dataview
[515]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
[357]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
[475]49    'displ_uvmat';...
[357]50    'editxml';...%display and edit xml files using a xls schema
51    'editxml.fig';...%interface for editxml
52    'fileparts_uvmat';...% extracts the root name,field indexes and nomenclature type from an input filename
[497]53    'fill_GUI';...%  fill a GUI with a set of parameters from a Matlab structure
[476]54    'filter_tps';...% find the thin plate spline coefficients for interpolation-smoothing
[512]55    'find_field_cells';...% group the variables of a 'field object' into 'field cells' and specify their structure
[357]56    'find_file_series';...%check the content of an input file and find the corresponding file series
[498]57    'find_imadoc';...% find the ImaDoc xml file associated with a given input file
[357]58    'fullfile_uvmat';...%creates a file name from a root name and indices.
59    'geometry_calib';...%performs geometric calibration from a set of reference points
60    'geometry_calib.fig';...%interface for geometry_calib
61    'get_field';...% choose and plot a field from a Netcdf file
62    'get_field.fig';...%interface for get_field
[380]63    'get_file_series';...% determine the list of file names and file indices for functions called by 'series'.
64    'get_file_type';...% determine info about a file (image, multimage, civdata,...) .
[357]65    'hist_update';...%  update of a current global histogram by inclusion of a new field
66    'imadoc2struct';...%convert the image documentation file ImaDoc into a Matlab structure
67    'keyboard_callback';... % function activated when a key is pressed on the keyboard
68    'ListDir';... scan the structure of the directory tree (for dataview.m)
69    'mouse_down';% function activated when the mouse button is pressed on a figure (callback for 'WindowButtonDownFcn')
70    'mouse_motion';...% permanently called by mouse motion over a figure (callback for 'WindowButtonMotionFcn')
71    'mouse_up';... % function to be activated when the mouse button is released (callback for 'WindowButtonUpFcn')
72    'msgbox_uvmat';... associated with GUI msgbox_uvmat.fig to display message boxes, for error, warning or input calls
73    'msgbox_uvmat.fig';...
74    'nc2struct';...% transform a netcdf file in a corresponding matlab structure
75    'num2stra';...% transform number to the corresponding character string depending on the nomenclature
76    'open_uvmat';...% open with uvmat the  field selected in the list of 'civ/status' or 'series/check_data_files'
77    'phys_XYZ';...% transform coordiantes from pixels to phys
78    'px_XYZ';...% transform coordiantes from phys to pixels
79    'plot_field';...%displays a vector field and/or scalar or images
80    'plot_object';...%draws a projection object (points, line, plane...)
81    'proj_field';...%project a field on a projection object (plane, line,...)
82    'read_civxdata';...reads civx data from netcdf files
83    'read_civdata';... reads new civ data from netcdf files
[498]84    'read_field';...% read the fields from files in different formats (netcdf files, images, video)
[497]85    'read_GUI';... %read a GUI and provide the data as a Matlab structure
[498]86    'read_image';...%read images or video objects
[477]87    'read_multimadoc';... %read a set of Imadoc files and compare their timing of different file series
[357]88    'read_xls';...%read excel files containing the list of the experiments
89    'reinit';...% suppress the personal parameter file 'uvmat_perso.mat'
90    'rotate_points';...%'rotate_points': associated with GUI rotate_points.fig to introduce (2D) rotation parameters
91    'rotate_points.fig';...
92    'RUN_STLIN';...% combine 2 displacement fields for stereo PIV
93    'series';...% master function for analysis field series, with interface 'series.fig'
94    'series.fig';...% interface for 'series'
95    'set_col_vec';...% sets the color code for vectors depending on a scalar and input parameters (used for plot_field)
[588]96    'set_field_list';...% set the menu of input fields
[357]97    'set_grid';...% creates a grid for PIV
98    'set_grid.fig';...% interface for set_grid
99    'set_object.m';...%  edit a projection object
100    'set_object.fig';...% interface for set_object
[581]101    'set_subdomains';...% sort a set of points defined by scattered coordinates in subdomains, as needed for tps interpolation
[357]102    'stra2num';...% transform letters (a, b, A, B,) or numerical strings ('1','2'..) to the corresponding numbers
103    'sub_field';...% combine the two input fields,
104    'struct2nc';...% %write fields in netcdf files
105    'struct2xml';... transform a matlab structure to a xml tree.
106    'tps_coeff';...% calculate the thin plate spline (tps) coefficients
[581]107    'tps_coeff_field';...% calculate the thin plate spline (tps) coefficients with subdomains for a field structure
[357]108    'tps_eval';... %calculate the thin plate spline (tps) interpolation at a set of points
109    'tps_eval_dxy';...% calculate the derivatives of thin plate spline (tps) interpolation at a set of points (limited to the 2D case)
110    'translate_points';...% associated with GUI translate_points.fig to display translation parameters
111    'translate_points.fig';...
112    'update_imadoc';...  %update the ImaDoc xml file
113    'update_waitbar';... update the waitbar display, used for ACTION functions in the GUI 'series'
114    'uvmat';...% master function for file scanning and visualisation of 2D fields
115    'uvmat.fig';...  %interface for uvmat
116    'view_field.m';...% function for visualisation of projected fields'
117    'view_field.fig';...%GUI for view_field
118    'xml2struct';...% read an xml file as a Matlab structure, converts numeric character strings into numbers
119    };
120dir_fct=which('uvmat');% path to uvmat
[497]121pathuvmat=fileparts(dir_fct);
[357]122
123%% add the uvmat path to matlab if needed
124if isempty(regexp(path,[pathuvmat '(:|\>)'],'once'))
125    addpath(pathuvmat);
126end
127
128
129%% loop on the list of functions in the uvmat package
130icount=0;
[589]131if ~exist('@xmltree','dir')
132    icount=icount+1;
133    checkmsg{icount}='ERROR installation: toolbox xmltree missing';
134end
[357]135datnum=zeros(1,length(list_fct));
136for i=1:length(list_fct)
137    dir_fct=which(list_fct{i});% path to fct
138    if isempty(dir_fct)
139        icount=icount+1;
[497]140        checkmsg{icount}=[list_fct{i} ' not found'];% test for function not found
[357]141    else
[497]142        pth=fileparts(dir_fct);
143        if ~isequal(pathuvmat,pth) && ~isequal(fullfile(pathuvmat,'private'),pth)
[357]144            icount=icount+1;
[497]145            checkmsg{icount}=[dir_fct ' overrides the package UVMAT'];% bad path for the function
[357]146        end
147        datfile=dir(dir_fct);
148        if isfield(datfile,'datenum')
149            datnum(i)= datfile.datenum;
150        end
151    end
152end
153date_str=datestr(max(datnum));
[497]154
155%% check svn status
[479]156[status,result]=system('svn --help');
157if status==0
158    svn_info.rep_rev=0;svn_info.cur_rev=0;
159    [tild,result]=system(['svn info ' dir_fct]);
160    t=regexp(result,'R.vision\s*:\s*(?<rev>\d+)','names');
161    if ~isempty(t)
[475]162        svn_info.cur_rev=str2double(t.rev);
[357]163    end
[497]164    [tild,result]=system(['svn info -r ''HEAD'' '  pathuvmat]);
[479]165    t=regexp(result,'R.vision\s*:\s*(?<rev>\d+)','names');
166    if ~isempty(t)
[497]167        svn_info.rep_rev=str2double(t.rev);
[479]168    end
[497]169    [tild,result]=system(['svn status '  pathuvmat]);
[479]170    svn_info.status=result;
[497]171    checkmsg =[checkmsg {['SVN revision : ' num2str(svn_info.cur_rev)]}];
[479]172    if svn_info.rep_rev>svn_info.cur_rev
[497]173        checkmsg =[checkmsg ...
[479]174            {['Repository now at revision ' num2str(svn_info.rep_rev) '. Please type svn update in uvmat folder']}];
175    end
176    modifications=regexp(svn_info.status,'M\s[^(\n|\>)]+','match');
177    if ~isempty(modifications)
[497]178        for ilist=1:numel(modifications)
179            [tild,FileName,FileExt]=fileparts(modifications{ilist});
180            checkmsg=[checkmsg {[FileName FileExt ' modified']}];
181        end
[479]182    end
183else
[497]184    checkmsg=[checkmsg {'SVN not available'}];
[479]185end
[497]186checkmsg=checkmsg';
[357]187
[505]188%% check dates of compilation
189currentdir=pwd;
190cd(pathuvmat)
191list_compile=dir('*.sh');
192for ilist=1:numel(list_compile)
193    mfile=regexprep(list_compile(ilist).name,'.sh$','.m');
[606]194    if exist(mfile,'file')
195        datfile=dir(mfile);
196        if ~isempty(datfile) && isfield(datfile,'datenum') && datfile.datenum>list_compile(ilist).datenum
197            checkmsg=[checkmsg;{[list_compile(ilist).name ' needs to be updated by compile_functions']}];
198        end
[505]199    end
200end
[606]201cd(currentdir)
[505]202
Note: See TracBrowser for help on using the repository browser.