Changeset 912


Ignore:
Timestamp:
Jun 16, 2015, 8:15:10 PM (6 years ago)
Author:
sommeria
Message:

interp range introduced in set_object

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r908 r912  
    10101010end
    10111011
     1012%% interpolation range
     1013thresh2=[];
     1014if isfield(ObjectData,'RangeInterp')
     1015    thresh2=ObjectData.RangeInterp*ObjectData.RangeInterp;%square of interpolation range (do not interpolate beyond this range)
     1016end
     1017
    10121018%% initiate Matlab  structure for physical field
    10131019[ProjData,errormsg]=proj_heading(FieldData,ObjectData);
     
    13031309                    Disty=G(XI,YI)-YI;% diff of y coordinates with the nearest measurement point
    13041310                    Dist=Distx.*Distx+Disty.*Disty;
    1305                     for ivar=1:numel(VarVal)
    1306                         VarVal{ivar}(Dist>16*ProjData.CoordMesh)=NaN;% % put to NaN interpolated positions further than 4 meshes from initial data
    1307                     end 
    1308                    
     1311                    if ~isempty(thresh2)
     1312                        for ivar=1:numel(VarVal)
     1313                            VarVal{ivar}(Dist>thresh2)=NaN;% % put to NaN interpolated positions further than 4 meshes from initial data
     1314                        end
     1315                    end
    13091316                    if isfield(CellInfo{icell},'CheckSub') && CellInfo{icell}.CheckSub && ~isempty(vector_x_proj)
    13101317                        ProjData.(FieldData.ListVarName{vector_x_proj})=ProjData.(FieldData.ListVarName{vector_x_proj})-VarVal{1};
     
    13581365                for ilist=1:numel(ListVarName)% reshape data, excluding coordinates (ilist=1-2), TODO: rationalise
    13591366                    VarName=ListVarName{ilist};
     1367                    VarDimName{ilist}={'coord_y','coord_x'};
    13601368                    ProjData.(VarName)=DataOut.(VarName);
    1361                     ProjData.(VarName)(Dist>16*ProjData.CoordMesh)=NaN;% put to NaN interpolated positions further than 4 meshes from initial data
    1362                     VarDimName{ilist}={'coord_y','coord_x'};
     1369                    if ~isempty(thresh2)
     1370                        ProjData.(VarName)(Dist>thresh2)=NaN;% put to NaN interpolated positions further than RangeInterp from initial data
     1371                    end
    13631372                end
    13641373            end
  • trunk/src/series.m

    r911 r912  
    19291929            end
    19301930        end
    1931         filename_joblist=fullfile(DirOAR,'0_job_list.txt');%create name of the global executable file
     1931        filename_joblist=fullfile(DirOAR,'job_list.txt');%create name of the global executable file
    19321932        filename_log=fullfile(DirLog,'job_list.stdout');%file for output messages of the master oar process
    19331933        filename_errors=fullfile(DirLog,'job_list.stderr');%file for error messages of the master oar process
     
    19471947        % shorter than the wall time: in the time interval 'checkpoint' (WallTimeOneJob) before the end of the allowed duration,
    19481948        %  the oar job restarts when an individual job ends.
    1949         JobTime=CPUTime*BlockLength*nbfield_j% estimated time for one individual job (in minutes)
     1949        JobTime=CPUTime*BlockLength*nbfield_j;% estimated time for one individual job (in minutes)
    19501950        % wall time (in hours ) for each oar job, allowing 10 individual jobs, but limited to 23 h:
    19511951        WallTimeTotal=min(23,4*JobTime/60);
    1952         disp(['WallTimeTotal: ' num2str(WallTimeTotal) ' hours'])
     1952        %disp(['WallTimeTotal: ' num2str(WallTimeTotal) ' hours'])
    19531953        % estimated time of an individual job (in min), with a margin of error
    19541954        WallTimeOneJob=min(4*JobTime+10,WallTimeTotal*60/2);% estimated max time of an individual job for checkpoint
     
    33963396        elseif isequal(Civ,4) || isequal(Civ,5)
    33973397            imax=3;
    3398         elseif isequal(Civ,6) %patch2
     3398        else%if isequal(Civ,6) %patch2
    33993399            imax=4;
    34003400        end
  • trunk/src/series/check_data_files.m

    r908 r912  
    154154                    if strcmp(FileType{iview},'civx')||strcmp(FileType{iview},'civdata')
    155155                        if isfield(FileInfo,'CivStage')
    156                             liststage={'civ1','fix1','patch1','civ2','fix2','patch2'};
    157                             lastfield=liststage{FileInfo.CivStage};
     156                            liststage={'civ','fix','patch'};
     157                            stagechoice=1+mod(FileInfo.CivStage-1,3);
     158                            iter=1+floor((FileInfo.CivStage-1)/3);
     159                            lastfield=[liststage{stagechoice} num2str(iter)];
     160                            %liststage={'civ1','fix1','patch1','civ2','fix2','patch2'};                       
     161                            %lastfield=liststage{FileInfo.CivStage};                           
    158162                        end
    159163                    end
  • trunk/src/series/civ_series.m

    r911 r912  
    356356            end
    357357        end
    358         if ~CheckOverwrite && exist(ncfile,'file')         
    359         continue% skip iteration if the mode overwrite is desactivated and the result file already exists
     358        ncfile_out=ncfile;% by default
     359        if isfield (Param.ActionInput,'Civ2')
     360            i1_civ2=i1_series_Civ2(ifield);
     361            i2_civ2=i1_civ2;
     362            if ~isempty(i2_series_Civ2)
     363                i2_civ2=i2_series_Civ2(ifield);
     364            end
     365            j1_civ2=1;
     366            if ~isempty(j1_series_Civ2)
     367                j1_civ2=j1_series_Civ2(ifield);
     368            end
     369            j2_civ2=i1_civ2;
     370            if ~isempty(j2_series_Civ2)
     371                j2_civ2=j2_series_Civ2(ifield);
     372            end
     373            if strcmp(Param.ActionInput.ListCompareMode,'PIV')
     374                ncfile_out=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i1_civ2,i2_civ2,j1_civ2,j2_civ2);
     375            else % displacement
     376                ncfile_out=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i2_civ2,[],j2_civ2);
     377            end
     378        end
     379        if ~CheckOverwrite && exist(ncfile_out,'file')
     380            disp(['existing output file ' ncfile_out ' already exists, skip to next field'])
     381            continue% skip iteration if the mode overwrite is desactivated and the result file already exists
    360382        end
    361383    end
     
    582604            par_civ2.ImageA=[];
    583605            par_civ2.ImageB=[];
    584             i1=i1_series_Civ2(ifield);
    585             i2=i1;
    586             if ~isempty(i2_series_Civ2)
    587                 i2=i2_series_Civ2(ifield);
    588             end
    589             j1=1;
    590             if ~isempty(j1_series_Civ2)
    591                 j1=j1_series_Civ2(ifield);
    592             end
    593             j2=j1;
    594             if ~isempty(j2_series_Civ2)
    595                 j2=j2_series_Civ2(ifield);
    596             end
    597             ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1,[],j1);
     606%             i1_civ2=i1_series_Civ2(ifield);
     607%             i2_civ2=i1_civ2;
     608%             if ~isempty(i2_series_Civ2)
     609%                 i2_civ2=i2_series_Civ2(ifield);
     610%             end
     611%             j1_civ2=1;
     612%             if ~isempty(j1_series_Civ2)
     613%                 j1_civ2=j1_series_Civ2(ifield);
     614%             end
     615%             j2_civ2=i1_civ2;
     616%             if ~isempty(j2_series_Civ2)
     617%                 j2_civ2=j2_series_Civ2(ifield);
     618%             end
     619            ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_civ2,[],j1_civ2);
    598620           
    599621            if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A_Civ1(ifield),FrameIndex_A_Civ2(ifield))
     
    602624                [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A_Civ2,FileType_A,VideoObject_A,FrameIndex_A_Civ2(ifield));
    603625            end
    604             ImageName_B_Civ2=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2,[],j2);
     626            ImageName_B_Civ2=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_civ2,[],j2_civ2);
    605627            if strcmp(ImageName_B_Civ2,ImageName_B) && isequal(FrameIndex_B_Civ1(ifield),FrameIndex_B_Civ2)
    606628                par_civ2.ImageB=par_civ1.ImageB;
     
    608630                [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B_Civ2,FileType_B,VideoObject_B,FrameIndex_B_Civ2(ifield));
    609631            end
    610             if strcmp(Param.ActionInput.ListCompareMode,'PIV')
    611                 ncfile=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i1,i2,j1,j2);
    612             else % displacement
    613                 ncfile=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i2,[],j2);
    614             end
     632%             if strcmp(Param.ActionInput.ListCompareMode,'PIV')
     633%                 ncfile_out=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i1,i2,j1,j2);
     634%             else % displacement
     635%                 ncfile_out=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i2,[],j2);
     636%             end
    615637            par_civ2.ImageWidth=FileInfo_A.Width;
    616638            par_civ2.ImageHeight=FileInfo_A.Height;
     
    712734                Civ2_Dt=1;
    713735            else
    714                 Civ2_Dt=time(i2+1,j2+1)-time(i1+1,j1+1);
     736                Civ2_Dt=time(i2_civ2+1,j2_civ2+1)-time(i1_civ2+1,j1_civ2+1);
    715737            end
    716738        end
     
    737759            Data.Civ2_ImageB=ImageName_B;
    738760             if strcmp(Param.ActionInput.ListCompareMode,'displacement')
    739                 Data.Civ2_Time=time(i2+1,j2+1);% the time is the time of the secodn image
     761                Data.Civ2_Time=time(i2_civ2+1,j2_civ2+1);% the time is the time of the secodn image
    740762                Data.Civ2_Dt=1;% time interval is 1, to yield displacement instead of velocity=displacement/Dt at reading
    741763             else
    742             Data.Civ2_Time=(time(i2+1,j2+1)+time(i1+1,j1+1))/2;
     764            Data.Civ2_Time=(time(i2_civ2+1,j2_civ2+1)+time(i1_civ2+1,j1_civ2+1))/2;
    743765            Data.Civ2_Dt=Civ2_Dt;
    744766             end
     
    863885    %% write result in a netcdf file if requested
    864886    if CheckOutputFile
    865         errormsg=struct2nc(ncfile,Data);
     887        errormsg=struct2nc(ncfile_out,Data);
    866888        if isempty(errormsg)
    867             disp([ncfile ' written'])
     889            disp([ncfile_out ' written'])
    868890        else
    869891            disp(errormsg)
  • trunk/src/set_object.m

    r911 r912  
    3838function varargout = set_object(varargin)
    3939
    40 % Last Modified by GUIDE v2.5 15-Jun-2015 19:51:15
     40% Last Modified by GUIDE v2.5 16-Jun-2015 00:33:59
    4141
    4242% Begin initialization code - DO NOT REFRESH
     
    307307set(handles.num_DY,'Visible','off')
    308308set(handles.num_DZ,'Visible','off')
     309set(handles.num_RangeInterp,'Visible','off')
    309310
    310311switch ObjectStyle
     
    322323            set(handles.num_DX,'Visible','on')
    323324            set(handles.num_DX,'TooltipString','num_DX: mesh for the interpolated field along the line')
     325            set(handles.num_RangeInterp,'Visible','on')
    324326        end       
    325327    case {'rectangle','ellipse'}
     
    341343            set(handles.num_DX,'Visible','on')
    342344            set(handles.num_DY,'Visible','on')
     345            set(handles.num_RangeInterp,'Visible','on')
    343346        else
    344347            set(handles.num_DX,'Visible','off')
    345348            set(handles.num_DY,'Visible','off')
    346349        end
    347         if  isequal(ProjMode,'interp_lin')
    348             set(handles.num_DZ,'Visible','on') 
    349         end
     350%         if  isequal(ProjMode,'interp_lin')
     351%             set(handles.num_DZ,'Visible','on') 
     352%         end
    350353     case {'volume'} 
    351354        set(handles.num_RangeX_1,'Visible','on')
     
    372375% set default values read in the plot of uvmat to initiate the mesh
    373376if isequal(ProjMode,'interp_lin')|| isequal(ProjMode,'interp_tps')
     377            huvmat=findobj('Tag','uvmat');%find the current uvmat interface handle
     378        UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
    374379    if isempty(str2num(get(handles.num_DX,'String')))||isempty(str2num(get(handles.num_DY,'String')));     
    375         huvmat=findobj('Tag','uvmat');%find the current uvmat interface handle
    376         UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
    377         Field=UvData.Field;
     380%         Field=UvData.Field;
    378381        if  isfield(UvData.Field,'CoordMesh')&&~isempty(UvData.Field.CoordMesh)
    379382            set(handles.num_DX,'String',num2str(UvData.Field.CoordMesh))
     
    387390            set(handles.CoordUnit,'String',Field.CoordUnit)
    388391        end       
     392    end
     393    if isempty(str2num(get(handles.num_RangeInterp,'String')))
     394     set(handles.num_RangeInterp,'String',num2str(3*UvData.Field.CoordMesh))% default interpolationlength= 3 meshes
    389395    end
    390396end
     
    416422huvmat=findobj('Tag','uvmat');%find the current uvmat interface handle
    417423UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
    418 if isfield(UvData,'X') & isfield(UvData,'Y') & isfield(UvData,'Z')
     424if isfield(UvData,'X') && isfield(UvData,'Y') && isfield(UvData,'Z')
    419425    Z=norm_plane(1)*(UvData.X)+norm_plane(2)*(UvData.Y)+norm_plane(3)*(UvData.Z);
    420426    set(handles.z_slider,'Min',min(Z))
     
    691697        t=struct2xml(Object);
    692698        t=set(t,1,'name','ProjObject');
    693         save(t,FullName)
    694         msgbox_uvmat('CONFIRMATION',[FullName  ' saved'])
     699        try
     700            save(t,FullName)
     701            msgbox_uvmat('CONFIRMATION',[FullName  ' saved'])
     702        catch ME
     703            msgbox_uvmat('ERROR',ME.message)
     704        end
    695705    end
    696706end
     
    801811
    802812function num_RangeInterp_Callback(hObject, eventdata, handles)
    803 % hObject    handle to num_RangeInterp (see GCBO)
    804 % eventdata  reserved - to be defined in a future version of MATLAB
    805 % handles    structure with handles and user data (see GUIDATA)
    806 
    807 % Hints: get(hObject,'String') returns contents of num_RangeInterp as text
    808 %        str2double(get(hObject,'String')) returns contents of num_RangeInterp as a double
    809 
    810 
    811 % --- Executes during object creation, after setting all properties.
    812 function num_RangeInterp_CreateFcn(hObject, eventdata, handles)
    813 % hObject    handle to num_RangeInterp (see GCBO)
    814 % eventdata  reserved - to be defined in a future version of MATLAB
    815 % handles    empty - handles not created until after all CreateFcns called
    816 
    817 % Hint: edit controls usually have a white background on Windows.
    818 %       See ISPC and COMPUTER.
    819 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    820     set(hObject,'BackgroundColor','white');
    821 end
Note: See TracChangeset for help on using the changeset viewer.