Ignore:
Timestamp:
Jun 26, 2012, 8:41:27 AM (12 years ago)
Author:
sommeria
Message:

series fcts updated to fit with new waitbar fct and background run mode, and various bug repairs

File:
1 edited

Legend:

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

    r474 r478  
    7272else
    7373    hseries=guidata(Param.hseries);%handles of the GUI series
    74     WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
    7574    if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
    7675        checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
     
    140139%% coordinate transform or other user defined transform
    141140transform_fct='';%default
    142 if isfield(Param,'FieldTransform')
     141if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
    143142    addpath(Param.FieldTransform.TransformPath)
    144143    transform_fct=str2func(Param.FieldTransform.TransformName);
     
    169168%     end
    170169% end
     170if checkrun==1
     171    return % stop here for input checks
     172end
    171173
    172174%% Set field names and velocity types
     
    242244for i_slice=1:NbSlice
    243245    index_slice=i_slice:NbSlice:nbfield;% select file indices of the slice
    244     nbfiles=0;
     246    nbfile=0;
    245247    nbmissing=0;
    246248   
     
    248250    for index=index_slice       
    249251        if checkrun
    250             update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield))
     252            update_waitbar(hseries.Waitbar,index/(nbfield))
    251253            stopstate=get(hseries.RUN,'BusyAction');
    252254        else
     
    255257       
    256258        %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%%
    257         Data=cell(1,nbview);%initiate the set Data
    258         nbtime=0;
    259         dt=[];
    260259        if isequal(stopstate,'queue')% enable STOP command
     260            Data=cell(1,nbview);%initiate the set Data
     261            nbtime=0;
     262            dt=[];
    261263            % loop on views (in case of multiple input series)
    262264            for iview=1:nbview
     
    277279                end
    278280            end
     281           
    279282            % coordinate transform (or other user defined transform)
    280283            if ~isempty(transform_fct)
     
    288291                end
    289292            end
     293           
     294            % field calculation (vort, div...)
     295            if strcmp(FileType{1},'civx')||strcmp(FileType{1},'civdata')
     296                Data{1}=calc_field(InputFields{1}.FieldName,Data{1});%calculate field (vort..)
     297            end
     298           
     299            % field substration (for two input file series)
    290300            if length(Data)==2
    291301                [Field,errormsg]=sub_field(Data{1},Data{2}); %substract the two fields
     
    296306                [Field,errormsg]=proj_field(Field,Param.ProjObject);
    297307            end
    298             nbtime=nbtime+1;
     308            nbfile=nbfile+1;
    299309           
    300310            % initiate the time series at the first iteration
    301             if nbtime==1
     311            if nbfile==1
    302312                % stop program if the first field reading is in error
    303313                if ~isempty(errormsg)
     
    356366                        if isequal(Param.ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode
    357367                            if isempty(VarVal)
    358                                 displ_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(ifile))],checkrun)
     368                                displ_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(index))],checkrun)
    359369                                return
    360370                            end
     
    378388            if isempty(time)% time read in ncfiles
    379389                if isfield(Field,'Time')
    380                     DataOut.Time(filecounter,1)=Field.Time;
     390                    DataOut.Time(nbfile,1)=Field.Time;
    381391                else
    382                     DataOut.Time(filecounter,1)=ifile;%default
     392                    DataOut.Time(nbfile,1)=index;%default
    383393                end
    384394            else % time from ImaDoc prevails  TODO: correct
    385                 %  DataOut.Time(filecounter,1)=time{1}(i1_series{1})(ifile),j1_series{1}(ifile))+time(end,i2_series{end}(ifile),j2_series{end}(ifile)))/2;
    386                 DataOut.Time(filecounter,1)=i1_series{1}(ifile);% TODO : generalise
     395                DataOut.Time(nbtime,1)=i1_series{1}(index);% TODO : generalise
    387396            end
    388397           
     
    390399            if ~isempty(errormsg)
    391400                nbmissing=nbmissing+1;
    392                 display(['ifile=' num2str(ifile) ':' errormsg])
     401                display(['index=' num2str(index) ':' errormsg])
    393402            end
    394403        end
     
    452461
    453462%% plot the time series (the last one in case of multislices)
    454 figure
    455 haxes=axes;
    456463if checkrun
    457 plot_field(DataOut,haxes)
    458 end
    459 
    460 %% display the result file using the GUI get_field
    461 hget_field=findobj(allchild(0),'name','get_field');
    462 if ~isempty(hget_field)
    463     delete(hget_field)
    464 end
    465 get_field(OutputFile,DataOut)
    466    
    467 
    468 
     464    figure
     465    haxes=axes;
     466    plot_field(DataOut,haxes)
     467       
     468    %% display the result file using the GUI get_field
     469    hget_field=findobj(allchild(0),'name','get_field');
     470    if ~isempty(hget_field)
     471        delete(hget_field)
     472    end
     473    get_field(OutputFile,DataOut)
     474end
     475
     476
Note: See TracChangeset for help on using the changeset viewer.