Changeset 1097


Ignore:
Timestamp:
Apr 11, 2021, 10:03:02 PM (4 years ago)
Author:
sommeria
Message:

various bug repairs

Location:
trunk/src
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_file_series.m

    r1093 r1097  
    3636InputTable=Param.InputTable;
    3737first_i=Param.IndexRange.first_i;
    38 incr_i=Param.IndexRange.incr_slice;
     38incr_i=Param.IndexRange.incr_i;
    3939last_i=Param.IndexRange.last_i;
    4040first_j=[];last_j=[];incr_j=1;%default
  • trunk/src/mouse_motion.m

    r1093 r1097  
    279279                Param.Action.RUN=1;
    280280                Param.ActionInput.ListCompareMode='PIV';
     281                Param.ActionInput.PairIndices=read_GUI(hhciv.PairIndices);
    281282                par_civ.ImageA=Field.A;
    282283                par_civ.ImageB=Field.B;
  • trunk/src/plot_field.m

    r1095 r1097  
    127127        return
    128128    end
    129 % end
    130129
    131130%% test axes and figure
     
    266265    FigData=get(hfig,'UserData');
    267266    if strcmp(get(hfig,'tag'),'view_field')||strcmp(get(hfig,'tag'),'uvmat')
     267        if ~isempty(get(haxes,'tag'))
    268268        FigData.(get(haxes,'tag'))=Data;
     269        end
    269270        set(hfig,'UserData',FigData)
    270271    end
  • trunk/src/series.m

    r1096 r1097  
    168168RunModeList={'local';'background'}; % default choice of extensions (Matlab fct .m or compiled version .sh)
    169169[s,w]=system(SeriesData.SeriesParam.ClusterParam.ExistenceTest); % look for cluster system presence
    170 % [s,w]=system('oarstat'); % look for cluster system 'oar'
    171170if isequal(s,0)
    172171    RunModeList=[RunModeList;{'cluster'}];
    173172    set(handles.MonitorCluster,'Visible','on'); % make visible button for access to Monika
    174173    set(handles.num_CPUTime,'Visible','on'); % make visible button for CPU time estimate for one ref index
    175     set(handles.num_CPUTime,'String','1')% defqult CPU time estimate 1 minute
     174    set(handles.num_CPUTime,'String','')% default CPU time undefined
    176175    set(handles.CPUTime_txt,'Visible','on'); % make visible button for CPU time title
    177176end
    178 % [s,w]=system('qstat -help'); % look for cluster system 'sge'
    179 % if isequal(s,0)
    180 %     if regexp(w,'^pbs')
    181 %         RunModeList=[RunModeList;{'cluster_pbs'}];
    182 %     elseif regexp(w,'^SGE')
    183 %         RunModeList=[RunModeList;{'cluster_sge'}];
    184 %     else
    185 %         RunModeList=[RunModeList;{'cluster_qstat_unknown'}];
    186 %     end
    187 % end
    188177set(handles.RunMode,'String',RunModeList)% display the menu of available run modes, local, background or cluster manager
    189178
     
    208197        end
    209198    end
    210     %get the list of previous campaigns in the upper bar menu Open campaign
    211 %     if isfield(h,'MenuCampaign')
    212 %         for ifile=1:min(length(h.MenuCampaign),5)
    213 %             set(handles.(['MenuCampaign_' num2str(ifile)]),'Label',h.MenuCampaign{ifile});
    214 %         end
    215 %     end
    216199    %get the menu of actions
    217200    if isfield(h,'ActionListUser') && iscell(h.ActionListUser) && isfield(h,'ActionPathListUser') && iscell(h.ActionPathListUser)
     
    287270if isfield(Param,'InputFile')
    288271   
    289     %% fill the list of file series
     272    %% fill the list of input file series
    290273    InputTable=[{Param.InputFile.RootPath},{Param.InputFile.SubDir},{Param.InputFile.RootFile},{Param.InputFile.NomType},{Param.InputFile.FileExt}];
    291     if isempty(find(cellfun('isempty',InputTable)==0)); % if there is no input file, do not introduce input info
     274    if isempty(find(cellfun('isempty',InputTable)==0)) % if there is no input file, do not introduce input info
    292275        set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
    293276        return
     
    299282    end
    300283    set(handles.InputTable,'Data',InputTable)
     284   
     285    %% define the default path for the output files
     286    [InputPath,Device,DeviceExt]=fileparts(InputTable{1,1});
     287    [InputPath,Experiment,ExperimentExt]=fileparts(InputPath);
     288    set(handles.Device,'String',[Device DeviceExt])
     289    set(handles.Experiment,'String',[Experiment ExperimentExt])
     290    if ~isempty(regexp(InputTable{1,1},'(^http://)|(^https://)'))
     291    set(handles.OutputPathBrowse,'Value',1)% an output folder needs to be specified for OpenDAP data
     292    end
     293
     294    %update the output path if needed
     295    if ~(isfield(SeriesData,'InputPath') && strcmp(SeriesData.InputPath,InputPath))
     296    if get(handles.OutputPathBrowse,'Value')==1  % fix the output path in manual mode
     297        OutputPathOld=get(handles.OutputPath,'String');
     298        OutputPath=uigetdir(OutputPathOld,'pick a root folder for output data');
     299        set(handles.OutputPath,'String',OutputPath)
     300    else %reproduce the input path for output
     301        set(handles.OutputPath,'String',InputPath)
     302    end
     303    end
     304   
    301305    %% determine the selected reference field indices for pair display
    302306   
     
    857861[InputPath,Device,DeviceExt]=fileparts(InputTable{1,1});
    858862[InputPath,Experiment,ExperimentExt]=fileparts(InputPath);
    859 [~,InputPath,InputPathExt]=fileparts(InputPath);
    860863set(handles.Device,'String',[Device DeviceExt])
    861864set(handles.Experiment,'String',[Experiment ExperimentExt])
     
    18431846        end
    18441847    end
    1845     CPUTime=1; % job time estimated at 1 min per iteration (on index i and j) by default
    1846     if isfield(Param.Action, 'CPUTime') && ~isempty(Param.Action.CPUTime)
    1847         CPUTime=Param.Action.CPUTime; % Note: CpUTime for one iteration ref_i has to be multiplied by the number of j indices nbfield_j
    1848     end
     1848%     CPUTime=1; % job time estimated at 1 min per iteration (on index i and j) by default
     1849%     if isfield(Param.Action, 'CPUTime') && ~isempty(Param.Action.CPUTime)
     1850%         CPUTime=Param.Action.CPUTime; % Note: CpUTime for one iteration ref_i has to be multiplied by the number of j indices nbfield_j
     1851%     end
    18491852    nbfield_j=numel(ref_j); % number of j indices
    18501853    BlockLength=numel(ref_i); % by default, job involves the full set of i field indices
     
    18521855    switch RunMode
    18531856        case 'cluster'
     1857            if (isfield(Param.Action, 'CPUTime') && ~isempty(Param.Action.CPUTime))
     1858        CPUTime=Param.Action.CPUTime; % Note: CpUTime for one iteration ref_i has to be multiplied by the number of j indices nbfield_j
     1859            else
     1860               answer=msgbox_uvmat('INPUT_TXT','estimate the CPU time(in minutes) for each value of index i:' ,'');
     1861               CPUTime=str2num(answer);
     1862               set(handles.num_CPUTime,'String',answer)
     1863            end
    18541864            JobNumberMax=SeriesData.SeriesParam.ClusterParam.JobNumberMax;
    18551865            JobCPUTimeAdvised=SeriesData.SeriesParam.ClusterParam.JobCPUTimeAdvised;
     
    24242434set(handles.ActionName,'BackgroundColor',[1 1 1])
    24252435set(handles.ActionInput,'BackgroundColor',[1 0 1])% set ActionInput button to magenta color to indicate that input refr
    2426 
     2436set(handles.num_CPUTime,'String','')
    24272437
    24282438% --- Executes on button press in ActionInput.
     
    26372647    end
    26382648    if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),...
    2639             set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
     2649            set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end
    26402650end
    26412651
  • trunk/src/series/aver_stat.m

    r1093 r1097  
    225225
    226226%% settings for the output file
     227OutputDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
     228OutputPath=fullfile(Param.OutputPath,num2str(Param.Experiment),num2str(Param.Device));
    227229NomTypeOut=nomtype2pair(NomType{1});% determine the index nomenclature type for the output file
    228230first_i=i1_series{1}(1);
     
    467469   
    468470    %% writing the result file
    469     OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,first_i,last_i,first_j_out,last_j_out);
     471    OutputFile=fullfile_uvmat(OutputPath,OutputDir,RootFile{1},FileExtOut,NomTypeOut,first_i,last_i,first_j_out,last_j_out);
    470472    if strcmp(FileExtOut,'.png') %case of images
    471473        if isequal(FileInfo{1}.BitDepth,16)||(numel(FileInfo)==2 &&isequal(FileInfo{2}.BitDepth,16))
  • trunk/src/series/civ_input.m

    r1093 r1097  
    249249set(handles.dt_unit,'String',['dt in m' TimeUnit]);%display dt in unit 10-3 of the time (e.g ms)
    250250set(handles.TimeUnit,'String',TimeUnit);
    251 %set(handles.CoordUnit,'String',CoordUnit)
    252251set(handles.SearchRange,'UserData', pxcm_search);
    253252
     
    319318%% set the menu and default choice of civ pairs
    320319if ~isfield(Param.IndexRange,'first_j')||isequal(MaxIndex_j,MinIndex_j)% no possibility of j pairs
    321     set(handles.ListPairMode,'Value',1)
    322320    PairMenu={'series(Di)'};
    323321elseif  MaxIndex_i==1 && MaxIndex_j>1% simple series in j
    324322    PairMenu={'pair j1-j2';'series(Dj)'};
    325     if  MaxIndex_j <= 10
    326         set(handles.ListPairMode,'Value',1)% advice 'pair j1-j2' except in MaxIndex_j is large
    327     end
    328323else
    329324    PairMenu={'pair j1-j2';'series(Dj)';'series(Di)'};%multiple choice
    330     if strcmp(NomTypeNc,'_1-2_1')
    331         set(handles.ListPairMode,'Value',3)% advise 'series(Di)'
    332     elseif  MaxIndex_j <= 10
    333         set(handles.ListPairMode,'Value',1)% advice 'pair j1-j2' except in MaxIndex_j is large
    334     end
    335325end
    336326set(handles.ListPairMode,'String',PairMenu)
    337327
    338328%% set default choice of pair mode
    339 PairIndex=1;
     329PairIndex=[];
    340330if isfield(Param,'ActionInput') && isfield(Param.ActionInput,'PairIndices')
    341     PairIndex=find(strcmp(Param.ActionInput.PairIndices.ListPairMode,PairMenu));
     331    PairIndex=find(strcmp(Param.ActionInput.PairIndices.ListPairMode,PairMenu));%retrieve the previous option
    342332end
    343333if isempty(PairIndex)
     
    353343        elseif  MaxIndex_j <= 10
    354344            PairIndex=1;% advice 'pair j1-j2' except in MaxIndex_j is large
     345        else
     346            PairIndex=2;% advice 'Dj'
    355347        end
    356348    end
     
    17481740     ImageData.ListVarName={'ny','nx','A'};
    17491741     ImageData.VarDimName= {'ny','nx',{'ny','nx'}};
     1742     ImageData.VarAttribute{1}.Role='coord_y';
     1743     ImageData.VarAttribute{2}.Role='coord_x';
     1744     ImageData.VarAttribute{3}.Role='scalar';
    17501745     ImageData.A=imread(Data.Civ1_ImageA); % read the first image
    17511746     if ndims(ImageData.A)==3 %case of color image
  • trunk/src/series/civ_series.m

    r1096 r1097  
    7171    Data.OutputFileMode='NbInput_i';% one output file expected per value of i index (used for waitbar)
    7272    Data.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1)
    73     if isfield(Data.ActionInput,'PairIndices') && strcmp(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2')
     73    if isfield(Data,'ActionInput') && isfield(Data.ActionInput,'PairIndices') && strcmp(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2')
    7474        if isfield(Data.ActionInput.PairIndices,'ListPairCiv2')
    7575            str_civ=Data.ActionInput.PairIndices.ListPairCiv2;
     
    9090    end
    9191    % estimated CPUTime
    92     CPUtime_unit=0.01;%estimated time for a multiplication (in microsecond)
    93     if isfield(Param.SeriesData,'FileInfo')&&isfield(Param.SeriesData.FileInfo{1},'Height')&&isfield(Param.SeriesData.FileInfo{1},'Width')
    94         pixnbre=Param.SeriesData.FileInfo{1}.Height*Param.SeriesData.FileInfo{1}.Width; % total number of pxels for input images 
    95         CPUtime=0;
    96         if isfield(Data.ActionInput,'Civ1')
    97             %BoxSize=Data.ActionInput.Civ1.CorrBoxSize(1)*Data.ActionInput.Civ1.CorrBoxSize(2);
    98             tic
    99             testboxa=rand(Data.ActionInput.Civ1.CorrBoxSize(1),Data.ActionInput.Civ1.CorrBoxSize(2));
    100             testboxb=rand(Data.ActionInput.Civ1.SearchBoxSize(1),Data.ActionInput.Civ1.SearchBoxSize(2));
    101             anss=conv2(testboxa,testboxb);
    102             CPUtime_unit=toc;
    103             nb_box=pixnbre/(Data.ActionInput.Civ1.Dx*Data.ActionInput.Civ1.Dy);   
    104             %nbpos=Data.ActionInput.Civ1.SearchBoxSize-Data.ActionInput.Civ1.CorrBoxSize;
    105             CPUtime=2*CPUtime_unit*nb_box%*BoxSize*nbpos(1)*nbpos(2);% adjustement factor 2 used
    106         end
    107         if isfield(Data.ActionInput,'Patch1')
    108             CPUtime=2*CPUtime;
    109         end
    110         if isfield(Data.ActionInput,'Civ2')
    111             tic
    112             testboxa=rand(Data.ActionInput.Civ2.CorrBoxSize(1),Data.ActionInput.Civ2.CorrBoxSize(2));
    113             testboxb=rand(Data.ActionInput.Civ2.SearchBoxSize(1),Data.ActionInput.Civ2.SearchBoxSize(2));
    114             anss=conv2(testboxa,testboxb);
    115             CPUtime_unit=toc;
    116             nb_box=pixnbre/(Data.ActionInput.Civ2.Dx*Data.ActionInput.Civ2.Dy);
    117             %BoxSize=Data.ActionInput.Civ2.CorrBoxSize(1)*Data.ActionInput.Civ2.CorrBoxSize(2);
    118             %nbpos=Data.ActionInput.Civ2.SearchBoxSize-Data.ActionInput.Civ2.CorrBoxSize;
    119             CPUtime=CPUtime+2*CPUtime_unit*nb_box;%*BoxSize*nbpos(1)*nbpos(2);
    120         end
    121         if isfield(Data.ActionInput,'Patch2')
    122             CPUtime=(4/3)*CPUtime;
    123         end
    124         Data.CPUTime=ceil(CPUtime/6); % estimated CPU time per field pair in minute
    125         Data.CPUTime=Data.CPUTime/10; % displqy CPU time with 1 digit beyond dot
    126     end
     92%     CPUtime_unit=0.01;%estimated time for a multiplication (in microsecond)
     93%     if isfield(Param.SeriesData,'FileInfo')&&isfield(Param.SeriesData.FileInfo{1},'Height')&&isfield(Param.SeriesData.FileInfo{1},'Width')
     94%         pixnbre=Param.SeriesData.FileInfo{1}.Height*Param.SeriesData.FileInfo{1}.Width; % total number of pxels for input images 
     95%         CPUtime=0;
     96%         if isfield(Data.ActionInput,'Civ1')
     97%             %BoxSize=Data.ActionInput.Civ1.CorrBoxSize(1)*Data.ActionInput.Civ1.CorrBoxSize(2);
     98%             tic
     99%             testboxa=rand(Data.ActionInput.Civ1.CorrBoxSize(1),Data.ActionInput.Civ1.CorrBoxSize(2));
     100%             testboxb=rand(Data.ActionInput.Civ1.SearchBoxSize(1),Data.ActionInput.Civ1.SearchBoxSize(2));
     101%             anss=conv2(testboxa,testboxb);
     102%             CPUtime_unit=toc;
     103%             nb_box=pixnbre/(Data.ActionInput.Civ1.Dx*Data.ActionInput.Civ1.Dy);   
     104%             %nbpos=Data.ActionInput.Civ1.SearchBoxSize-Data.ActionInput.Civ1.CorrBoxSize;
     105%             CPUtime=2*CPUtime_unit*nb_box%*BoxSize*nbpos(1)*nbpos(2);% adjustement factor 2 used
     106%         end
     107%         if isfield(Data.ActionInput,'Patch1')
     108%             CPUtime=2*CPUtime;
     109%         end
     110%         if isfield(Data.ActionInput,'Civ2')
     111%             tic
     112%             testboxa=rand(Data.ActionInput.Civ2.CorrBoxSize(1),Data.ActionInput.Civ2.CorrBoxSize(2));
     113%             testboxb=rand(Data.ActionInput.Civ2.SearchBoxSize(1),Data.ActionInput.Civ2.SearchBoxSize(2));
     114%             anss=conv2(testboxa,testboxb);
     115%             CPUtime_unit=toc;
     116%             nb_box=pixnbre/(Data.ActionInput.Civ2.Dx*Data.ActionInput.Civ2.Dy);
     117%             %BoxSize=Data.ActionInput.Civ2.CorrBoxSize(1)*Data.ActionInput.Civ2.CorrBoxSize(2);
     118%             %nbpos=Data.ActionInput.Civ2.SearchBoxSize-Data.ActionInput.Civ2.CorrBoxSize;
     119%             CPUtime=CPUtime+2*CPUtime_unit*nb_box;%*BoxSize*nbpos(1)*nbpos(2);
     120%         end
     121%         if isfield(Data.ActionInput,'Patch2')
     122%             CPUtime=(4/3)*CPUtime;
     123%         end
     124%         Data.CPUTime=ceil(CPUtime/6); % estimated CPU time per field pair in minute
     125%         Data.CPUTime=Data.CPUTime/10; % displqy CPU time with 1 digit beyond dot
     126%     end
    127127    return
    128128end
     
    474474            Data.ListGlobalAttribute=[ListGlobalAttribute Civ1_param];
    475475            Data.CivStage=1;
     476        else
     477            i1=Param.ActionInput.PairIndices.ref_i; %case of TESTmode
    476478        end
    477479        % set the list of variables
  • trunk/src/series/merge_proj.m

    r1096 r1097  
    239239%% MAIN LOOP ON FIELDS
    240240%%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
    241 % for i_slice=1:NbSlice
    242 %     index_slice=i_slice:NbSlice:NbField;% select file indices of the slice
    243 %     NbFiles=0;
    244 %     nbmissing=0;
    245241
    246242    %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
  • trunk/src/series/sliding_average.m

    r1096 r1097  
    205205end
    206206NbPeriod=2; %number of periods for the sliding average
    207 omega=2*pi/T;
     207omega=2*2*pi/T;%harmonic
    208208Lscale=15;%diameter of the torus, length scale for normalisation
    209209Uscale=amplitude*omega;
  • trunk/src/transform_field/ima_levels.m

    r1093 r1097  
    6969fctblock= inline('mean(x(:))');
    7070B=imresize(Backg,size(A),'bilinear');% interpolate to the initial size image
    71 A=(A-B);%substract background
    72 AMean=blkproc(A,[nblock_y nblock_x],fctblock);% take the mean in  blocks
    73 fctblock= inline('var(x(:))');
    74 AVar=blkproc(A,[nblock_y nblock_x],fctblock);% take the mean in  blocks
    75 Avalue=AVar./AMean% typical value of particle luminosity
    76 Avalue=imresize(Avalue,size(A),'bilinear');% interpolate to the initial size image
    77 DataOut.A=uint16(1000*tanh(A./(2*Avalue)));
     71DataOut.A=B;
     72
     73% A=(A-B);%substract background
     74% AMean=blkproc(A,[nblock_y nblock_x],fctblock);% take the mean in  blocks
     75% fctblock= inline('var(x(:))');
     76% AVar=blkproc(A,[nblock_y nblock_x],fctblock);% take the mean in  blocks
     77% Avalue=AVar./AMean;% typical value of particle luminosity
     78% Avalue=imresize(Avalue,size(A),'bilinear');% interpolate to the initial size image
     79% DataOut.A=uint16(1000*tanh(A./(2*Avalue)));
    7880%Bmin=blkproc(Aflagmin,[nblock_y nblock_x],sumblock);% find the number of minima in blocks
    7981%Backg=Backg./Bmin; % find the average of minima in blocks
    8082
    8183
     84
     85
Note: See TracChangeset for help on using the changeset viewer.