Changeset 1202
- Timestamp:
- Mar 24, 2026, 3:46:06 PM (22 hours ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 6 edited
-
fullfile_uvmat.m (modified) (3 diffs)
-
get_file_info.m (modified) (1 diff)
-
nc2struct.m (modified) (1 diff)
-
parciv.m (added)
-
series.m (modified) (5 diffs)
-
series/civ2vel_3C.m (modified) (3 diffs)
-
series/civ_series.m (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/fullfile_uvmat.m
r1157 r1202 1 %'fullfile_uvmat': creates a file name from aroot name and indices.1 %'fullfile_uvmat': creates a file name from path, root name and indices. 2 2 %------------------------------------------------------------------------ 3 3 % filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1,i2,j1,j2) … … 64 64 %% default input 65 65 if iscell(NomType) 66 NomType=NomType{1} 66 NomType=NomType{1}; 67 67 end 68 68 if ~exist('j2','var') … … 96 96 97 97 %% look for NomType with pairs (separator '-' or terminasion ab or AB 98 % if strcmp(NomType,'level')% organisation with a sub-folder for the files of each index i 99 % filename=fullfile(RootPath,SubDir,['level' num2str(j1)],[RootFile num2str(i1) FileExt]); 100 % else 101 if ~isempty(regexp(NomType,'^_\d')) 102 sep1='_'; 98 if ~isempty(regexp(NomType,'^_\d', 'once')) 99 sep1='_'; 100 NomType(1)=[];%remove '_' from the beginning of NomType 101 end 102 r=regexp(NomType,'^(?<num1>\d+)','names');%look for a number at the beginning of NomType 103 if ~isempty(r) 104 i1_str=num2str(i1,['%0' num2str(length(r.num1)) 'd']); 105 NomType=regexprep(NomType,['^' r.num1],''); 106 r=regexp(NomType,'^-(?<num2>\d+)','names');%look for a pair i1-i2 107 if ~isempty(r) 108 if ~isempty(i2) 109 sep2='-'; 110 i2_str=num2str(i2,['%0' num2str(length(r.num2)) 'd']); 111 end 112 NomType=regexprep(NomType,['^-' r.num2],''); 113 end 114 if ~isempty(regexp(NomType,'^_', 'once')) 115 sep3='_'; 103 116 NomType(1)=[];%remove '_' from the beginning of NomType 104 117 end 105 r=regexp(NomType,'^(?<num1>\d+)','names');%look for a number at the beginning of NomType 106 if ~isempty(r) 107 i1_str=num2str(i1,['%0' num2str(length(r.num1)) 'd']); 108 NomType=regexprep(NomType,['^' r.num1],''); 109 r=regexp(NomType,'^-(?<num2>\d+)','names');%look for a pair i1-i2 118 if ~isempty(regexp(NomType,'^[a|A]', 'once')) 119 j1_str=num2stra(j1,NomType); 120 if ~isempty(regexp(NomType,'[b|B]$', 'once'))&& ~isempty(j2) 121 j2_str=num2stra(j2,NomType); 122 end 123 else 124 r=regexp(NomType,'^(?<num3>\d+)','names'); 110 125 if ~isempty(r) 111 if ~isempty(i2) 112 sep2='-'; 113 i2_str=num2str(i2,['%0' num2str(length(r.num2)) 'd']); 114 end 115 NomType=regexprep(NomType,['^-' r.num2],''); 126 j1_str=num2str(j1,['%0' num2str(length(r.num3)) 'd']); 127 NomType=regexprep(NomType,['^' r.num3],''); 116 128 end 117 if ~isempty(regexp(NomType,'^_')); 118 sep3='_'; 119 NomType(1)=[];%remove '_' from the beginning of NomType 120 end 121 if ~isempty(regexp(NomType,'^[a|A]')); 122 j1_str=num2stra(j1,NomType); 123 if ~isempty(regexp(NomType,'[b|B]$'))&& ~isempty(j2); 124 j2_str=num2stra(j2,NomType); 125 end 126 else 127 r=regexp(NomType,'^(?<num3>\d+)','names'); 129 if ~isempty(j2) 130 r=regexp(NomType,'-(?<num4>\d+)','names'); 128 131 if ~isempty(r) 129 j1_str=num2str(j1,['%0' num2str(length(r.num3)) 'd']); 130 NomType=regexprep(NomType,['^' r.num3],''); 131 end 132 if ~isempty(j2) 133 r=regexp(NomType,'-(?<num4>\d+)','names'); 134 if ~isempty(r) 135 sep4='-'; 136 j2_str=num2str(j2,['%0' num2str(length(r.num4)) 'd']); 137 end 132 sep4='-'; 133 j2_str=num2str(j2,['%0' num2str(length(r.num4)) 'd']); 138 134 end 139 135 end 140 136 end 141 if isempty(regexp(RootPath,'^http://')) 137 end 138 if isempty(regexp(RootPath,'^http://', 'once'))% local file, no OpenDap 142 139 filename=fullfile(RootPath,SubDir,RootFile); 143 else 144 filename=[RootPath '/' SubDir '/' RootFile]; 145 end 146 filename=[filename sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str]; 147 filename=[regexprep(filename,'_$','') FileExt];%suppress possible '_' at the end of the string and add the extension 148 % end 140 else 141 filename=[RootPath '/' SubDir '/' RootFile]; 142 end 143 filename=[filename sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str]; 144 filename=[regexprep(filename,'_$','') FileExt];%suppress possible '_' at the end of the string and add the extension 149 145 146 %------------------------------------------------------------------------ 150 147 function test 148 %------------------------------------------------------------------------ 151 149 fprintf([... 152 150 '######################################################\n'... -
trunk/src/get_file_info.m
r1199 r1202 298 298 FileInfo.FileIndexing='off'; 299 299 end 300 301 300 P=1:numel(fieldnames(FileInfo)); 301 FileInfo=orderfields(FileInfo,[P(1) P(2) P(end-1) P(end) P(3:end-2)]);% reorder for clarity to put the main info in first 302 -
trunk/src/nc2struct.m
r1201 r1202 70 70 testfile=1; 71 71 if exist(nc,'file') 72 if ~isempty(regexp(nc,'.mat$' ))72 if ~isempty(regexp(nc,'.mat$', 'once')) 73 73 Data=mat2struct(nc,varargin{1}); 74 74 return -
trunk/src/series.m
r1200 r1202 436 436 end 437 437 %% launch the browser 438 fileinput=uigetfile_uvmat('pick an input file in the series',oldfile);438 fileinput=uigetfile_uvmat('pick an input data file in the series',oldfile); 439 439 hh=dir(fileinput); 440 440 if numel(hh)>1 441 441 msgbox_uvmat('ERROR','invalid input, probably a broken link'); 442 else 442 else 443 443 if ~isempty(fileinput) 444 444 display_file_name(handles,fileinput,'one') … … 470 470 471 471 %% launch the browser 472 fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile);472 fileinput=uigetfile_uvmat('pick a data file to append in the input table',oldfile); 473 473 hh=dir(fileinput); 474 474 if numel(hh)>1 … … 756 756 XmlData=[]; 757 757 if ~isempty(XmlFileName) 758 XmlData=read_imadoc (XmlFileName);%read the imadoc file through the local fct read_imadoc758 XmlData=read_imadoct(XmlFileName);%read the imadoc file through the local fct read_imadoc 759 759 if isfield(XmlData,'FileSeries') && Rank==0 760 760 set(handles.Relabel,'Visible','on') … … 1878 1878 set(handles.InputTable,'Data',Param.InputTable) 1879 1879 set(handles.OutputPath,'String',OutputPath) 1880 set(handles.Experiment,'String',ListExpOut{iexp})1880 set(handles.Experiment,'String',ListExpOut{iexp}) 1881 1881 set(handles.Device,'String',ListDeviceOut{iexp}) 1882 1882 Param.Experiment=ListExpOut{iexp}; … … 1982 1982 NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes 1983 1983 end 1984 1984 1985 1985 % %proposed number of cores to reserve in the cluster 1986 if isfield(SeriesData.ClusterParam,'NbCoreAdvised')1986 if isfield(SeriesData.ClusterParam,'NbCoreAdvised') 1987 1987 NbCoreAdvised=SeriesData.ClusterParam.NbCoreAdvised; 1988 1988 else 1989 1989 disp('ClusterParam.NbCoreAdvised not documented in series.xml, set to 16 by default') 1990 1990 NbCoreAdvised=16; 1991 end1992 if isfield(SeriesData.ClusterParam,'NbCoreMax')1991 end 1992 if isfield(SeriesData.ClusterParam,'NbCoreMax') 1993 1993 NbCoreMax=min(NbProcess,SeriesData.ClusterParam.NbCoreMax);% reduces the number of cores if it exceeds the number of processes 1994 1994 else 1995 1995 disp('ClusterParam.NbCoreMax not documented in series.xml, set to 36 by default') 1996 1996 NbCoreMax=min(NbProcess,36); 1997 end 1998 if NbCoreMax~=1 1999 %%%% TEST ELETTA 2000 if NbCoreMax==0 2001 disp(NbProcess) 2002 disp(Param.IndexRange.NbSlice) 2003 disp(SeriesData.ClusterParam.NbCoreMax) 1997 2004 end 1998 if NbCoreMax~=12005 %%%%%%%%%%% 1999 2006 if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled) 2000 2007 warning_string=', preferably use .sh option to save Matlab licences'; -
trunk/src/series/civ2vel_3C.m
r1201 r1202 1 %'civ2vel_3C': combine velocity fields from two cameras to get three velocity components1 %'civ2vel_3C': combine the civ velocity fields from two cameras to get three velocity components 2 2 %------------------------------------------------------------------------ 3 % function ParamOut=civ2vel_3C(Param)3 % function GUIParam=civ2vel_3C(Param) 4 4 % 5 5 %OUTPUT 6 % ParamOut: sets options in the GUI series.fig needed for the function6 % GUIParam: sets options in the GUI series.fig needed for the function 7 7 % 8 8 %INPUT: … … 51 51 %======================================================================= 52 52 53 function ParamOut=civ2vel_3C(Param)53 function GUIParam=civ2vel_3C(Param) 54 54 55 55 %% set the input elements needed on the GUI series when the function is selected in the menu ActionName or InputTable refreshed 56 56 if isstruct(Param) && isequal(Param.Action.RUN,0) 57 ParamOut.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 58 ParamOut.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 59 ParamOut.NbSlice='off'; %nbre of slices ('off' by default) 60 ParamOut.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 61 ParamOut.FieldName='off';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 62 ParamOut.FieldTransform = 'off';%use the phys transform function without choice 63 %ParamOut.TransformPath=fullfile(fileparts(which('uvmat')),'transform_field');% path to transform functions (needed for compilation only) 64 ParamOut.ProjObject='on';%can use projection object(option 'off'/'on', 65 ParamOut.Mask='off';%can use mask option (option 'off'/'on', 'off' by default) 66 ParamOut.OutputDirExt='.vel3C';%set the output dir extension 67 ParamOut.OutputSubDirMode='two'; % the two first input lines are used to define the output subfolder 68 ParamOut.OutputFileMode='NbInput';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice 57 GUIParam.NbSlice='off'; %nbre of slices ('off' by default) !!VERIFIER 58 GUIParam.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default)!!VERIFIER 59 GUIParam.FieldName='off';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 60 GUIParam.ProjObject='on';%can use projection object(option 'off'/'on', 61 GUIParam.Mask='off';%can use mask option (option 'off'/'on', 'off' by default)!!VERIFIER 62 GUIParam.OutputDirExt='.vel3C';%set the output dir extension 63 GUIParam.OutputSubDirMode='two'; % the two first input lines are used to define the output subfolder 64 GUIParam.OutputFileMode='NbInput';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice 69 65 %check the input files 70 ParamOut.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1)66 GUIParam.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1) 71 67 first_j=[]; 72 68 if size(Param.InputTable,1)<2 73 msgbox_uvmat('WARNING',['two or three input file series are needed']) 69 msgbox_uvmat('ERROR','two or three input file series are needed') 70 return 71 end 72 if ~isfield(Param,'ProjObject') 73 msgbox_uvmat('ERROR','You need a projection object of type plane') 74 return 74 75 end 75 76 if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end … … 79 80 FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},... 80 81 Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2); 81 if ~exist(FirstFileName,'file') 82 msgbox_uvmat('WARNING',['the first input file ' FirstFileName ' does not exist']) 83 elseif isequal(size(Param.InputTable,1),1) && ~isfield(Param,'ProjObject') 84 msgbox_uvmat('WARNING','You may need a projection object of type plane for merge_proj') 85 end 86 return 82 if exist(FirstFileName,'file') 83 FileInfo=get_file_info(FirstFileName); 84 if ~strcmp(FileInfo.FileType,'civdata') 85 msgbox_uvmat('ERROR','civ data are needed as input') 86 return 87 end 88 else 89 msgbox_uvmat('ERROR',['the first input file ' FirstFileName ' does not exist']) 90 return 91 end 87 92 end 88 93 89 94 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%% 90 ParamOut=[]; %default output95 GUIParam=[]; %default output 91 96 %% read input parameters from an xml file if input is a file name (batch mode) 92 97 checkrun=1; -
trunk/src/series/civ_series.m
r1201 r1202 1 1 %'civ_series': PIV function activated by the general GUI series 2 2 % --- call the sub-functions: 3 % civ: PIV function itself 4 % detect_false: put a flag to false vectors after detection by various criteria 5 % filter_tps: make interpolation-smoothing 3 % 'parciv.m' PIV function itself, adpated to parallel processing (loop 4 % parfor instead of for) 5 % 'civ.m': same as parciv, but with usual loop 'for', suitable for cluster 6 % dispatch (no parallel processing inside functions) 7 % filter_tps: make interpolation-smoothing by thin plate spline method 6 8 %------------------------------------------------------------------------ 7 % function [ Data,errormsg,result_conv]= civ_series(Param)9 % function [GUIParam,errormsg]= civ_series(Param) 8 10 % 9 11 %OUTPUT 10 % Data=structure containing the PIV results and information on the processing parameters 11 % errormsg=error message char string, decd ..fault='' 12 % resul_conv: image inter-correlation function for the last grid point (used for tests) 13 % 12 % GUIParam=structure containing the input parameters sent to the GUI series in the interactive selection phase 14 13 %INPUT: 15 14 % Param: Matlab structure of input parameters … … 46 45 %======================================================================= 47 46 48 function [ Data,errormsg]= civ_series(Param)47 function [GUIParam,errormsg]= civ_series(Param) 49 48 errormsg=''; 50 49 GUIParam=[]; 51 50 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName or InputTable refreshed 52 51 if isstruct(Param) && isequal(Param.Action.RUN,0)% function activated from the GUI series but not RUN 53 if 0==1 %never satisfied but trigger compilation with the appropriate transform functions ('eval' inactive for compilation)54 ima_rescale55 end56 52 path_series=fileparts(which('series')); 57 53 addpath(fullfile(path_series,'series')) 58 Data=civ_input(Param);% introduce the civ parameters using the GUI civ_input54 GUIParam=civ_input(Param);% introduce the civ parameters using the GUI civ_input 59 55 % TODO: change from guide to App: modify the input procedure, adapt read_GUI function 60 56 %App=civ_input_App 61 57 %Data=civ_input_App(Param);% introduce the civ parameters using the GUI civ_input 62 58 % if isempty(App) 63 % Data=Param;% if civ_input has been cancelled, keep previous parameters59 % GUIParam=Param;% if civ_input has been cancelled, keep previous parameters 64 60 % end 65 Data.Program=mfilename;%gives the name of the current function66 Data.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)67 Data.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)68 Data.NbSlice='off'; %nbre of slices ('off' by default)69 Data.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default)70 Data.FieldName='on';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)71 Data.FieldTransform = 'off';%can use a transform function72 Data.ProjObject='off';%can use projection object(option 'off'/'on',73 Data.Mask='off';%can use mask option (option 'off'/'on', 'off' by default)74 Data.OutputDirExt='.civ';%set the output dir extension75 Data.OutputSubDirMode='last'; %select the last subDir in the input table as root of the output subdir name (option 'all'/'first'/'last', 'all' by default)76 Data.OutputFileMode='NbInput_i';% one output file expected per value of i index (used for waitbar)77 Data.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1)78 if isfield( Data,'ActionInput') && isfield(Data.ActionInput,'PairIndices') && isequal(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2')79 Data.IndexRange_j='off';%no j index display in series61 GUIParam.Program=mfilename;%gives the name of the current function 62 GUIParam.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 63 GUIParam.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 64 GUIParam.NbSlice='off'; %nbre of slices ('off' by default) 65 GUIParam.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 66 GUIParam.FieldName='on';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 67 GUIParam.FieldTransform = 'off';%can use a transform function 68 GUIParam.ProjObject='off';%can use projection object(option 'off'/'on', 69 GUIParam.Mask='off';%can use mask option (option 'off'/'on', 'off' by default) 70 GUIParam.OutputDirExt='.civ';%set the output dir extension 71 GUIParam.OutputSubDirMode='last'; %select the last subDir in the input table as root of the output subdir name (option 'all'/'first'/'last', 'all' by default) 72 GUIParam.OutputFileMode='NbInput_i';% one output file expected per value of i index (used for waitbar) 73 GUIParam.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1) 74 if isfield(GUIParam,'ActionInput') && isfield(GUIParam.ActionInput,'PairIndices') && isequal(GUIParam.ActionInput.PairIndices.ListPairMode,'pair j1-j2') 75 GUIParam.IndexRange_j='off';%no j index display in series 80 76 else 81 Data.IndexRange_j='on';% j index display in series if relevant77 GUIParam.IndexRange_j='on';% j index display in series if relevant 82 78 end 83 79 return … … 316 312 end 317 313 end 318 if ~CheckOverwrite && exist(ncfile_out,'file') 314 if ~CheckOverwrite 315 [Data,~,~,errormsg]=nc2struct(ncfile_out,'ListGlobalAttribute','CivStage'); 316 if isempty(errormsg) 319 317 disp(['existing output file ' ncfile_out ' already exists, skip to next field']) 320 318 continue% skip iteration if the mode overwrite is desactivated and the result file already exists 321 end322 %end319 end 320 end 323 321 ImageName_A='';ImageName_B='';%default 324 322 VideoObject_A=[];VideoObject_B=[]; … … 533 531 [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,~, errormsg] = civ (par_civ1);% single processor used in cluster 534 532 else 535 [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF, errormsg] = parciv (par_civ1);%use parfor loop533 [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,~,errormsg] = parciv (par_civ1);%use parfor loop 536 534 end 537 535 Civ_X_shifted=Civ_X-0.5+Civ_U/2;% get the exact positions … … 862 860 [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,~, errormsg] = civ (par_civ2);% single processor used in cluster 863 861 else 864 [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF, errormsg] = parciv (par_civ2);%use parfor loop862 [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,~, errormsg] = parciv (par_civ2);%use parfor loop 865 863 end 866 864 Civ_X_shifted=Civ_X-0.5+Civ_U/2;% get the exact positions
Note: See TracChangeset
for help on using the changeset viewer.
