Changeset 134


Ignore:
Timestamp:
Nov 25, 2010, 3:49:11 PM (14 years ago)
Author:
gostiaux
Message:

fonction super_cmd ajoutés pour un run en background; a tester sous windows.
.log pour civ2 ajouté

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r133 r134  
    18491849time=get(handles.RootName,'UserData'); %get the set of times
    18501850civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method
    1851 super_cmd='#!/bin/bash \n';
    1852 super_cmd=[super_cmd '#$ -cwd \n'];
    1853 super_cmd=[super_cmd 'hostname && date \n'];
     1851super_cmd=[];
     1852
    18541853for ifile=1:nbfield
    18551854    for j=1:nbslice
     
    20962095            %endTESTgrid
    20972096            i_cmd=i_cmd+1;
    2098             cmd_CIV2=CIV2_CMD(filename_cmx,namelog,par_civ2,sparam);
     2097            filename_cmx(1:end-4)
     2098            cmd_CIV2=CIV2_CMD(filename_cmx(1:end-4),namelog,par_civ2,sparam);
    20992099            if isequal(civAll,0)
    21002100                if(isunix)
     
    22332233            %% to lauch the jobs locally :
    22342234            if(isunix)
    2235         %       cmd_str=['!. ' filename_bat ' &'];
    2236                 cmd_str=['!. ' filename_bat];
     2235              cmd_str=['!. ' filename_bat ' &'];
     2236%                 cmd_str=['!. ' filename_bat];
    22372237                display(cmd_str)
    2238          %       super_cmd=[super_cmd filename_bat]
    22392238     %            cmd_str=['!at -qb now -f ' filename_bat ' &']; %ou at -qb now -f bad idea...
    22402239            else %case of Windows
    22412240               cmd_str=['!' filename_bat ' &'];
    22422241            end
    2243             eval(cmd_str);
    2244             display(cmd_str);
    2245         end
    2246     end
    2247 end
     2242               super_cmd=[super_cmd '. ' filename_bat '\n']
     2243%             eval(cmd_str);
     2244%             display(cmd_str);
     2245        end
     2246    end
     2247end
     2248
     2249           
     2250% filename_superbat(end-2:end)='bat';
     2251%         fid=fopen(filename_bat,'w');
     2252%         fprintf(fid,cmd);
     2253%         fclose(fid);
     2254
    22482255if ~batch%TODO: a revoir, cas 'run as background task'
    2249     eval(['!.' super_cmd])
    2250 end
     2256    eval(['!. ' filename_superbat ' &'])
     2257    [Rootbat,Filebat,extbat]=fileparts(filename_cmx);
     2258    filename_superbat=fullfile(Rootbat,['toto.bat']);
     2259    fid=fopen(filename_superbat,'w');
     2260    fprintf(fid,super_cmd');
     2261    fclose(fid);
     2262end
     2263
    22512264
    22522265%save interface state
     
    22722285end
    22732286saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER  .xml)
     2287
     2288
    22742289
    22752290function [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=...
     
    24462461if isequal(subdir_civ1,''),subdir_civ1='A'; end% put default subdir
    24472462if isequal(subdir_civ2,''),subdir_civ2=subdir_civ1; end% put default subdir
    2448 currentdir=pwd;%store the current working directory
     2463currentdir=pwd%store the current working directory
    24492464[Path_ima,Name]=fileparts(filebase);%Path of the image files (.civ)
    24502465if ~exist(Path_ima,'dir')
     
    24532468    return
    24542469end
    2455 cd(Path_ima);%move to the directory of the images: needed to create the result dir by 'mkdir'
    2456 dircur=pwd; %current working directory
    2457 m2='';
    24582470[xx,message]=fileattrib(Path_ima);
    24592471if ~isempty(message) && ~isequal(message.UserWrite,1)
     
    24932505            end
    24942506        end
     2507 
    24952508        %create the new subdir_civ1
    24962509        if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir')
     2510            cd(Path_ima);         
    24972511            [xx,msg1]=mkdir(subdir_civ1_new);
     2512
    24982513            if ~strcmp(msg1,'')
    24992514                msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1])%error message for directory creation
    2500                 cd(currentdir)
    25012515                filecell={};
    25022516                return
    2503             else
     2517            else         
    25042518                [xx,msg2] = fileattrib(subdir_civ1_new,'+w','g'); %yield writing access (+w) to user group (g)
    25052519                if ~strcmp(msg2,'')
    2506                     msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg2])%error message for directory creation
    2507                     cd(currentdir)
     2520                    msgbox_uvmat('ERROR',['pb of permission for  ' subdir_civ1_new ': ' msg2])%error message for directory creation
    25082521                    filecell={};
    25092522                    return
    25102523                end
    25112524            end
     2525            cd(currentdir);
    25122526        end
    25132527        if strcmp(compare,'stereo PIV')&&(strcmp(mode,'pair j1-j2')||strcmp(mode,'series(Dj)')||strcmp(mode,'series(Di)'))%check second nc series
     
    25382552%             subdir_civ1=subdir_civ1_new;
    25392553            %create the new subdir_civ1
    2540             if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir')
     2554            if exist(fullfile(Path_ima,subdir_civ1_new),'dir')
     2555                   cd(Path_ima);         
    25412556                [xx,msg1]=mkdir(subdir_civ1_new);
     2557                            cd(currentdir);
    25422558                if ~strcmpl(msg1,'')
    25432559                    msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1])
     
    41824198%------------------------------------------------------------------------
    41834199% --- CIV2  CIV2  CIV2 CIV2
    4184 function cmd_CIV2=CIV2_CMD(filename_cmx,namelog,par,sparam)
     4200function cmd_CIV2=CIV2_CMD(filename,namelog,par,sparam)
    41854201%------------------------------------------------------------------------
    41864202%pixels per cm and matrix of the image times, read from the .civ file by uvmat
     
    42264242par.filename_ima_a=regexprep(par.filename_ima_a,'.png','');
    42274243par.filename_ima_b=regexprep(par.filename_ima_b,'.png','');% bug : .png appears two times ?
    4228 fid=fopen([filename_cmx '2'],'w');
     4244fid=fopen([filename '.cmx2'],'w');
    42294245fprintf(fid,['##############   CMX file' '\n' ]);
    42304246fprintf(fid,   ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility
     
    42594275fclose(fid);
    42604276
    4261 cmd_CIV2=[sparam.Civ2Bin ' -f ' filename_cmx ]; % redirect standard output to the log file
     4277cmd_CIV2=[sparam.Civ2Bin ' -f ' filename  '.cmx >' filename '.log' ]; % redirect standard output to the log file
    42624278cmd_CIV2=regexprep(cmd_CIV2,'\\','\\\\');
     4279namelog=regexprep(namelog,'\\','\\\\');
     4280
     4281if(isunix)
     4282    [Rootbat,Filebat,extbat]=fileparts(namelog);
     4283    ncName=fullfile(Rootbat,[ Filebat '.nc']);
     4284    cmd_CIV2=[cmd_CIV2 '\n' 'mv ' namelog  ' ' regexprep(namelog,'\.log','') '.civ2.log' '\n' 'chmod g+w ' ncName];
     4285else
     4286    cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y ' namelog ' ' regexprep(namelog,'\.log','') '.civ2.log'];
     4287end
     4288
     4289
    42634290
    42644291%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.