Changeset 1197


Ignore:
Timestamp:
Mar 11, 2026, 5:31:25 PM (3 days ago)
Author:
sommeria
Message:

bugs repaired

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_field.m

    r1196 r1197  
    627627var_component=find(test_component);% list of variable indices elligible as unstructured coordinates
    628628var_coord=find(test_coord);% % list of variable indices elligible as gridded coordinates
    629 % index_coord=[];
    630 % index_component=[];
    631 % for iscalar=1:numel(scalar_index)
    632 %     index_component=[index_component find(var_component==scalar_index(iscalar),1)];
    633 %     index_coord=[index_coord find(var_coord==scalar_index(iscalar),1)];
    634 % end
    635 % var_component(index_component)=[];
    636 % var_coord(index_coord)=[];
    637629ListCoord=Field.Display.ListVarName([var_coord var_component]);
    638 %coord_val=zeros(size(ListCoord));
     630
    639631
    640632%% set default selection for grid coordinates
     
    903895function Coord_x_Callback(hObject, DimCell, handles)
    904896
    905 index=get(handles.Coord_x,'Value');
    906897string=get(handles.Coord_x,'String');
    907 VarName=string{index};
     898VarName=string{get(handles.Coord_x,'Value')};
    908899if ~ischar(DimCell)% no dimension as input
    909900    update_field(handles,VarName)% update the display of the variable 'VarName' and its dimensions in the general list of variables
    910901end
    911 if isequal(get(handles.FieldOption,'Value'),1)
     902MenuFieldOption=get(handles.FieldOption,'String');
     903FieldOption=MenuFieldOption{get(handles.FieldOption,'Value')};
     904if strcmp(FieldOption,'1D_plot')
    912905    set_coord_y_options(handles,VarName)
    913906end
  • trunk/src/read_field.m

    r1196 r1197  
    1616% FileType: type of file, as determined by the function get_file_info.m
    1717% ParamIn: movie object or Matlab structure of input parameters
    18 %     .FieldName: name (char string) of the input field (for Civx data)
    19 %     .VelType: char string giving the type of velocity data ('civ1', 'filter1', 'civ2'...)
    20 %     .ColorVar: variable used for vector color
     18%     .VelType: (for civdata) char string giving the type of velocity data ('civ1', 'filter1', 'civ2'...)
     19%     .FieldName:(for general netcdf files) name (char string) or list of names (cell of char strings) of fields to read
     20%     .ColorVar:(for general netcdf files) variable possibly used for vector color
    2121%     .Npx, .Npy: nbre of pixels along x and y (used for .vol input files)
    2222%     .TimeDimName: name of the dimension considered as 'time', selected index value then set by input 'frame_index'
     23%     .TimeVarName: name of the variable considered as 'time'
    2324% frame_index: frame number for movies or multidimensional netcdf files with dim >2
    2425%
  • trunk/src/series.m

    r1196 r1197  
    30673067                    TimeTable{LineIndex,5}=get_time(Param.IndexRange.MaxIndex_i(LineIndex),MaxIndex_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName);  % Max time
    30683068                case 'variable'
    3069                     set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName])
    3070                     set(handles.NomType,'String','*')
    3071                     set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% A VERIFIER !!!!!!
    3072                     set(handles.FileIndex,'String','')
     3069                    TimeName=['var:' GetFieldData.Time.TimeName];
     3070                   % set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName])
     3071%                     set(handles.NomType,'String','*')
     3072%                     set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% A VERIFIER !!!!!!
     3073%                     set(handles.FileIndex,'String','')
    30733074                    ParamIn.TimeVarName=GetFieldData.Time.TimeName;
    30743075                case 'matrix_index'
     
    33613362%------------------------------------------------------------------------
    33623363function CheckMask_Callback(hObject, eventdata, handles)
    3363 
     3364% SeriesData=get(handles.series,'UserData');
    33643365
    33653366if get(handles.CheckMask,'Value')
     3367   
    33663368    set(handles.DeleteMask,'Visible','on')
    33673369    Param=read_GUI_series(handles); % displayed parameters
     
    33793381    %checkmask=zeros(NbView,1);
    33803382    for iview=1:NbView
    3381         checkmask=0;
     3383        checkmask=false;
    33823384        FirstFileName=fullfile_uvmat(Param.InputTable{iview,1},Param.InputTable{iview,2},Param.InputTable{iview,3},...
    33833385            Param.InputTable{iview,5},Param.InputTable{iview,4},i1,i2,j1,j2);
    33843386       
    3385        % [FileInfo,VideoObject]=get_file_info(FirstFileName);
     3387        [FileInfo,VideoObject]=get_file_info(FirstFileName);
    33863388       
    33873389       
    3388 %         Data=nc2struct(FirstFileName);
    3389         if isfield(Data,'Civ2_Mask')
    3390             if exist(Data.Civ2_Mask,'file')
    3391             MaskTable{iview,1}=Data.Civ2_Mask;
    3392             checkmask=1;
     3390       %  Data=nc2struct(FirstFileName);
     3391        if isfield(FileInfo,'MaskFile') && isfield(FileInfo,'MaskExt')
     3392           if  isfield(FileInfo,'MaskNbSlice')&& exist([FileInfo.MaskFile '_1' FileInfo.MaskExt],'file')
     3393            MaskTable{iview,1}=[FileInfo.MaskFile '_1' FileInfo.MaskExt];
     3394            MaskTable{iview,2}=num2str(FileInfo.MaskNbSlice);
     3395            checkmask=true;
     3396           elseif exist([FileInfo.MaskFile FileInfo.MaskExt],'file')
     3397                 MaskTable{iview,1}=[FileInfo.MaskFile FileInfo.MaskExt];
     3398                 MaskTable{iview,2}='';
     3399                  checkmask=true;
    33933400            end
    33943401        end
     
    34103417    end
    34113418    set(handles.MaskTable,'Data',MaskTable)
    3412     set(handles.CheckMask,'Value',0)
    3413 end
     3419end
     3420
    34143421%       
    34153422% if ~isempty(NewMask)
  • trunk/src/series/civ_series.m

    r1196 r1197  
    276276    time_patch2=0;
    277277    if ~isempty(RUNHandle)% update the waitbar in interactive mode with GUI series  (checkrun=1)
    278         update_waitbar(WaitbarHandle,ifield/NbField)
    279278        if  checkrun && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    280279            disp('program stopped by user')
  • trunk/src/series/merge_proj.m

    r1196 r1197  
    354354            end
    355355            [MaskData,~,errormsg] = read_field(maskname,'image');
     356            if ~isempty(errormsg)
     357                disp(['error reading ' maskname ' :' errormsg])
     358                return
     359            end
    356360            if ~isempty(NbSlice_calib)
    357361                MaskData.ZIndex=mod(i1_series{iview}(index)-1,NbSlice_calib{iview})+1;%Zindex for phys transform
  • trunk/src/series/turb_correlation_x.m

    r1127 r1197  
    9494   
    9595%% root input file(s) name, type and index series
    96 RootPath=Param.InputTable(:,1);
    97 RootFile=Param.InputTable(:,3);
    98 SubDir=Param.InputTable(:,2);
    99 NomType=Param.InputTable(:,4);
    100 FileExt=Param.InputTable(:,5);
     96RootPath=Param.InputTable{:,1};
     97RootFile=Param.InputTable{:,3};
     98%SubDir=Param.InputTable(:,2);
     99NomType=Param.InputTable{1,4};
     100%FileExt=Param.InputTable(:,5);
    101101[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
    102102%%%%%%%%%%%%
     
    108108% i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
    109109%%%%%%%%%%%% NbView=1 : a single input series
    110 NbView=numel(i1_series);%number of input file series (lines in InputTable)
     110%NbView=numel(i1_series);%number of input file series (lines in InputTable)
    111111NbField_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
    112112NbField_i=size(i1_series{1},2); %nb of fields for the i index
    113113NbField=NbField_j*NbField_i; %total number of fields
    114114
    115 %% determine the file type on each line from the first input file
    116 ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
    117 NcTypeOptions={'netcdf','civx','civdata'};
    118 for iview=1:NbView
    119     if ~exist(filecell{iview,1}','file')
    120         msgbox_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'])
    121         return
    122     end
    123     [FileInfo{iview},MovieObject{iview}]=get_file_info(filecell{iview,1});
    124     FileType{iview}=FileInfo{iview}.FileType;
    125     CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
    126     CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files
    127     if ~isempty(j1_series{iview})
    128         frame_index{iview}=j1_series{iview};
    129     else
    130         frame_index{iview}=i1_series{iview};
    131     end
    132 end
    133 
    134 %% calibration data and timing: read the ImaDoc files
    135 XmlData=[];
    136 [XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series);
    137 if size(time,1)>1
    138     diff_time=max(max(diff(time)));
    139     if diff_time>0
    140         msgbox_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)])
    141     end   
    142 end
    143 
    144 %% coordinate transform or other user defined transform
    145 transform_fct='';%default
    146 if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
    147     addpath(Param.FieldTransform.TransformPath)
    148     transform_fct=str2func(Param.FieldTransform.TransformName);
    149     rmpath(Param.FieldTransform.TransformPath)
    150 end
    151 
    152 %%%%%%%%%%%% END STANDARD PART  %%%%%%%%%%%%
    153  % EDIT FROM HERE
    154 
    155 %% check the validity of  input file types
    156 if CheckImage{1}
    157     FileExtOut='.png'; % write result as .png images for image inputs
    158 elseif CheckNc{1}
    159     FileExtOut='.nc';% write result as .nc files for netcdf inputs
     115%% determine the file type on each line from the first input file
     116
     117[FileInfo,MovieObject]=get_file_info(filecell{1,1});
     118FileType=FileInfo.FileType;
     119
     120if ~isempty(j1_series{1})
     121    frame_index=j1_series{1};
    160122else
    161     msgbox_uvmat('ERROR',['invalid file type input ' FileType{1}])
    162     return
    163 end
    164 
     123    frame_index=i1_series{1};
     124end
    165125
    166126%% settings for the output file
    167 NomTypeOut=nomtype2pair(NomType{1});% determine the index nomenclature type for the output file
     127FileExtOut='.nc';% write result as .nc files for netcdf inputs
     128NomTypeOut=nomtype2pair(NomType);% determine the index nomenclature type for the output file
    168129first_i=i1_series{1}(1);
    169130last_i=i1_series{1}(end);
     
    177138%% Set field names and velocity types
    178139InputFields{1}=[];%default (case of images)
    179 if isfield(Param,'InputFields')
    180     InputFields{1}=Param.InputFields;
    181 end
    182 
     140%%%%%%%%%%%%%%%%%%%%%
     141if isfield(Param.IndexRange,'TimeSource') && find(regexp(Param.IndexRange.TimeSource,'^var:'))==1
     142    Param.InputFields.TimeVarName=regexprep(Param.IndexRange.TimeSource,'^var:','');
     143end
     144%%%%%%%%%%%%%%%%%%%%
     145% if isfield(Param,'InputFields')
     146%     InputFields{1}=Param.InputFields;
     147% end
     148Param.InputFields.FieldName={'Uprime','Vprime'};
    183149nbfiles=0;
    184150nbmissing=0;
     
    197163disp('loop for mean started')
    198164for index=1:NbField
    199     update_waitbar(WaitbarHandle,index/NbField)
    200     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    201         disp('program stopped by user')
    202         break
    203     end
    204     [Field,tild,errormsg] = read_field(filecell{1,index},FileType{iview},InputFields{iview},frame_index{iview}(index));
     165    %     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     166    %         disp('program stopped by user')
     167    %         break
     168    %     end
     169    [Field,~,errormsg] = read_field(filecell{1,index},FileType,Param.InputFields,frame_index(index));
     170   
     171    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     172    Field.U=Field.Uprime;
     173    Field.V=Field.Vprime;
     174    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    205175    if index==1 %first field
    206176        if ~isfield(Field,'U')||~isfield(Field,'V')
     
    208178            return
    209179        end
     180       
    210181        [npy,npx]=size(Field.U);
    211182        UMean=zeros(npy,npx);
    212183        VMean=zeros(npy,npx);
    213184        Counter=zeros(npy,npx);
    214                 % transcripts the global attributes
     185        % transcripts the global attributes
    215186        if isfield(Field,'ListGlobalAttribute')
    216187            DataOut.ListGlobalAttribute= Field.ListGlobalAttribute;
     
    236207disp('loop for correlation started')
    237208for index=1:NbField
    238     update_waitbar(WaitbarHandle,index/NbField)
    239209    if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    240210        disp('program stopped by user')
    241211        break
    242212    end
    243     [Field,tild,errormsg] = read_field(filecell{1,index},FileType{iview},InputFields{iview},frame_index{iview}(index));
    244 
     213    [Field,~,errormsg] = read_field(filecell{1,index},FileType,Param.InputFields,frame_index(index));
     214    Field.U=Field.Uprime;
     215    Field.V=Field.Vprime;
    245216    %%%%%%%%%%%% MAIN RUNNING OPERATIONS  %%%%%%%%%%%%
    246217    if index==1 %first field
     
    281252        VVCorr(ishift+npcorr+1,:,:)=Field.V.*V_shift;
    282253        UVCorr(ishift+npcorr+1,:,:)=Field.U.*V_shift;
    283         FFCorr(ishift+npcorr+1,:,:)=FF | FF_shift;     
     254        FFCorr(ishift+npcorr+1,:,:)=FF | FF_shift;
    284255    end
    285256    DataOut.UUCorr=DataOut.UUCorr+UUCorr;
     
    322293
    323294%% writing the result file as netcdf file
    324 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,first_i,last_i,first_j,last_j);
     295OutputFile=fullfile_uvmat(RootPath,OutputDir,RootFile,FileExtOut,NomTypeOut,first_i,last_i,first_j,last_j);
    325296 %case of netcdf input file , determine global attributes
    326297 errormsg=struct2nc(OutputFile,DataOut); %save result file
     
    331302 end
    332303
    333 
    334 %% open the result file with uvmat (in RUN mode)
    335 if checkrun
    336     uvmat(OutputFile)% open the last result file with uvmat
    337 end
Note: See TracChangeset for help on using the changeset viewer.