Ignore:
Timestamp:
Aug 20, 2012, 12:32:31 PM (12 years ago)
Author:
sommeria
Message:

bugs corrected; Posiibility of usual 1D plots introduced with the new way of using get_field. time_series and aver_stat updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/time_series.m

    r524 r526  
    6363end
    6464
    65 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
     65%%%%%%%%%%%% STANDARD PART %%%%%%%%%%%%
    6666%% select different modes,  RUN, parameter input, BATCH
    6767% BATCH  case: read the xml file for batch case
     
    8787NomType=Param.InputTable(:,4);
    8888FileExt=Param.InputTable(:,5);
    89 
    90 % get the set of input file names (cell array filecell), and the lists of
    91 % input file or frame indices i1_series,i2_series,j1_series,j2_series
    9289[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
    93 % filecell{iview,fileindex}: cell array representing the list of file names
     90%%%%%%%%%%%%
     91% The cell array filecell is the list of input file names, while
     92% filecell{iview,fileindex}:
    9493%        iview: line in the table corresponding to a given file series
    9594%        fileindex: file index within  the file series,
    9695% i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j
    9796% i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
    98 % set of frame indices used for movie or multimage input
    99 % numbers of slices and file indices
    100 
     97%%%%%%%%%%%%
    10198NbSlice=1;%default
    10299if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)
     
    138135
    139136%% coordinate transform or other user defined transform
    140 transform_fct='';%default
     137transform_fct=[];%default
    141138if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
    142139    addpath(Param.FieldTransform.TransformPath)
     
    148145 % EDIT FROM HERE
    149146
    150 %% check the validity of  input file types
     147%% check the validity of  ctinput file types
    151148if CheckImage{1}
    152149    FileExtOut='.png'; % write result as .png images for image inputs
     
    162159end
    163160NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series
    164 % if NbSlice~=nbfield_j
    165 %     answer=_uvmat('INPUT_Y-N',['will not average slice by slice: for so cancel and set NbSlice= ' num2str(nbfield_j)]);
    166 %     if ~strcmp(answer,'Yes')
    167 %         return
    168 %     end
    169 % end
    170161if checkrun==1
    171162    return % stop here for input checks
     
    189180    end
    190181end
    191 %%% TO UPDATE
    192 if isequal(InputFields{1},'get_field...')
    193     hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI
    194     if numel(hget_field)>1
    195         delete(hget_field(2:end)) % delete multiple occurerence of the GUI get_fioeld
    196     elseif isempty(hget_field)
    197         filename=filecell{1,1};
    198       % filename=name_generator(filebase{1},i1_series{1}(1),j1_series{1}(1),FileExt{1},NomType{1},1,i2_series{1}(1),num_j2{1}(1),SubDir{1});
    199        idetect(iview)=exist(filename,'file');
    200        hget_field=get_field(filename);
    201        return
    202     end
    203     SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
    204     if isempty(SubField)
    205         delete(hget_field)
    206         filename=filecell{1,1};
    207        %filename=name_generator(filebase{1},i1_series{1}(1),j1_series{1}(1),FileExt{1},NomType{1},1,i2_series{1}(1),j2_series{1}(1),SubDir{1});
    208         hget_field=get_field(filename);
    209         SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
    210     end
    211 end
    212 %%%%%%%
    213182
    214183%% Initiate output fields
     
    255224            stopstate='queue';
    256225        end
    257        
    258         %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%%
    259226        if isequal(stopstate,'queue')% enable STOP command
    260227            Data=cell(1,nbview);%initiate the set Data
    261228            nbtime=0;
    262229            dt=[];
    263             % loop on views (in case of multiple input series)
     230            %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%%
    264231            for iview=1:nbview
    265232                % reading input file(s)
    266                 [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},Param.InputFields,frame_index{iview}(index));
     233                [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},InputFields{iview},frame_index{iview}(index));
    267234                if ~isempty(errormsg)
    268235                    errormsg=['time_series/read_field/' errormsg];
     
    280247            end
    281248           
     249            Field=Data{1}; % default input field structure
    282250            % coordinate transform (or other user defined transform)
    283251            if ~isempty(transform_fct)
    284                 if nbview==2
    285                     [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});
    286                     if isempty(Data{2})
    287                         Data(2)=[];
    288                     end
    289                 else
    290                     Data{1}=transform_fct(Data{1},XmlData{1});
    291                 end
    292             end
    293            
    294             % field substration (for two input file series)
    295             if length(Data)==2
    296                 [Field,errormsg]=sub_field(Data{1},Data{2}); %substract the two fields
    297             else
    298                 Field=Data{1};
    299             end
     252                switch nargin(transform_fct)
     253                    case 4
     254                        if length(Data)==2
     255                            Field=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});
     256                        else
     257                            Field=transform_fct(Data{1},XmlData{1});
     258                        end
     259                    case 3
     260                        if length(Data)==2
     261                            Field=transform_fct(Data{1},XmlData{1},Data{2});
     262                        else
     263                            Field=transform_fct(Data{1},XmlData{1});
     264                        end
     265                    case 2
     266                        Field=transform_fct(Data{1},XmlData{1});
     267                    case 1
     268                        Field=transform_fct(Data{1});
     269                end
     270            end
     271           
     272            % calculate tps coefficients if needed
     273            if isfield(Param.ProjObject,'ProjMode')&& strcmp(Param.ProjObject.ProjMode,'filter')
     274                Field=calc_tps(Field,check_proj_tps);
     275            end
     276           
     277            %field projection on an object
    300278            if Param.CheckObject
    301279                [Field,errormsg]=proj_field(Field,Param.ProjObject);
     280                if ~isempty(errormsg)
     281                    msgbox_uvmat('ERROR',['error in aver_stat/proj_field:' errormsg])
     282                    return
     283                end
    302284            end
    303285            nbfile=nbfile+1;
Note: See TracChangeset for help on using the changeset viewer.