Changeset 225


Ignore:
Timestamp:
Mar 20, 2011, 3:27:44 PM (13 years ago)
Author:
sommeria
Message:

civ : bug in binary check repaired. Introduction of the option PIVlab for PIV (still under test)

Location:
trunk/src
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r224 r225  
    15651565
    15661566% start status callback to visualise results
    1567 if isfield(handles,'status')
    1568 set(handles.status,'Value',1);%suppress status display
    1569 status_Callback(hObject, eventdata, handles)
     1567if isfield(handles,'status') && ~isequal(get(handles.CivAll,'Value'),3)
     1568    set(handles.status,'Value',1);%suppress status display
     1569    status_Callback(hObject, eventdata, handles)
    15701570end
    15711571
     
    16541654nbslice=numel(num_a_civ1);
    16551655
    1656 %% choice of batch priority
    1657 ind_answer=2;
     1656
     1657%% read names of the .exe files for PIV and patch
     1658path_UVMAT=fileparts(which('uvmat')); %path to the source directory of uvmat
     1659xmlfile='PARAM.xml';
     1660if exist(xmlfile,'file')% search parameter xml file in the whole matlab path
     1661    t=xmltree(xmlfile);
     1662    s=convert(t);
     1663end
     1664test_interp=0;
    16581665if batch
     1666    if isfield(s,'BatchParam')
     1667        sparam=s.BatchParam;
     1668        if ~ismember(sparam.BatchMode,{'sge'})
     1669            msgbox_uvmat('ERROR',['batch mode ' sparam.BatchMode ' not supported by UVMAT'])
     1670        end
     1671    else
     1672        msgbox_uvmat('ERROR','no batch civ binaries defined in PARAM.xml')
     1673        return
     1674    end
     1675    if isfield(sparam,'BatchMode')
     1676        batch_mode=sparam.BatchMode;
     1677    end
     1678    % choice of batch priority:
     1679    ind_answer=2;
    16591680    [s,w]=unix('qstat -q civ.q|grep job_| wc -l'); %check the waiting list (command unix)
    16601681    if isequal(s,0)
     
    16691690        end
    16701691    else
    1671         msgbox_uvmat('ERROR','batch system not available')
    1672         return
    1673     end
    1674 % else
    1675 %     if isunix
    1676 %         [xx,w]=unix('ps faux |grep civ|wc -l');
    1677 %         w(end)=[];
    1678 %         if str2double(w)+numel(num1_civ1)> 50
    1679 %             msgbox_uvmat('ERROR',{['There are already ' w ' civ processes running locally'];'Use BATCH or submit RUN later'})
    1680 %             return
    1681 %         end
    1682 %     end
    1683 end
    1684 
    1685 
    1686 %% read names of the .exe files for PIV and patch
    1687 path_UVMAT=fileparts(which('uvmat')); %path to the source directory of uvmat
    1688 xmlfile='PARAM.xml';
    1689 if exist(xmlfile,'file')% search parameter xml file in the whole matlab path
    1690     t=xmltree(xmlfile);
    1691     s=convert(t);
    1692 end
    1693 test_interp=0;
    1694 if batch
    1695     if isfield(s,'BatchParam')
    1696         sparam=s.BatchParam;
    1697         if ~ismember(sparam.BatchMode,{'sge'})
    1698             msgbox_uvmat('ERROR',['batch mode ' sparam.BatchMode ' not supported by UVMAT'])
    1699         end
    1700     else
    1701         msgbox_uvmat('ERROR','no batch mode defined in PARAM.xml')
     1692        msgbox_uvmat('ERROR','sge batch system not available')
    17021693        return
    17031694    end
     
    17061697        sparam=s.RunParam;
    17071698    else
    1708         msgbox_uvmat('ERROR','no civ binaries defined in PARAM.xml')
     1699        msgbox_uvmat('ERROR','no run civ binaries defined in PARAM.xml')
    17091700        return
    17101701    end
    1711     if isfield(sparam,'CivBin')
    1712         if ~exist(sparam.CivBin,'file')||~isequal(which(sparam.CivBin),sparam.CivBin)% if path defined as relative to uvmat
    1713             CivBin=sparam.CivBin;
    1714             sparam.CivBin=fullfile(path_UVMAT,sparam.CivBin);
    1715             if ~exist(sparam.CivBin,'file')
    1716                  msgbox_uvmat('ERROR',['CIVx binary ' CivBin ' defined in PARAM.xm does not exist'])
    1717                  return
    1718             end
    1719         end
    1720     end
    1721     if isfield(sparam,'Civ1Bin')
    1722         if ~exist(sparam.Civ1Bin,'file')||~isequal(which(sparam.Civ1Bin),sparam.Civ1Bin)% if path defined as relative to uvmat
    1723 %             CivBin=sparam.Civ1Bin;
    1724             sparam.Civ1Bin=fullfile(path_UVMAT,sparam.Civ1Bin);
    1725             if ~exist(sparam.Civ1Bin,'file')
    1726                  msgbox_uvmat('ERROR',['civ1 binary ' sparam.Civ1Bin ' defined in PARAM.xm does not exist'])
    1727                  return
    1728             end
    1729         end
    1730     end
    1731     if isfield(sparam,'Civ2Bin')
    1732 %         CivBin=sparam.Civ2Bin;
    1733         if ~exist(sparam.Civ2Bin,'file')||~isequal(which(sparam.Civ2Bin),sparam.Civ2Bin)% if path defined as relative to uvmat
    1734             sparam.Civ2Bin=fullfile(path_UVMAT,sparam.Civ2Bin);
    1735             if ~exist(sparam.Civ2Bin,'file')
    1736                  msgbox_uvmat('ERROR',['civ2 binary ' sparam.Civ2Bin ' defined in PARAM.xm does not exist'])
    1737                  return
    1738             end
    1739         end
    1740     end
    1741     if  isfield(sparam,'PatchBin')
    1742         if ~exist(sparam.PatchBin,'file')||~isequal(which(sparam.PatchBin),sparam.PatchBin)% if path defined as relative to uvmat
    1743             sparam.PatchBin=fullfile(path_UVMAT,sparam.PatchBin);
    1744         end
    1745     end
    1746     if isfield(sparam,'FixBin')
    1747         if ~exist(sparam.FixBin,'file')||~isequal(which(sparam.FixBin),sparam.FixBin)% if path defined as relative to uvmat
    1748             sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin);
    1749         end
    1750     end
    1751 end
    1752 if batch
    1753     if isfield(sparam,'BatchMode')
    1754         batch_mode=sparam.BatchMode;
    1755     end
    1756 end
     1702end
     1703civAll=isequal(get(handles.CivAll,'Value'),2); % Boolean for new civ programs
     1704if civAll && isfield(sparam,'CivBin')
     1705    CivBin=sparam.CivBin;
     1706    if ~exist(CivBin,'file') || ~isempty(which(CivBin))% if path defined as relative to uvmat
     1707        sparam.CivBin=fullfile(path_UVMAT,CivBin);
     1708        if ~exist(sparam.CivBin,'file')
     1709             msgbox_uvmat('ERROR',['CIVx binary ' CivBin ' defined in PARAM.xm does not exist'])
     1710             return
     1711        end
     1712    end
     1713end
     1714if isfield(sparam,'Civ1Bin')
     1715    Civ1Bin=sparam.Civ1Bin;
     1716    which(Civ1Bin)
     1717    if ~exist(Civ1Bin,'file')||~isempty(which(Civ1Bin))% if path defined as relative to uvmat
     1718        sparam.Civ1Bin=fullfile(path_UVMAT,Civ1Bin);
     1719        if ~exist(sparam.Civ1Bin,'file')
     1720             msgbox_uvmat('ERROR',['civ1 binary ' Civ1Bin ' defined in PARAM.xm does not exist'])
     1721             return
     1722        end
     1723    end
     1724end
     1725if isfield(sparam,'Civ2Bin')
     1726    Civ2Bin=sparam.Civ2Bin;
     1727    if ~exist(Civ2Bin,'file')||~isempty(which(Civ2Bin))% if path defined as relative to uvmat     
     1728        sparam.Civ2Bin=fullfile(path_UVMAT,Civ2Bin);
     1729        if ~exist(sparam.Civ2Bin,'file')
     1730             msgbox_uvmat('ERROR',['civ2 binary ' Civ2Bin ' defined in PARAM.xm does not exist'])
     1731             return
     1732        end
     1733    end
     1734end
     1735if  isfield(sparam,'PatchBin')
     1736    if ~exist(sparam.PatchBin,'file')||~isempty(which(sparam.PatchBin))% if path defined as relative to uvmat
     1737        sparam.PatchBin=fullfile(path_UVMAT,sparam.PatchBin);
     1738    end
     1739end
     1740if isfield(sparam,'FixBin')
     1741    if ~exist(sparam.FixBin,'file')||~isempty(which(sparam.FixBin))% if path defined as relative to uvmat
     1742        sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin);
     1743    end
     1744end
     1745
    17571746
    17581747
     
    18571846%% MAIN LOOP
    18581847time=get(handles.RootName,'UserData'); %get the set of times
    1859 civAll=get(handles.CivAll,'Value'); % Boolean for new civ excution method
    18601848super_cmd=[];
    18611849
     
    22322220        if isequal(civAll,1)
    22332221            save(civAllxml,[flname '.xml']);
    2234             'TEST'
    2235             cmd=[cmd sparam.CivBin ' -f ' flname '.xml '  civAllCmd ' >' flname '.log' '\n']
    2236             'fincmd'
     2222            cmd=[cmd sparam.CivBin ' -f ' flname '.xml '  civAllCmd ' >' flname '.log' '\n'];
    22372223        end
    22382224        % create the .bat file:
     
    22512237                    eval(  ['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]);
    22522238            end
    2253         else
     2239        elseif ~isequal(get(handles.CivAll,'Value'),3)
    22542240            %% to lauch the jobs locally :
    22552241            if(isunix)
     
    22602246            super_cmd=[super_cmd cmd_str '\n'];         
    22612247            disp(cmd_str);
    2262         end
    2263     end
    2264 end
    2265 
    2266 if ~batch
     2248        else       %run PIVlab if selected
     2249            image1=imread(par_civ1.filename_ima_a);
     2250            image2=imread(par_civ1.filename_ima_b);         
     2251               [xtable ytable utable vtable ctable typevector] = pivlab (image1,image2,str2num(par_civ1.ibx), str2num(par_civ1.dx), 1, [], []);
     2252               Data.ListGlobalAttribute={'title','Time','Dt'};
     2253               Data.title='PIVlab';
     2254               Data.Time=str2double(par_civ1.T0);
     2255               Data.Dt=str2double(par_civ1.Dt);
     2256               Data.ListVarName={'X','Y','U','V','C','FF'};%  cell array containing the names of the fields to record
     2257               Data.VarDimName={'nbvec','nbvec','nbvec','nbvec','nbvec','nbvec'};
     2258                Data.VarAttribute{1}.Role='coord_x';
     2259            Data.VarAttribute{2}.Role='coord_y';
     2260            Data.VarAttribute{3}.Role='vector_x';
     2261            Data.VarAttribute{4}.Role='vector_y';
     2262            Data.VarAttribute{5}.Role='errorflag';
     2263            Data.X=reshape(xtable,[],1);
     2264            Data.Y=reshape(ytable,[],1);
     2265            Data.U=reshape(utable,[],1);
     2266            Data.V=reshape(vtable,[],1);
     2267            Data.C=reshape(ctable,[],1);
     2268            Data.FF=reshape(~typevector,[],1);
     2269            errormsg=struct2nc(filecell.nc.civ1{ifile,j},Data);
     2270            if isempty(errormsg)
     2271                display([filecell.nc.civ1{ifile,j} ' written'])
     2272            else
     2273                msgbox_uvmat('ERROR',errormsg)
     2274            end
     2275        end                 
     2276    end
     2277end
     2278
     2279if ~batch && ~isequal(get(handles.CivAll,'Value'),3)
    22672280    [Rootbat,Filebat,extbat]=fileparts(filename_bat);
    22682281    filename_superbat=fullfile(Rootbat,['job_list.bat']);
     
    22742287     end
    22752288     system([filename_superbat ' &'])% execute main commmand
    2276 %     else
    2277 %         eval(['!' filename_superbat ' &']);
    2278 %     end
    22792289end
    22802290
     
    37303740set(handles.rho_patch1,'Visible','on')
    37313741set(handles.rho_text1,'Visible','on')
    3732 if get(handles.CivAll,'Value')
     3742if get(handles.CivAll,'Value')==2
    37333743    set(handles.thresh_patch1,'Visible','on')
    37343744    set(handles.thresh_text1,'Visible','on')
     
    45814591
    45824592%------------------------------------------------------------------------
    4583 % --- Executes on button press in TestCiv1.
     4593% --- Executes on button press in TestCiv1: display image correlation function
    45844594function TestCiv1_Callback(hObject, eventdata, handles)
    45854595%------------------------------------------------------------------------
     
    47734783% --- Executes on button press in CivAll.
    47744784function CivAll_Callback(hObject, eventdata, handles)
    4775 if get(handles.CivAll,'Value')
     4785if get(handles.CivAll,'Value')==2
    47764786    if get(handles.PATCH1,'Value')
    47774787        set(handles.thresh_patch1,'Visible','on')
  • trunk/src/mouse_motion.m

    r224 r225  
    241241                        Asub=reshape(Asub,[],1);%first sub-image reshaped as matlab vector
    242242                        rangx(1)=-(isx2-ibx2)+shiftx;
    243                         rangx(2)=isx2-ibx2+shiftx
     243                        rangx(2)=isx2-ibx2+shiftx;
    244244                        rangy(1)=-(isy2-iby2)-shifty;
    245245                        rangy(2)=(isy2-iby2)-shifty
  • trunk/src/test_netcdf.m

    r142 r225  
    2929Data.VarAttribute{6}.longname='interpolated ordinate';
    3030Data.VarAttribute{7}.longname='stream function';
     31Data.VarAttribute{1}.Role='coord_x';
     32Data.VarAttribute{2}.Role='coord_y';
     33Data.VarAttribute{3}.Role='vector_x';
     34Data.VarAttribute{4}.Role='vector_y';
    3135
    3236nbvec=200;
Note: See TracChangeset for help on using the changeset viewer.