Changeset 290
- Timestamp:
- Nov 21, 2011, 10:05:59 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r289 r290 1601 1601 test_command='qstat'; 1602 1602 case 'oar' 1603 test_command='oar tat';1603 test_command='oarstat'; 1604 1604 end 1605 1605 [s,w]=system(test_command); … … 1842 1842 end 1843 1843 if Param.CheckCiv2==1 1844 param.civ2.filename_ima_a=filecell.ima1.civ2{ifile,j}; 1845 param.civ2.filename_ima_b=filecell.ima2.civ2{ifile,j}; 1846 param.civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j))); 1847 param.civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2); 1848 param.civ2.term_a=num2stra(num_a_civ2(j),nom_type_nc); 1849 param.civ2.term_b=num2stra(num_b_civ2(j),nom_type_nc); 1850 param.civ2.filename_nc1=filecell.nc.civ1{ifile,j}; 1851 param.civ2.filename_nc1(end-2:end)=[]; % remove '.nc' 1844 Param.Civ2.filename_ima_a=filecell.ima1.civ2{ifile,j}; 1845 Param.Civ2.filename_ima_b=filecell.ima2.civ2{ifile,j}; 1846 Param.Civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j))); 1847 Param.Civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2); 1848 Param.Civ2.term_a=num2stra(num_a_civ2(j),nom_type_nc); 1849 Param.Civ2.term_b=num2stra(num_b_civ2(j),nom_type_nc); 1850 Param.Civ2.filename_nc1=filecell.nc.civ1{ifile,j}; 1851 Param.Civ2.filename_nc1(end-2:end)=[]; % remove '.nc' 1852 Param.Civ2.pxcmx=1; %velocities are expressed in pixel dispalcement 1853 Param.Civ2.pxcmy=1; 1852 1854 if Param.Civ2.CheckMask 1853 1855 maskdispl=get(handles.txt_Mask,'String'); 1854 1856 if exist(maskdispl,'file') 1855 param.civ2.maskname=maskdispl;1856 param.civ2.maskflag='y';1857 Param.Civ2.MaskName=maskdispl; 1858 Param.Civ2.MaskFlag='y'; 1857 1859 else 1858 1860 maskbase=[filecell.filebase '_' maskdispl]; % 1859 1861 nbslice_mask=str2double(maskdispl(1:end-4)); % 1860 1862 num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; 1861 param.civ2.maskname=name_generator(maskbase,num1_mask,1,'.png','_i');1862 if exist( param.civ2.maskname,'file')1863 param.civ2.maskflag='y';1863 Param.Civ2.MaskName=name_generator(maskbase,num1_mask,1,'.png','_i'); 1864 if exist(Param.Civ2.MaskName,'file') 1865 Param.Civ2.MaskFlag='y'; 1864 1866 else 1865 param.civ2.maskname='noFile use default';1866 param.civ2.maskflag='n';1867 Param.Civ2.MaskName='noFile use default'; 1868 Param.Civ2.MaskFlag='n'; 1867 1869 end 1868 1870 end 1869 1871 else 1870 param.civ2.maskname='noFile use default';1871 param.civ2.maskflag='n';1872 Param.Civ2.MaskName='noFile use default'; 1873 Param.Civ2.MaskFlag='n'; 1872 1874 end 1873 1875 gridname=get(handles.txt_GridName,'String'); … … 1875 1877 nbslice_grid=str2double(gridname(1:end-4)); % 1876 1878 if ~isnan(nbslice_grid) 1877 param.civ2.gridflag='y';1879 Param.Civ2.GridFlag='y'; 1878 1880 num1_grid=mod(num1_civ2(ifile)-1,nbslice_grid)+1; 1879 param.civ2.gridname=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];1880 if exist( param.civ2.gridname,'file')1881 param.civ2.gridflag='y';1881 Param.Civ2.GridName=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 1882 if exist(Param.Civ2.GridName,'file') 1883 Param.Civ2.GridFlag='y'; 1882 1884 else 1883 param.civ2.gridname='noFile use default';1884 param.civ2.gridflag='n';1885 Param.Civ2.GridName='noFile use default'; 1886 Param.Civ2.GridFlag='n'; 1885 1887 end 1886 1888 elseif exist(gridname,'file') 1887 param.civ2.gridflag='y';1889 Param.Civ2.GridFlag='y'; 1888 1890 else 1889 param.civ2.gridname='noFile use default';1890 param.civ2.gridflag='n';1891 Param.Civ2.GridName='noFile use default'; 1892 Param.Civ2.GridFlag='n'; 1891 1893 end 1892 end 1894 else 1895 Param.Civ2.GridName='noFile use default'; 1896 Param.Civ2.GridFlag='n'; 1897 end 1898 A=imread(filecell.ima1.civ2{1,1});%read the first image to get the size 1899 sizim=size(A); 1900 Param.Civ2.npx=(sizim(2)); 1901 Param.Civ2.npy=(sizim(1)); 1902 1893 1903 switch CivMode 1894 1904 case 'CivX' 1895 cmd_CIV2=CIV2_CMD(filecell.nc.civ2{ifile,j},param);%creates the cmx file [fullfile(Rootbat,Filebat) '.civ2.cmx]1896 cmd=[cmd cmd_CIV2'\n'];1905 cmd=[cmd... 1906 cmd_civ2(filecell.nc.civ2{ifile,j},Param) '\n']; 1897 1907 case 'CivAll' 1898 1908 CivAllCmd=[CivAllCmd ' civ2 ']; 1899 str=CIV2_CMD_Unified(filecell.nc.civ2{ifile,j},'', param.civ2);1909 str=CIV2_CMD_Unified(filecell.nc.civ2{ifile,j},'',Param.Civ2); 1900 1910 fieldnames=fields(str); 1901 1911 [CivAllxml,uid_civ2]=add(CivAllxml,1,'element','civ2'); … … 2089 2099 end 2090 2100 if Param.CheckCiv2==1 2091 Param.Civ2= param.civ2;2101 Param.Civ2=Param.Civ2; 2092 2102 end 2093 2103 if Param.CheckFix2==1 … … 2152 2162 '-l "/core=1+{type = ''smalljob''}/licence=1,walltime=00:60:00" ' batch_file_list{p}]; 2153 2163 display(oar_command);eval(oar_command); 2154 end 2155 2156 2157 case 'oar_perl' 2164 end 2165 case 'oar' %oar-dispatch.pl 2158 2166 filename_joblist=fullfile(Rootbat,'job_list.txt'); 2159 2167 fid=fopen(filename_joblist,'w'); … … 2164 2172 fprintf(fid,[oar_command '\n']); 2165 2173 end 2166 fclose(fid) 2167 oar_command=['oarsub -t container -n civx-container -l /core=24,walltime=00:35:00 "/fsnet/data/legi/calcul9/home/gostiaux/Documents/MATLAB/uvmat_dev/oar-dispatch -f '... 2174 fclose(fid); 2175 walltime=datestr(length(batch_file_list)*10/24/60,13); 2176 oar_command=['oarsub -t container -n civx-container -l /core=24,walltime=' walltime ' "/fsnet/data/legi/calcul9/home/gostiaux/Documents/MATLAB/uvmat_dev/oar-dispatch -f '... 2168 2177 filename_joblist '"']; 2169 2178 filename_oarcommand=fullfile(Rootbat,'oar_command'); … … 2171 2180 fprintf(fid,[oar_command '\n']); 2172 2181 fclose(fid); 2173 % display(oar_command); 2174 eval(['! . ' filename_oarcommand]); 2175 2176 case 'oar'%'oar_mpi' 2182 display(oar_command); 2183 eval(['! . ' filename_oarcommand]) 2184 case 'oar_mpi' 2177 2185 filename_joblist=fullfile(Rootbat,'job_list.txt'); 2178 2186 fid=fopen(filename_joblist,'w'); … … 2190 2198 2191 2199 2192 % for p=0:floor(length(batch_file_list)/6);2193 % filename_batch_group=fullfile(Rootbat,['job_list_' num2str(p) '.bat']);2194 % fid=fopen(filename_batch_group,'w');2195 % if fid==-12196 % msgbox_uvmat('ERROR',['cannot create the command file ' filename_superbat])2197 % return2198 % end2199 % if p==floor(length(batch_file_list)/6)2200 % kmax=mod(length(batch_file_list),6);2201 % else2202 % kmax=6;2203 % end2204 % for k=1:kmax2205 % fprintf(fid,['sh ' batch_file_list{p*6+k} '\n']);2206 % end2207 % fclose(fid);2208 % system(['chmod +x ' filename_batch_group]);2209 % eval( ['!oarsub -n CIVX -q nicejob '...2210 % '-E ' flname '.errors -O ' flname '.log '...2211 % '-l "/core=1+{type = ''smalljob''}/licence=1,walltime=00:60:00" ' filename_batch_group]);2212 % end2213 2200 case 'oar_new' % to be develloped with Patrick Begou 2214 2201 filename_joblist=fullfile(Rootbat,'job_list.txt'); … … 4544 4531 % global civ2Bin sge%name of the executable for checkciv1 calculation 4545 4532 filename=regexprep(filename,'.nc',''); 4546 if isequal( param.civ2.Dt,'0')4547 param.civ2.Dt='1' ;%case of 'displacement' mode4548 end 4549 param.civ2.filename_ima_a=regexprep(param.civ2.filename_ima_a,'.png','');4550 param.civ2.filename_ima_b=regexprep(param.civ2.filename_ima_b,'.png','');% bug : .png appears two times ?4533 if isequal(Param.Civ2.Dt,'0') 4534 Param.Civ2.Dt='1' ;%case of 'displacement' mode 4535 end 4536 Param.Civ2.filename_ima_a=regexprep(Param.Civ2.filename_ima_a,'.png',''); 4537 Param.Civ2.filename_ima_b=regexprep(Param.Civ2.filename_ima_b,'.png','');% bug : .png appears two times ? 4551 4538 [fid,errormsg]=fopen([filename '.civ2.cmx'],'w'); 4552 4539 if isequal(fid,-1) … … 4556 4543 end 4557 4544 fprintf(fid,['############## CMX file' '\n' ]); 4558 fprintf(fid, ['FirstImage ' regexprep( param.civ2.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility4559 fprintf(fid, ['LastImage ' regexprep( param.civ2.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility4545 fprintf(fid, ['FirstImage ' regexprep(Param.Civ2.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility 4546 fprintf(fid, ['LastImage ' regexprep(Param.Civ2.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility 4560 4547 fprintf(fid, ['XX' '\n' ]); 4561 fprintf(fid, ['Mask ' param.civ2.maskflag '\n' ]);4562 fprintf(fid, ['MaskName ' regexprep( param.civ2.maskname,'\\','\\\\') '\n' ]);% for windows compatibility4563 fprintf(fid, ['ImageSize ' param.civ2.npx ' ' param.civ2.npy '\n' ]); %VERIFIER CAS GENERAL ?4564 fprintf(fid, ['CorrelationBoxesSize ' param.civ2.ibx ' ' param.civ2.iby '\n' ]);4565 fprintf(fid, ['SearchBoxeSize ' param.civ2.ibx ' ' param.civ2.iby '\n']);4566 fprintf(fid, ['RO ' param.civ2.rho '\n']);4567 fprintf(fid, ['GridSpacing ' param.civ2.dx ' ' param.civ2.dy '\n']);4548 fprintf(fid, ['Mask ' Param.Civ2.MaskFlag '\n' ]); 4549 fprintf(fid, ['MaskName ' regexprep(Param.Civ2.MaskName,'\\','\\\\') '\n' ]);% for windows compatibility 4550 fprintf(fid, ['ImageSize ' Param.Civ2.npx ' ' Param.Civ2.npy '\n' ]); %VERIFIER CAS GENERAL ? 4551 fprintf(fid, ['CorrelationBoxesSize ' Param.Civ2.ibx ' ' Param.Civ2.iby '\n' ]); 4552 fprintf(fid, ['SearchBoxeSize ' Param.Civ2.ibx ' ' Param.Civ2.iby '\n']); 4553 fprintf(fid, ['RO ' Param.Civ2.rho '\n']); 4554 fprintf(fid, ['GridSpacing ' Param.Civ2.dx ' ' Param.Civ2.dy '\n']); 4568 4555 fprintf(fid, ['XX 1.0' '\n' ]); 4569 fprintf(fid, ['Dt_TO ' param.civ2.Dt ' ' param.civ2.T0 '\n' ]);4570 fprintf(fid, ['PixCmXY ' param.civ2.pxcmx ' ' param.civ2.pxcmy '\n' ]);4556 fprintf(fid, ['Dt_TO ' Param.Civ2.Dt ' ' Param.Civ2.T0 '\n' ]); 4557 fprintf(fid, ['PixCmXY ' Param.Civ2.pxcmx ' ' Param.Civ2.pxcmy '\n' ]); 4571 4558 fprintf(fid, ['XX 1' '\n' ]); 4572 4559 fprintf(fid, 'ShiftXY 0 0\n'); 4573 fprintf(fid, ['Grid ' param.civ2.gridflag '\n' ]);4574 fprintf(fid, ['GridName ' regexprep( param.civ2.gridname,'\\','\\\\') '\n']);4560 fprintf(fid, ['Grid ' Param.Civ2.GridFlag '\n' ]); 4561 fprintf(fid, ['GridName ' regexprep(Param.Civ2.GridName,'\\','\\\\') '\n']); 4575 4562 fprintf(fid, ['XX 85' '\n' ]); 4576 4563 fprintf(fid, ['XX 1.0' '\n' ]); 4577 4564 fprintf(fid, ['XX 1.0' '\n' ]); 4578 4565 fprintf(fid, ['Hart 1' '\n' ]); 4579 fprintf(fid, ['DecimalShift ' param.civ2.decimal '\n']);4580 fprintf(fid, ['Deformation ' param.civ2.deformation '\n']);4566 fprintf(fid, ['DecimalShift ' Param.Civ2.decimal '\n']); 4567 fprintf(fid, ['Deformation ' Param.Civ2.deformation '\n']); 4581 4568 fprintf(fid, ['CorrelationMin 0' '\n' ]); 4582 4569 fprintf(fid, ['IntensityMin 0' '\n' ]); 4583 4570 fprintf(fid, ['SeuilImage n' '\n' ]); 4584 4571 fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); 4585 fprintf(fid, ['ImageToUse ' param.civ2.term_a ' ' param.civ2.term_b '\n' ]); % VERIFIER ?4586 fprintf(fid, ['ImageUsedBefore ' regexprep( param.civ2.filename_nc1,'\\','\\\\') '\n']);4572 fprintf(fid, ['ImageToUse ' Param.Civ2.term_a ' ' Param.Civ2.term_b '\n' ]); % VERIFIER ? 4573 fprintf(fid, ['ImageUsedBefore ' regexprep(Param.Civ2.filename_nc1,'\\','\\\\') '\n']); 4587 4574 fclose(fid); 4588 4575 … … 5336 5323 % namelog=regexprep(namelog,'\\','\\\\'); 5337 5324 % cmd=[cmd '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"']; %preserve the log file as .civ1.log 5338 cmd=[cmd 'del "' filename '.cmx '];5325 cmd=[cmd 'del "' filename '.cmx"']; 5339 5326 end 5340 5327 … … 5387 5374 % ' -max ' thresh_value ' -nopt ' subdomain_patch ' > ' namelog ' 2>&1']; % redirect standard output to the log file 5388 5375 % end 5376 5377 5378 %------------------------------------------------------------------------ 5379 % --- CheckCiv2 CheckCiv2 CheckCiv2 CheckCiv2 5380 function cmd=cmd_civ2(filename,Param) 5381 %------------------------------------------------------------------------ 5382 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 5383 % global civ2Bin sge%name of the executable for checkciv1 calculation 5384 filename=regexprep(filename,'.nc',''); 5385 if isequal(Param.Civ2.Dt,'0') 5386 Param.Civ2.Dt='1' ;%case of 'displacement' mode 5387 end 5388 Param.Civ2.filename_ima_a=regexprep(Param.Civ2.filename_ima_a,'.png',''); 5389 Param.Civ2.filename_ima_b=regexprep(Param.Civ2.filename_ima_b,'.png','');% bug : .png appears two times ? 5390 [fid,errormsg]=fopen([filename '.civ2.cmx'],'w'); 5391 if isequal(fid,-1) 5392 msgbox_uvmat('ERROR',errormsg) 5393 cmd=''; 5394 return 5395 end 5396 fprintf(fid,['############## CMX file' '\n' ]); 5397 fprintf(fid, ['FirstImage ' regexprep(Param.Civ2.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility 5398 fprintf(fid, ['LastImage ' regexprep(Param.Civ2.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility 5399 fprintf(fid, ['XX' '\n' ]); 5400 fprintf(fid, ['Mask ' Param.Civ2.MaskFlag '\n' ]); 5401 fprintf(fid, ['MaskName ' regexprep(Param.Civ2.MaskName,'\\','\\\\') '\n' ]);% for windows compatibility 5402 fprintf(fid, ['ImageSize ' num2str(Param.Civ2.npx) ' ' num2str(Param.Civ2.npy) '\n' ]); %VERIFIER CAS GENERAL ? 5403 fprintf(fid, ['CorrelationBoxesSize ' num2str(Param.Civ2.Bx) ' ' num2str(Param.Civ2.By) '\n' ]); 5404 fprintf(fid, ['SearchBoxeSize ' num2str(Param.Civ2.Bx) ' ' num2str(Param.Civ2.By) '\n']); 5405 fprintf(fid, ['RO ' num2str(Param.Civ2.Rho) '\n']); 5406 fprintf(fid, ['GridSpacing ' num2str(Param.Civ2.Dx) ' ' num2str(Param.Civ2.Dy) '\n']); 5407 fprintf(fid, ['XX 1.0' '\n' ]); 5408 fprintf(fid, ['Dt_TO ' num2str(Param.Civ2.Dt) ' ' num2str(Param.Civ2.T0) '\n' ]); 5409 fprintf(fid, ['PixCmXY ' num2str(Param.Civ2.pxcmx) ' ' num2str(Param.Civ2.pxcmy) '\n' ]); 5410 fprintf(fid, ['XX 1' '\n' ]); 5411 fprintf(fid, 'ShiftXY 0 0\n'); 5412 fprintf(fid, ['Grid ' Param.Civ2.GridFlag '\n' ]); 5413 fprintf(fid, ['GridName ' regexprep(Param.Civ2.GridName,'\\','\\\\') '\n']); 5414 fprintf(fid, ['XX 85' '\n' ]); 5415 fprintf(fid, ['XX 1.0' '\n' ]); 5416 fprintf(fid, ['XX 1.0' '\n' ]); 5417 fprintf(fid, ['Hart 1' '\n' ]); 5418 fprintf(fid, ['DecimalShift ' num2str(Param.Civ2.CheckDecimal) '\n']); 5419 fprintf(fid, ['Deformation ' num2str(Param.Civ2.CheckDeformation) '\n']); 5420 fprintf(fid, ['CorrelationMin 0' '\n' ]); 5421 fprintf(fid, ['IntensityMin 0' '\n' ]); 5422 fprintf(fid, ['SeuilImage n' '\n' ]); 5423 fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); 5424 fprintf(fid, ['ImageToUse ' Param.Civ2.term_a ' ' Param.Civ2.term_b '\n' ]); % VERIFIER ? 5425 fprintf(fid, ['ImageUsedBefore ' regexprep(Param.Civ2.filename_nc1,'\\','\\\\') '\n']); 5426 fclose(fid); 5427 5428 if(isunix) 5429 cmd=['cp -f ' filename '.civ2.cmx ' filename '.cmx\n'... 5430 Param.xml.Civ2Bin ' -f ' filename '.cmx >' filename '.civ2.log \n '... % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx 5431 'rm ' filename '.cmx \n'];%rename .cmx as .checkciv2.cmx, the result file is named [filename '.nc'] by CIVx 5432 else 5433 filename=regexprep(filename,'\\','\\\\'); 5434 cmd=['copy /Y "' filename '.civ2.cmx" "' filename '.cmx" \n'... 5435 '"' regexprep(Param.xml.Civ2Bin,'\\','\\\\') '" -f "' filename '.cmx" >"' filename '.civ2.log" \n'... 5436 'del "' filename '.cmx" \n']; 5437 end 5438
Note: See TracChangeset
for help on using the changeset viewer.