Changeset 1202


Ignore:
Timestamp:
Mar 24, 2026, 3:46:06 PM (22 hours ago)
Author:
sommeria
Message:

parciv added and erasing bad file in complement series

Location:
trunk/src
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/fullfile_uvmat.m

    r1157 r1202  
    1 %'fullfile_uvmat': creates a file name from a root name and indices.
     1%'fullfile_uvmat': creates a file name from path, root name and indices.
    22%------------------------------------------------------------------------
    33% filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1,i2,j1,j2)
     
    6464%% default input
    6565if iscell(NomType)
    66 NomType=NomType{1}
     66NomType=NomType{1};
    6767end
    6868if ~exist('j2','var')
     
    9696
    9797%% 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='_';
     98if ~isempty(regexp(NomType,'^_\d', 'once'))
     99    sep1='_';
     100    NomType(1)=[];%remove '_' from the beginning of NomType
     101end
     102r=regexp(NomType,'^(?<num1>\d+)','names');%look for a number at the beginning of NomType
     103if ~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='_';
    103116        NomType(1)=[];%remove '_' from the beginning of NomType
    104117    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');
    110125        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],'');
    116128        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');
    128131            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']);
    138134            end
    139135        end
    140136    end
    141     if isempty(regexp(RootPath,'^http://'))
     137end
     138if isempty(regexp(RootPath,'^http://', 'once'))% local file, no OpenDap
    142139    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
     140else
     141    filename=[RootPath '/' SubDir '/' RootFile];
     142end
     143filename=[filename sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str];
     144filename=[regexprep(filename,'_$','') FileExt];%suppress possible '_' at the end of the string and add the extension
    149145
     146%------------------------------------------------------------------------
    150147function test
     148%------------------------------------------------------------------------
    151149fprintf([...
    152150    '######################################################\n'...
  • trunk/src/get_file_info.m

    r1199 r1202  
    298298    FileInfo.FileIndexing='off';
    299299end
    300 
    301 
     300P=1:numel(fieldnames(FileInfo));
     301FileInfo=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  
    7070    testfile=1;
    7171    if exist(nc,'file')
    72         if ~isempty(regexp(nc,'.mat$'))
     72        if ~isempty(regexp(nc,'.mat$', 'once'))
    7373            Data=mat2struct(nc,varargin{1});
    7474            return
  • trunk/src/series.m

    r1200 r1202  
    436436end
    437437%% launch the browser
    438 fileinput=uigetfile_uvmat('pick an input file in the series',oldfile);
     438fileinput=uigetfile_uvmat('pick an input data file in the series',oldfile);
    439439hh=dir(fileinput);
    440440if numel(hh)>1
    441441    msgbox_uvmat('ERROR','invalid input, probably a broken link');
    442 else
     442else 
    443443    if ~isempty(fileinput)
    444444        display_file_name(handles,fileinput,'one')
     
    470470
    471471%% launch the browser
    472 fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile);
     472fileinput=uigetfile_uvmat('pick a data file to append in the input table',oldfile);
    473473hh=dir(fileinput);
    474474if numel(hh)>1
     
    756756XmlData=[];
    757757if ~isempty(XmlFileName)
    758     XmlData=read_imadoc(XmlFileName);%read the imadoc file through the local fct read_imadoc
     758    XmlData=read_imadoct(XmlFileName);%read the imadoc file through the local fct read_imadoc
    759759    if isfield(XmlData,'FileSeries') && Rank==0
    760760        set(handles.Relabel,'Visible','on')
     
    18781878        set(handles.InputTable,'Data',Param.InputTable)
    18791879        set(handles.OutputPath,'String',OutputPath)
    1880          set(handles.Experiment,'String',ListExpOut{iexp})
     1880        set(handles.Experiment,'String',ListExpOut{iexp})
    18811881        set(handles.Device,'String',ListDeviceOut{iexp})
    18821882        Param.Experiment=ListExpOut{iexp};
     
    19821982                NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes
    19831983            end
    1984            
     1984
    19851985            %         %proposed number of cores to reserve in the cluster
    1986              if isfield(SeriesData.ClusterParam,'NbCoreAdvised')
     1986            if isfield(SeriesData.ClusterParam,'NbCoreAdvised')
    19871987                NbCoreAdvised=SeriesData.ClusterParam.NbCoreAdvised;
    19881988            else
    19891989                disp('ClusterParam.NbCoreAdvised not documented in series.xml, set to 16 by default')
    19901990                NbCoreAdvised=16;
    1991              end
    1992                 if isfield(SeriesData.ClusterParam,'NbCoreMax')
     1991            end
     1992            if isfield(SeriesData.ClusterParam,'NbCoreMax')
    19931993                NbCoreMax=min(NbProcess,SeriesData.ClusterParam.NbCoreMax);% reduces the number of cores if it exceeds the number of processes
    19941994            else
    19951995                disp('ClusterParam.NbCoreMax not documented in series.xml, set to 36 by default')
    19961996                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)                 
    19972004                end
    1998             if NbCoreMax~=1
     2005                %%%%%%%%%%%
    19992006                if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
    20002007                    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 components
     1%'civ2vel_3C': combine the civ velocity fields from two cameras to get three velocity components
    22%------------------------------------------------------------------------
    3 % function ParamOut=civ2vel_3C(Param)
     3% function GUIParam=civ2vel_3C(Param)
    44%
    55%OUTPUT
    6 % ParamOut: sets options in the GUI series.fig needed for the function
     6% GUIParam: sets options in the GUI series.fig needed for the function
    77%
    88%INPUT:
     
    5151%=======================================================================
    5252
    53 function ParamOut=civ2vel_3C(Param)
     53function GUIParam=civ2vel_3C(Param)
    5454
    5555%% set the input elements needed on the GUI series when the function is selected in the menu ActionName or InputTable refreshed
    5656if 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
    6965    %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)
    7167    first_j=[];
    7268    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
    7475    end
    7576    if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
     
    7980    FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},...
    8081        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
    8792end
    8893
    8994%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
    90 ParamOut=[]; %default output
     95GUIParam=[]; %default output
    9196%% read input parameters from an xml file if input is a file name (batch mode)
    9297checkrun=1;
  • trunk/src/series/civ_series.m

    r1201 r1202  
    11%'civ_series': PIV function activated by the general GUI series
    22% --- 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
    68%------------------------------------------------------------------------
    7 % function [Data,errormsg,result_conv]= civ_series(Param)
     9% function [GUIParam,errormsg]= civ_series(Param)
    810%
    911%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
    1413%INPUT:
    1514% Param: Matlab structure of input  parameters
     
    4645%=======================================================================
    4746
    48 function [Data,errormsg]= civ_series(Param)
     47function [GUIParam,errormsg]= civ_series(Param)
    4948errormsg='';
    50 
     49GUIParam=[];
    5150%% set the input elements needed on the GUI series when the action is selected in the menu ActionName or InputTable refreshed
    5251if 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_rescale
    55     end
    5652    path_series=fileparts(which('series'));
    5753    addpath(fullfile(path_series,'series'))
    58     Data=civ_input(Param);% introduce the civ parameters using the GUI civ_input
     54   GUIParam=civ_input(Param);% introduce the civ parameters using the GUI civ_input
    5955    % TODO: change from guide to App: modify the input procedure, adapt read_GUI function
    6056    %App=civ_input_App
    6157    %Data=civ_input_App(Param);% introduce the civ parameters using the GUI civ_input
    6258    % if isempty(App)
    63     %     Data=Param;% if  civ_input has been cancelled, keep previous parameters
     59    %    GUIParam=Param;% if  civ_input has been cancelled, keep previous parameters
    6460    % end
    65     Data.Program=mfilename;%gives the name of the current function
    66     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 function
    72     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 extension
    75     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 series
     61   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
    8076    else
    81         Data.IndexRange_j='on';% j index display in series if relevant
     77       GUIParam.IndexRange_j='on';% j index display in series if relevant
    8278    end
    8379    return
     
    316312        end
    317313    end
    318     if ~CheckOverwrite && exist(ncfile_out,'file')
     314    if ~CheckOverwrite
     315        [Data,~,~,errormsg]=nc2struct(ncfile_out,'ListGlobalAttribute','CivStage');
     316        if isempty(errormsg)
    319317        disp(['existing output file ' ncfile_out ' already exists, skip to next field'])
    320318        continue% skip iteration if the mode overwrite is desactivated and the result file already exists
    321     end
    322     %     end
     319        end
     320    end
    323321    ImageName_A='';ImageName_B='';%default
    324322    VideoObject_A=[];VideoObject_B=[];
     
    533531            [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,~, errormsg] = civ (par_civ1);% single processor used in cluster
    534532        else
    535             [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,errormsg] = parciv (par_civ1);%use parfor loop
     533            [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,~,errormsg] = parciv (par_civ1);%use parfor loop
    536534        end
    537535        Civ_X_shifted=Civ_X-0.5+Civ_U/2;% get the exact positions
     
    862860            [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,~, errormsg] = civ (par_civ2);% single processor used in cluster
    863861        else
    864             [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,errormsg] = parciv (par_civ2);%use parfor loop
     862            [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,~, errormsg] = parciv (par_civ2);%use parfor loop
    865863        end
    866864        Civ_X_shifted=Civ_X-0.5+Civ_U/2;% get the exact positions
Note: See TracChangeset for help on using the changeset viewer.