Changeset 595
- Timestamp:
- Mar 29, 2013, 9:03:29 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 3 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r591 r595 4125 4125 case {'civ_matlab','civ_matlab.sh'} 4126 4126 filename=regexprep(Param.OutputFile,'(.+)([/\\])(.+$)','$1$20_XML$2$3.xml'); 4127 fileattrib(fileparts(filename),'+w +x','o g');% set writting access 4127 4128 save(struct2xml(Param),filename); 4128 4129 end -
trunk/src/editxml.m
r508 r595 340 340 schemafile=[fullfile(path_uvmat,'xml_shemas',head_name) '.xsd']; 341 341 if ~exist(schemafile,'file') 342 schemafile=fullfile(path_ UVMAT,schemafile);%look for relative path definition342 schemafile=fullfile(path_uvmat,schemafile);%look for relative path definition 343 343 end 344 344 if exist(schemafile,'file') 345 345 xs=xmltree(schemafile); 346 346 else 347 msgbox_uvmat(' ERROR',['The needed xml schema ' sparam.SchemaPath ' is not found, check the file PARAM.xml'])347 msgbox_uvmat('WARNING','The xml schema is not found, check the file PARAM.xml') 348 348 [FileName, PathName]=uigetfile( ... 349 349 {'*.xsd', '(*.xsd)'; … … 1295 1295 return 1296 1296 %%%%%%%%%%% A REVOIR 1297 % Copier la liste des elements selectionn és dans dataview1297 % Copier la liste des elements selectionnï¿œs dans dataview 1298 1298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1299 1299 %ANCIEN: -
trunk/src/get_file_type.m
r549 r595 17 17 % fileinput: name, including path, of the file to analyse 18 18 function [FileType,FileInfo,VideoObject]=get_file_type(fileinput) 19 FileType=' ';19 FileType='txt';%default, text file 20 20 FileInfo=[]; 21 21 VideoObject=[]; … … 23 23 24 24 switch FileExt 25 case {'.civ','.log','.cmx','.cmx2','.txt','.bat','.m','.sh'}26 FileType='txt';27 25 case '.fig' 28 26 FileType='figure'; -
trunk/src/nomtype2pair.m
r107 r595 1 %'nomtype2pair': creates nomencalture for index pairs knowing the image nomenclature 1 %'nomtype2pair': creates nomencalture for index pairs knowing the image nomenclature, used by series fct 2 2 %--------------------------------------------------------------------- 3 % [nom_type_pair]=nomtype2pair(nom_type,Dti,Dtj);3 % NomTypeOut=nomtype2pair(NomTypeIn) 4 4 %--------------------------------------------------------------------- 5 6 5 % OUTPUT: 7 %nom_type_nc 8 6 % NomTypeOut: file index nomenclature for pairs 9 7 %--------------------------------------------------------------------- 10 8 % INPUT: 11 % 'nom_type': string defining the kind of nomenclature used: 12 %nom_type='': constant name [filebase ext] (default output if 'nom_type' is undefined) 13 %nom_type='*': the same file [filebase ext] contains successive fields (ex avi movies) 14 %nom_type='_i': series of files with a single index i preceded by '_'(e.g. 'aa_45.png'). 15 %nom_type='#' series of indexed images wich is not series_i [filebase index ext], e.g. 'aa045.jpg' or 'aa45.tif' 16 %nom_type='_i_j' matrix of files with two indices i and j separated by '_'(e.g. 'aa_45_2.png') 17 %nom_type='_i1-i2' from pairs from a single index (e.g. 'aa_45-47.nc') 18 %nom_type='_i_j1-j2'pairs of j indices (e.g. 'aa_45_2-3.nc') 19 %nom_type='_i1-i2_j' pairs of i indices (e.g. 'aa_45-46_2.nc') 20 %nom_type='#a','#A', with a numerical index and an index letter(e.g.'aa045b.png'), OBSOLETE (replaced by 'series_i_j') 21 %nom_type='%03d' or '%04d', series of indexed images with numbers completed with zeros to 3 or 4 digits, e.g.'aa045.tif' 22 %nom_type='_%03d', '_%04d', or '_%05d', series of indexed images with _ and numbers completed with zeros to 3, 4 or 5 digits, e.g.'aa_045.tif' 23 %nom_type='raw_SMD', same as '#a' but with no extension ext='', OBSOLETE 24 %nom_type='#_ab' from pairs of '#a' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D') 25 %nom_type='%3dab' from pairs of '%3da' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D') 26 % Dti: ~=0 if i index pairs are used 27 % Dtj: ~=0 if i index pairs are used 9 % NomTypeIn: file index nomenclature for images 10 % 11 % for definitions of file index nomenclature, see fct fullfile_uvmat 28 12 29 function [nom_type_pair]=nomtype2pair(nom_type,Dti,Dtj)13 function NomTypeOut=nomtype2pair(NomTypeIn) 30 14 31 %determine nom_type_nc: 32 nom_type_pair=[];%default 33 if ischar(nom_type) 34 switch nom_type 35 case {'_i_j'} 36 if Dtj>0 || Dtj<0 37 nom_type_pair='_i_j1-j2'; 38 if Dti>0 || Dti<0 39 nom_type_pair='_i1-i2_j1-j2'; 40 end 41 elseif Dti>0 || Dti<0 42 nom_type_pair='_i1-i21_j'; 43 else 44 nom_type_pair='_i_j'; 45 end 46 case {'_i1-i2_j'} 47 if Dtj>0 || Dtj<0 48 nom_type_pair='_i1-i2_j1-j2'; 49 else 50 nom_type_pair='_i1-i2_j'; 51 end 52 case {'i_j1-j2'} 53 if Dti>0 || Dti<0 54 nom_type_pair='_i1-i2_j1-j2'; 55 else 56 nom_type_pair='_i1-i2_j'; 57 end 58 case {'i1-i2_j1-j2'} 59 nom_type_pair='_i1-i2_j1-j2'; 60 case '#a' 61 if Dtj>0 || Dtj<0 62 nom_type_pair='#_ab'; 63 end 64 otherwise 65 if Dti>0 || Dti<0 66 nom_type_pair='_i1-i2'; 67 end 15 if ~isempty(regexp(NomTypeIn,'a$')) 16 NomTypeOut=[NomTypeIn 'b']; 17 elseif ~isempty(regexp(NomTypeIn,'A$')) 18 NomTypeOut=[NomTypeIn 'B']; 19 else 20 r=regexp(NomTypeIn,'(?<num1>\d+)_(?<num2>\d+)$','names'); 21 % case of a single input index (no j) 22 if isempty(r) 23 NomTypeOut='_1-2'; 24 else % case of two indices i,j, separated by '_' 25 NomTypeOut='_1-2_1-2'; 68 26 end 69 27 end -
trunk/src/proj_field.m
r589 r595 828 828 % coord_x_proj=XMin:DX:XMax; 829 829 % coord_y_proj=YMin:DY:YMax; 830 DataOut=calc_field (FieldData.FieldList,FieldData,cat(3,xreg,yreg));830 DataOut=calc_field_tps(FieldData.FieldList,FieldData,cat(3,xreg,yreg)); 831 831 ProjData.ListVarName=[ProjData.ListVarName DataOut.ListVarName]; 832 832 ProjData.VarDimName=[ProjData.VarDimName DataOut.VarDimName]; … … 1494 1494 eval(['ProjData.' VarName '=reshape(vec_B,npY,npX,nbcolor);']); 1495 1495 end 1496 ProjData.FF=reshape(~flagin,npY,npX);%false flag A FAIRE: tenir compte d'un flga ant érieur1496 ProjData.FF=reshape(~flagin,npY,npX);%false flag A FAIRE: tenir compte d'un flga antï¿œrieur 1497 1497 ProjData.ListVarName=[ProjData.ListVarName 'FF']; 1498 1498 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; … … 2108 2108 eval(['ProjData.' VarName '=reshape(vec_B,npY,npX,nbcolor);']); 2109 2109 end 2110 ProjData.FF=reshape(~flagin,npY,npX);%false flag A FAIRE: tenir compte d'un flga ant érieur2110 ProjData.FF=reshape(~flagin,npY,npX);%false flag A FAIRE: tenir compte d'un flga antï¿œrieur 2111 2111 ProjData.ListVarName=[ProjData.ListVarName 'FF']; 2112 2112 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; -
trunk/src/read_field.m
r580 r595 87 87 Role{numel(ListVar)}='ancillary';% scalar used for color vector (not projected) 88 88 end 89 [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.Coord_x (ParamIn.Coord_y) 'ListVar]);89 [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.Coord_x (ParamIn.Coord_y) ListVar]); 90 90 if isfield(Field,'Txt') 91 91 errormsg=Field.Txt; -
trunk/src/series.m
r594 r595 899 899 end 900 900 FileName=fullfile_uvmat(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},i1_series(1,ref_j+1,ref_i+1),i2,j1,j2); 901 hget_field=get_field(FileName);902 hhget_field=guidata(hget_field);903 get_field('RUN_Callback',hhget_field.RUN,[],hhget_field);901 % hget_field=get_field(FileName); 902 % hhget_field=guidata(hget_field); 903 % get_field('RUN_Callback',hhget_field.RUN,[],hhget_field); 904 904 otherwise 905 905 set(handles.FieldName,'Value',1) % set menu to 'image' … … 1303 1303 function RUN_Callback(hObject, eventdata, handles) 1304 1304 %------------------------------------------------------------------------ 1305 1305 1306 set(handles.RUN,'BusyAction','queue'); 1306 1307 set(0,'CurrentFigure',handles.series) … … 1308 1309 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 1309 1310 drawnow 1310 [Series,filexml,errormsg]=prepare_jobs(handles); 1311 1312 %% read the input parameters and set the output dir and nomenclature 1313 [Series,OutputDir,errormsg]=prepare_jobs(handles);% get parameters form the GUI series 1311 1314 if ~isempty(errormsg) 1312 1315 msgbox_uvmat('ERROR',errormsg) 1313 1316 return 1314 1317 end 1318 OutputNomType=nomtype2pair(Series.InputTable{1,4});% nomenclature for output files 1319 DirXml=fullfile(OutputDir,'0_XML'); 1320 if ~exist(DirXml,'dir') 1321 [tild,msg1]=mkdir(DirXml); 1322 if ~strcmp(msg1,'') 1323 msgbox_uvmat('ERROR',['cannot create ' DirXml ': ' msg1]);%error message for directory creation 1324 return 1325 end 1326 end 1327 1328 %% select the Action modes 1315 1329 RunModeList=get(handles.RunMode,'String'); 1316 1330 RunMode=RunModeList{get(handles.RunMode,'Value')}; 1317 ActionExtList=get(handles.ActionExt,'String'); 1318 ActionExt=ActionExtList{get(handles.ActionExt,'Value')};% '.m' or '.sh' (compiled) 1319 ActionPath=get(handles.ActionPath,'String'); 1320 ActionList=get(handles.ActionName,'String'); 1321 ActionName=ActionList{get(handles.ActionName,'Value')}; 1331 ActionExt='.m';%default 1332 if isfield(Series.Action,'ActionExt') 1333 ActionExt=Series.Action.ActionExt;% '.m' or '.sh' (compiled) 1334 end 1335 ActionName=Series.Action.ActionName; 1336 ActionPath=Series.Action.ActionPath; 1322 1337 path_series=fileparts(which('series')); 1323 1338 1324 % create the Action fct handle if RunMode option = 'local'1339 %% create the Action fct handle if RunMode option = 'local' 1325 1340 if strcmp(RunMode,'local') 1326 1341 if ~isequal(ActionPath,path_series) … … 1373 1388 Series.RunTime=RunTime; 1374 1389 end 1375 1376 %% set nbre of processes 1377 if ~isfield(Series,'NbSlice') 1378 Series.NbSlice=[]; 1379 end 1380 if isempty(Series.NbSlice) 1381 switch RunMode 1382 case {'local','background'} 1383 NbCore=1;% no need to split the calculation 1384 case 'cluster' 1385 if strcmp(Series.Action.ActionExt,'.m')% case of Matlab function (uncompiled) 1386 NbCore=1;% one core used only (limitation of Matlab licences) 1387 msgbox_uvmat('WARNING','Number of cores =1: select the compiled version civ_matlab.sh for multi-core processing'); 1388 else 1390 1391 %% set nbre of cluster cores and processes 1392 switch RunMode 1393 case {'local','background'} 1394 NbCore=1;% no need to split the calculation 1395 case 'cluster_oar' 1396 if strcmp(Series.Action.ActionExt,'.m')% case of Matlab function (uncompiled) 1397 NbCore=1;% one core used only (limitation of Matlab licences) 1398 msgbox_uvmat('WARNING','Number of cores =1: select the compiled version civ_matlab.sh for multi-core processing'); 1399 extra_oar=''; 1400 else 1389 1401 answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''}); 1390 1402 NbCore=str2double(answer{1}); 1391 end 1392 end 1403 extra_oar=answer{2}; 1404 end 1405 end 1406 if ~isfield(Series.IndexRange,'NbSlice') 1407 Series.IndexRange.NbSlice=[]; 1408 end 1409 if isempty(Series.IndexRange.NbSlice) 1393 1410 NbProcess=NbCore;% choose one process per core 1394 1411 else 1395 NbProcess=Series.NbSlice;% the nbre of run processes is equal to the number of slices 1412 NbProcess=Series.IndexRange.NbSlice;% the nbre of run processes is equal to the number of slices 1413 NbCore=min(NbCore,NbProcess);% at least one process per core 1396 1414 end 1397 1415 … … 1402 1420 first_j=1; 1403 1421 last_j=1; 1404 incr_j=1;1405 1422 if isfield(Series.IndexRange,'first_i') 1406 1423 first_i=Series.IndexRange.first_i; … … 1413 1430 end 1414 1431 if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... 1415 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return1432 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return 1416 1433 else 1417 1434 BlockLength=ceil(numel(first_i:incr_i:last_i)/NbProcess); 1418 1435 end 1419 1436 1420 %% main processing 1421 for iprocess=1:NbProcess% TOD0 1422 % split the input files 1423 % adjust Param 1424 % create xmlfile and batfile 1425 end 1437 %% direct processing on the current Matlab session 1438 if strcmp (RunMode,'local') 1439 Series.RUNHandle=handles.RUN; 1440 Series.WaitbarHandle=handles.Waitbar; 1441 for iprocess=1:NbProcess 1442 if isempty(Series.IndexRange.NbSlice) 1443 Series.IndexRange.first_i=first_i+(iprocess-1)*BlockLength; 1444 Series.IndexRange.last_i=first_i+(iprocess)*BlockLength-1; 1445 else 1446 Series.IndexRange.first_i= first_i+iprocess-1; 1447 Series.IndexRange.incr_i=incr_i*Series.IndexRange.NbSlice; 1448 end 1449 t=struct2xml(Series); 1450 t=set(t,1,'name','Series'); 1451 filexml=fullfile_uvmat(DirXml,'',Series.InputTable{1,3},'.xml',OutputNomType,... 1452 Series.IndexRange.first_i,Series.IndexRange.last_i,first_j,last_j); 1453 save(t,filexml); 1454 switch ActionExt 1455 case '.m' 1456 h_fun(Series); 1457 case '.sh' 1458 switch computer 1459 case {'PCWIN','PCWIN64'} %Windows system 1460 filexml=regexprep(filexml,'\\','\\\\');% add '\' so that '\' are left as characters 1461 system([fullfile(ActionPath,[ActionName '.sh']) ' ' Series.RunTime ' ' filexml]);% TODO: adapt to DOS system 1462 case {'GLNX86','GLNXA64','MACI64'}%Linux system 1463 system([fullfile(ActionPath,[ActionName '.sh']) ' ' Series.RunTime ' ' filexml]); 1464 end 1465 end 1466 end 1467 elseif strcmp(get(handles.OutputDirExt,'Visible'),'off') 1468 msgbox_uvmat('ERROR',['no output file for Action ' ActionName ', use run mode = local']);% a output dir is needed for background option 1469 return 1470 else 1471 %% processing on a different session of the same computer (background) or cluster, create executable files 1472 batch_file_list=cell(NbProcess,1);% initiate the list of executable files 1473 DirBat=fullfile(OutputDir,'0_BAT'); 1474 %create subdirectory for executable files 1475 if ~exist(DirBat,'dir') 1476 [tild,msg1]=mkdir(DirBat); 1477 if ~strcmp(msg1,'') 1478 msgbox_uvmat('ERROR',['cannot create ' DirBat ': ' msg1]);%error message for directory creation 1479 return 1480 end 1481 end 1482 %create subdirectory for log files 1483 DirLog=fullfile(OutputDir,'0_LOG'); 1484 if ~exist(DirLog,'dir') 1485 [tild,msg1]=mkdir(DirLog); 1486 if ~strcmp(msg1,'') 1487 msgbox_uvmat('ERROR',['cannot create ' DirLog ': ' msg1]);%error message for directory creation 1488 return 1489 end 1490 end 1491 for iprocess=1:NbProcess 1492 if isempty(Series.IndexRange.NbSlice)% process by blocks of i index 1493 Series.IndexRange.first_i=first_i+(iprocess-1)*BlockLength; 1494 Series.IndexRange.last_i=first_i+(iprocess)*BlockLength-1; 1495 else% process by slices of i index if NbSlice is defined, computation in a single process if NbSlice =1 1496 Series.IndexRange.first_i= first_i+iprocess-1; 1497 Series.IndexRange.incr_i=incr_i*Series.IndexRange.NbSlice; 1498 end 1499 1500 % create, fill and save the xml parameter file 1501 t=struct2xml(Series); 1502 t=set(t,1,'name','Series'); 1503 filexml=fullfile_uvmat(DirXml,'',Series.InputTable{1,3},'.xml',OutputNomType,... 1504 Series.IndexRange.first_i,Series.IndexRange.last_i,first_j,last_j); 1505 save(t,filexml);% save the parameter file 1506 1507 %create the executable file 1508 filebat=fullfile_uvmat(DirBat,'',Series.InputTable{1,3},'.bat',OutputNomType,... 1509 Series.IndexRange.first_i,Series.IndexRange.last_i,first_j,last_j); 1510 batch_file_list{iprocess}=filebat; 1511 [fid,message]=fopen(filebat,'w');% create the executable file 1512 if isequal(fid,-1) 1513 msgbox_uvmat('ERROR', ['creation of .bat file: ' message]); 1514 return 1515 end 1516 1517 % set the log file name 1518 filelog=fullfile_uvmat(DirLog,'',Series.InputTable{1,3},'.log',OutputNomType,... 1519 Series.IndexRange.first_i,Series.IndexRange.last_i,first_j,last_j); 1520 1521 % fill and save the executable file 1522 switch ActionExt 1523 case '.m'% Matlab function 1524 switch computer 1525 case {'GLNX86','GLNXA64','MACI64'} 1526 cmd=[... 1527 '#!/bin/bash \n'... 1528 '. /etc/sysprofile \n'... 1529 'matlab -nodisplay -nosplash -nojvm -logfile ''' filelog ''' <<END_MATLAB \n'... 1530 'addpath(''' path_series '''); \n'... 1531 'addpath(''' Series.Action.ActionPath '''); \n'... 1532 '' Series.Action.ActionName '( ''' filexml '''); \n'... 1533 'exit \n'... 1534 'END_MATLAB \n']; 1535 fprintf(fid,cmd);%fill the executable file with the char string cmd 1536 fclose(fid);% close the executable file 1537 system(['chmod +x ' filebat]);% set the file to executable 1538 case {'PCWIN','PCWIN64'} 1539 text_matlabscript=['matlab -automation -logfile ' regexprep(filelog,'\\','\\\\')... 1540 ' -r "addpath(''' regexprep(path_series,'\\','\\\\') ''');'... 1541 'addpath(''' regexprep(Series.Action.ActionPath,'\\','\\\\') ''');'... 1542 '' Series.Action.ActionName '( ''' regexprep(filexml,'\\','\\\\') ''');exit"']; 1543 fprintf(fid,text_matlabscript);%fill the executable file with the char string cmd 1544 fclose(fid);% close the executable file 1545 end 1546 case '.sh' % compiled Matlab function 1547 switch computer 1548 case {'GLNX86','GLNXA64','MACI64'} 1549 cmd=['#!/bin/bash \n '... 1550 '#$ -cwd \n '... 1551 'hostname && date \n '... 1552 'umask 002 \n'... 1553 fullfile(ActionPath,[ActionName '.sh']) ' ' Series.RunTime ' ' filexml];%allow writting access to created files for user group 1554 fprintf(fid,cmd);%fill the executable file with the char string cmd 1555 fclose(fid);% close the executable file 1556 system(['chmod +x ' filebat]);% set the file to executable 1557 1558 case {'PCWIN','PCWIN64'} % TODO: adapt to Windows system 1559 % cmd=['matlab -automation -logfile ' regexprep(filelog,'\\','\\\\')... 1560 % ' -r "addpath(''' regexprep(path_series,'\\','\\\\') ''');'... 1561 % 'addpath(''' regexprep(Series.Action.ActionPath,'\\','\\\\') ''');'... 1562 % '' Series.Action.ActionName '( ''' regexprep(filexml,'\\','\\\\') ''');exit"']; 1563 fprintf(fid,cmd); 1564 fclose(fid); 1565 % dos([filebat ' &']); 1566 end 1567 end 1568 end 1569 end 1570 1571 %% launch the executable files for background or cluster processing 1426 1572 switch RunMode 1427 case 'local' 1428 Series.RUNHandle=handles.RUN; 1429 Series.WaitbarHandle=handles.Waitbar; 1573 case 'background' 1430 1574 for iprocess=1:NbProcess 1431 if isempty(Series.NbSlice) 1432 Series.IndexRange.first_i=first_i+(iprocess-1)*BlockLength; 1433 Series.IndexRange.last_i=first_i+(iprocess)*BlockLength-1; 1434 else 1435 Series.IndexRange.first_i= first_i+iprocess-1; 1436 Series.IndexRange.incr_i=incr_i*Series.NbSlice; 1437 end 1438 if ~isempty(filexml) 1439 t=struct2xml(Series); 1440 t=set(t,1,'name','Series'); 1441 if isequal(Series.IndexRange.last_i,Series.IndexRange.first_i) 1442 term_i=num2str(Series.IndexRange.first_i); 1443 else 1444 term_i=[num2str(Series.IndexRange.first_i) '-' num2str(Series.IndexRange.last_i)]; 1445 end 1446 if isequal(Series.IndexRange.last_j,Series.IndexRange.first_j) 1447 term_j=num2str(Series.IndexRange.first_j); 1448 else 1449 term_j=[num2str(Series.IndexRange.first_j) '-' num2str(Series.IndexRange.last_j)]; 1450 end 1451 save(t,[filexml '_' term_i '_' term_j '.xml']); 1452 end 1453 switch ActionExt 1454 case '.m' 1455 h_fun(Series); 1456 case '.sh' 1457 switch computer 1458 case {'PCWIN','PCWIN64'} %Windows system 1459 filename=regexprep(filename,'\\','\\\\');% add '\' so that '\' are left as characters 1460 % TODO launch command in DOS 1461 case {'GLNX86','GLNXA64','MACI64'}%Linux system 1462 % cmd=['#!/bin/bash \n '... 1463 % '#$ -cwd \n '... 1464 % 'hostname && date \n '... 1465 % 'umask 002 \n'... 1466 % fullfile(ActionPath,[ActionName '.sh']) ' ' Series.RunTime ' ' filexml '_' term_i '_' term_j '.xml'];%allow writting access to created files for user group 1467 system([fullfile(ActionPath,[ActionName '.sh']) ' ' Series.RunTime ' ' filexml '_' term_i '_' term_j '.xml']); 1468 end 1469 end 1470 end 1471 case 'background' 1472 if isempty(filexml) 1473 Series=h_fun(Series);% no background in the absence of output file 1474 else 1475 % update the xml file after interactive input with the function 1476 % Series.Specific='?'; 1477 % Series=h_fun(Series); 1478 t=struct2xml(Series); 1479 t=set(t,1,'name','Series'); 1480 save(t,filexml); 1481 1482 filename_bat=regexprep(filexml,'.xml$','.bat');% create executable file to run program in background 1483 [fid,message]=fopen(filename_bat,'w'); 1484 if isequal(fid,-1) 1485 msgbox_uvmat('ERROR', ['creation of .bat file: ' message]); 1575 system(batch_file_list{iprocess})% directly execute the command file for each process 1576 end 1577 case 'cluster_oar' % option 'oar-parexec' used 1578 %create subdirectory for oar command and log files 1579 DirOAR=fullfile(OutputDir,'0_OAR'); 1580 if ~exist(DirOAR,'dir') 1581 [tild,msg1]=mkdir(DirOAR); 1582 if ~strcmp(msg1,'') 1583 msgbox_uvmat('ERROR',['cannot create ' DirOAR ': ' msg1]);%error message for directory creation 1486 1584 return 1487 1585 end 1488 %ActionPath=get(handles.ActionPath,'String'); 1489 filelog=regexprep(filexml,'.xml$','.log'); 1490 1491 switch computer 1492 case {'GLNX86','GLNXA64','MACI64'} 1493 text_matlabscript=[... 1494 '#!/bin/bash \n'... 1495 '. /etc/sysprofile \n'... 1496 'matlab -nodisplay -nosplash -nojvm -logfile ''' filelog ''' <<END_MATLAB \n'... 1497 'addpath(''' path_series '''); \n'... 1498 'addpath(''' Series.Action.ActionPath '''); \n'... 1499 '' Series.Action.ActionName '( ''' filexml '''); \n'... 1500 'exit \n'... 1501 'END_MATLAB \n']; 1502 fprintf(fid,text_matlabscript); 1503 fclose(fid); 1504 system(['chmod +x ' filename_bat]);% set the file to executable 1505 system(['. ' filename_bat ' &']);%execute fct 1506 1507 case {'PCWIN','PCWIN64'} 1508 text_matlabscript=['matlab -automation -logfile ' regexprep(filelog,'\\','\\\\')... 1509 ' -r "addpath(''' regexprep(path_series,'\\','\\\\') ''');'... 1510 'addpath(''' regexprep(Series.Action.ActionPath,'\\','\\\\') ''');'... 1511 '' Series.Action.ActionName '( ''' regexprep(filexml,'\\','\\\\') ''');exit"']; 1512 fprintf(fid,text_matlabscript); 1513 fclose(fid); 1514 dos([filename_bat ' &']); 1515 end 1516 end 1517 update_waitbar(handles.Waitbar,1); % put the waitbar to end position to indicate launching is finished 1518 case 'cluster' %NOT YET READY 1519 switch batch_mode 1520 case 'sge' %at the moment only psmn ENS Lyon uses it 1521 for p=1:length(batch_file_list) 1522 cmd=['!qsub -q piv1,piv2,piv3 '... 1523 '-e ' regexprep(batch_file_list{p},'.bat','.errors') ' -o ' regexprep(batch_file_list{p},'.bat','.log ')... 1524 ' -v ' 'LD_LIBRARY_PATH=/home/sjoubaud/matlab_sylvain/civx/lib ' batch_file_list{p}]; 1525 display(cmd);eval(cmd); 1526 end 1527 case 'oar' 1528 max_walltime=3600*12; % 12h max 1529 oar_modes={'oar-parexec','oar-dispatch','mpilauncher'}; 1530 text={'Batch processing on servcalcul3 LEGI';... 1531 'Please choose one of the followint modes';... 1532 '* oar-parexec : default and best choice';... 1533 '* oar-dispatch : jobs in a container of several cores';... 1534 '* mpilauncher : one single parallel mpi job using several cores';... 1535 '**********************************'... 1536 }; 1537 [S,v]=listdlg('PromptString',text,'ListString',oar_modes,... 1538 'SelectionMode','single','ListSize',[400 100],'Name','LEGI job mode'); 1539 switch oar_modes{S} 1540 case 'oar-parexec' %oar-dispatch.pl 1541 % if strcmp(Series.Action.ActionExt,'.m')% case of Matlab function (uncompiled) 1542 % ncores=1;% one core used only (limitation of Matlab licences) 1543 % msgbox_uvmat('WARNING','Number of cores =1: select the compiled version civ_matlab.sh for multi-core processing'); 1544 % else 1545 % answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''}); 1546 % ncores=str2double(answer{1}); 1547 % end 1548 1549 extra_oar=answer{2}; 1550 walltime_onejob=600;%seconds 1551 filename_joblist=fullfile(RootBat,'job_list.txt'); 1552 fid=fopen(filename_joblist,'w'); 1553 for p=1:length(batch_file_list) 1554 fprintf(fid,[batch_file_list{p} '\n']);% list of exe files (TODO: create them) 1555 end 1556 fclose(fid); 1557 oar_command=['oarsub -n CIVX '... 1558 '-t idempotent --checkpoint ' num2str(walltime_onejob+60) ' '... 1559 '-l /core=' num2str(ncores) ','... 1560 'walltime=' datestr(min(1.05*walltime_onejob/86400*max(length(batch_file_list),ncores)/ncores,max_walltime/86400),13) ' '... 1561 '-E ' regexprep(filename_joblist,'\.txt\>','.stderr') ' '... 1562 '-O ' regexprep(filename_joblist,'\.txt\>','.stdout') ' '... 1563 extra_oar ' '... 1564 '"oar-parexec -s -f ' filename_joblist ' '... 1565 '-l ' filename_joblist '.log"\n']; 1566 filename_oarcommand=fullfile(RootBat,'oar_command'); 1567 fid=fopen(filename_oarcommand,'w'); 1568 fprintf(fid,oar_command); 1569 fclose(fid); 1570 fprintf(oar_command);% display in command line 1571 system(oar_command); 1572 case 'oar-dispatch' %oar-dispatch.pl 1573 ncores=str2double(... 1574 inputdlg('Number of cores (max 36)','oarsub parameter',1,{'6'})... 1575 ); 1576 walltime_onejob=600;%seconds 1577 filename_joblist=fullfile(RootBat,'job_list.txt'); 1578 fid=fopen(filename_joblist,'w'); 1579 for p=1:length(batch_file_list) 1580 oar_command=['oarsub -n CIVX '... 1581 '-E ' regexprep(batch_file_list{p},'\.bat\>','.stderr') ' -O ' regexprep(batch_file_list{p},'\.bat\>','.stdout ')... 1582 '-l "/core=1,walltime=' datestr(walltime_onejob/86400,13) '" ' batch_file_list{p}]; 1583 fprintf(fid,[oar_command '\n']); 1584 end 1585 fclose(fid); 1586 oar_command=['oarsub -t container -n civx-container '... 1587 '-l /core=' num2str(ncores)... 1588 ',walltime=' datestr(1.05*walltime_onejob/86400*max(length(batch_file_list),ncores)/ncores,13) ' '... 1589 '-E ' regexprep(filename_joblist,'\.txt\>','.stderr') ' '... 1590 '-O ' regexprep(filename_joblist,'\.txt\>','.stdout') ' '... 1591 '"oar-dispatch -f ' filename_joblist '"']; 1592 filename_oarcommand=fullfile(RootBat,'oar_command'); 1593 fid=fopen(filename_oarcommand,'w'); 1594 fprintf(fid,[oar_command '\n']); 1595 fclose(fid); 1596 display(oar_command); 1597 eval(['! . ' filename_oarcommand]) 1598 case 'mpilauncher' 1599 filename_joblist=fullfile(RootBat,'job_list.txt'); 1600 fid=fopen(filename_joblist,'w'); 1601 1602 for p=1:length(batch_file_list) 1603 fprintf(fid,[batch_file_list{p} '\n']); 1604 end 1605 fclose(fid) 1606 text_oarscript=[... 1607 '#!/bin/bash \n'... 1608 '#OAR -n Mylauncher \n'... 1609 '#OAR -l node=4/core=5,walltime=0:15:00 \n'... 1610 '#OAR -E ' fullfile(RootBat,'stderrfile.log') ' \n'... 1611 '#OAR -O ' fullfile(RootBat,'stdoutfile.log') ' \n'... 1612 '# ========================================================= \n'... 1613 '# This simple program launch a multinode parallel OpenMPI mpilauncher \n'... 1614 '# application for coriolis PIV post-processing. \n'... 1615 '# OAR uses oarshmost wrapper to propagate the user environement. \n'... 1616 '# This wrapper assert that the user has the same environment on all the \n'... 1617 '# allocated nodes (basic behavior needed by most MPI applications). \n'... 1618 '# \n'... 1619 '# REQUIREMENT: \n'... 1620 '# the oarshmost wrapper should be installed in $HOME/bin directory. \n'... 1621 '# If a different location is used, change the line following the comment "Bidouille" \n'... 1622 '# ========================================================= \n'... 1623 '# USER should only modify these 2 lines \n'... 1624 'WORKDIR=' pwd ' \n'... 1625 'COMMANDE="mpilauncher -f ' filename_joblist '" \n'... 1626 '# ========================================================= \n'... 1627 '# DO NOT MODIFY the FOLOWING LINES. (or be carefull) \n'... 1628 'echo "job starting on: "`hostname` \n'... 1629 'MPINODES="-host `tr [\\\\\\n] [,] <$OAR_NODEFILE |sed -e "s/,$/ /"`" \n'... 1630 'NCPUS=`cat $OAR_NODEFILE |wc -l` \n'... 1631 '#========== Bidouille ============== \n'... 1632 'export OMPI_MCA_plm_rsh_agent=oar-envsh \n'...% 'cd $WORKDIR \n'... 1633 'CMD="mpirun -np $NCPUS -wdir $WORKDIR $MPINODES $COMMANDE" \n'... 1634 'echo "I run: $CMD" \n'... 1635 '$CMD \n'... 1636 'echo "job ending" \n'... 1637 ]; 1638 filename_oarscript=fullfile(RootBat,'oar_command'); 1639 fid=fopen(filename_oarscript,'w'); 1640 fprintf(fid,[text_oarscript]); 1641 fclose(fid); 1642 eval(['!chmod +x ' filename_oarscript]); 1643 eval(['!oarsub -S ' filename_oarscript]); 1644 end 1645 end 1646 end 1647 1586 end 1587 max_walltime=3600*12; % 12h max 1588 walltime_onejob=600;%seconds 1589 filename_joblist=fullfile(DirOAR,'job_list.txt');%create name of the global executable file 1590 fid=fopen(filename_joblist,'w'); 1591 for p=1:length(batch_file_list) 1592 fprintf(fid,[batch_file_list{p} '\n']);% list of exe files (TODO: create them) 1593 end 1594 fclose(fid); 1595 system(['chmod +x ' filename_joblist]);% set the file to executable 1596 oar_command=['oarsub -n CIVX '... 1597 '-t idempotent --checkpoint ' num2str(walltime_onejob+60) ' '... 1598 '-l /core=' num2str(NbCore) ','... 1599 'walltime=' datestr(min(1.05*walltime_onejob/86400*max(length(batch_file_list),NbCore)/NbCore,max_walltime/86400),13) ' '... 1600 '-E ' regexprep(filename_joblist,'\.txt\>','.stderr') ' '... 1601 '-O ' regexprep(filename_joblist,'\.txt\>','.stdout') ' '... 1602 extra_oar ' '... 1603 '"oar-parexec -s -f ' filename_joblist ' '... 1604 '-l ' filename_joblist '.log"\n']; 1605 filename_oarcommand=fullfile(DirOAR,'oar_command'); 1606 fid=fopen(filename_oarcommand,'w'); 1607 fprintf(fid,oar_command); 1608 fclose(fid); 1609 fprintf(oar_command);% display in command line 1610 %system(['chmod +x ' oar_command]);% set the file to executable 1611 system(oar_command); 1612 end 1613 1614 %% reset the GUI series 1615 update_waitbar(handles.Waitbar,1); % put the waitbar to end position to indicate launching is finished 1648 1616 set(handles.RUN, 'Enable','On') 1649 1617 set(handles.RUN,'BackgroundColor',[1 0 0]) … … 1671 1639 % --- Main launch command, called by RUN and BATCH 1672 1640 1673 function [Series, filexml,errormsg]=prepare_jobs(handles)1641 function [Series,OutputDir,errormsg]=prepare_jobs(handles) 1674 1642 %INPUT: 1675 1643 % handles: handles of graphic objects on the GUI series 1676 % run=0, just to display parameters for MenuExport/GUI config 1677 % run=1 (default) prepare the computation 1678 1679 %------------------------------------------------------------------------ 1680 filexml=''; 1644 1645 %------------------------------------------------------------------------ 1646 OutputDir=''; 1681 1647 errormsg=''; 1682 1648 1683 1649 %% Read parameters from series 1684 1650 Series=read_GUI(handles.series); 1685 if isfield(Series,'Pairs')1686 Series=rmfield(Series,'Pairs'); %info Pairs not needed for output1687 end1688 1689 1690 %% projection object1691 % if isfield(Series,'CheckObject')1692 % if Series.CheckObject1693 % hset_object=findobj(allchild(0),'tag','set_object');1694 % Series.ProjObject=read_GUI(hset_object);1695 % CheckObject_Callback([], [], handles)1696 % end1697 % else1698 % Series.CheckObject=0;1699 % end1700 1651 1701 1652 %% get_field GUI 1702 if isfield(Series,'InputFields')&&isfield(Series.InputFields,'Field') 1703 if strcmp(Series.InputFields.Field,'get_field...') 1704 hget_field=findobj(allchild(0),'name','get_field'); 1705 Series.GetField=read_GUI(hget_field); 1706 end 1707 end 1708 1709 %% defining the ActionName function handle 1710 % list_action=get(handles.ActionName,'String');% list menu action 1711 % index=get(handles.ActionName,'Value'); 1712 % action= list_action{index}; % selected string 1713 % %Series.hseries=handles.series; % handles to the series GUI 1714 % path_series=which('series'); 1715 % ActionPathList=get(handles.ActionName,'UserData'); 1716 % ActionPath=ActionPathList{index}; %path stored for the function ACTION 1717 % if ~isequal(ActionPath,path_series) 1718 % eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION 1719 % if ~exist(ActionPath,'dir') 1720 % errormsg=['The prescribed function path ' ActionPath ' does not exist']; 1721 % return 1722 % end 1723 % if ~isequal(spath,ActionPath) 1724 % addpath(ActionPath)% add the prescribed path if not the current one 1653 % if isfield(Series,'InputFields')&&isfield(Series.InputFields,'Field') 1654 % if strcmp(Series.InputFields.Field,'get_field...') 1655 % hget_field=findobj(allchild(0),'name','get_field'); 1656 % Series.GetField=read_GUI(hget_field); 1725 1657 % end 1726 1658 % end 1727 % eval(['h_fun=@' action ';'])%create a function handle for ACTION 1728 % if ~isequal(ActionPath,path_series) 1729 % rmpath(ActionPath)% add the prescribed path if not the current one 1730 % end 1731 1732 %% create the output data directory and write in it the xml file from the GUI config 1659 1660 %% create the output data directory 1733 1661 %determine the root file corresponding to the first sub dir 1734 1662 if get(handles.RUN,'value') && isfield(Series,'OutputSubDir') 1735 1663 SubDirOut=[get(handles.OutputSubDir,'String') Series.OutputDirExt]; 1736 1664 SubDirOutNew=SubDirOut; 1737 iview=1;1738 1665 SeriesData=get(handles.series,'UserData'); 1739 1666 if size(Series.InputTable,1)>1 && isfield(SeriesData,'AllowInputSort') && SeriesData.AllowInputSort … … 1762 1689 Series.OutputRootFile=Series.InputTable{1,3};% the first sorted RootFile taken for output 1763 1690 set(handles.OutputDirExt,'String',Series.OutputDirExt) 1764 % create output directory 1765 OutputDir=fullfile(Series.InputTable{1,1},[Series.OutputSubDir Series.OutputDirExt]); 1766 if check_create 1691 OutputDir=fullfile(Series.InputTable{1,1},[Series.OutputSubDir Series.OutputDirExt]);% full name (with path) of output directory 1692 if check_create % create output directory if it does not exist 1767 1693 [tild,msg1]=mkdir(OutputDir); 1768 1694 if ~strcmp(msg1,'') … … 1771 1697 end 1772 1698 end 1773 filexml=fullfile(OutputDir,Series.InputTable{1,3});% name of the parameter xml file set in this directory 1774 end 1775 %removes redondant information 1699 % RootOut=fullfile(OutputDir,Series.InputTable{1,3});% name of the parameter xml file set in this directory 1700 end 1701 1702 %% removes unused information on Series 1703 if isfield(Series,'Pairs') 1704 Series=rmfield(Series,'Pairs'); %info Pairs not needed for output 1705 end 1776 1706 Series.IndexRange=rmfield(Series.IndexRange,'TimeTable'); 1777 1707 Series.IndexRange=rmfield(Series.IndexRange,'MinIndex'); 1778 1708 Series.IndexRange=rmfield(Series.IndexRange,'MaxIndex'); 1779 %removes empty lines of InputTable1780 1709 empty_line=false(size(Series.InputTable,1),1); 1781 1710 for iline=1:size(Series.InputTable,1) … … 2087 2016 field_index=get(handles.FieldName,'Value'); 2088 2017 field=field_str{field_index(1)}; 2089 if isequal(field,'get_field...') 2090 hget_field=findobj(allchild(0),'name','get_field'); 2091 if ~isempty(hget_field) 2092 delete(hget_field)%delete opened versions of get_field 2093 end 2094 filecell=get_file_series(read_GUI(handles.series)); 2095 if exist(filecell{1,1},'file') 2096 get_field(filecell{1,1}) 2097 end 2098 elseif isequal(field,'more...') 2099 str=calc_field; 2100 [ind_answer,v] = listdlg('PromptString','Select a file:',... 2101 'SelectionMode','single',... 2102 'ListString',str); 2103 % edit the choice in the fields and actionname menu 2104 scalar=cell2mat(str(ind_answer)); 2105 update_menu(handles.FieldName,scalar) 2018 if isequal(field,'get_field...') 2019 hget_field=findobj(allchild(0),'name','get_field'); 2020 if ~isempty(hget_field) 2021 delete(hget_field)%delete opened versions of get_field 2022 end 2023 Series=read_GUI(handles.series); 2024 Series.InputTable=Series.InputTable(1,:); 2025 filecell=get_file_series(Series); 2026 if exist(filecell{1,1},'file') 2027 GetFieldData=get_field(filecell{1,1}); 2028 FieldList={}; 2029 XName=GetFieldData.XVarName; 2030 if GetFieldData.CheckVector 2031 UName=GetFieldData.PanelVectors.vector_x; 2032 VName=GetFieldData.PanelVectors.vector_y; 2033 XName=GetFieldData.XVarName; 2034 YName=GetFieldData.YVarName; 2035 CName=GetFieldData.PanelVectors.vec_color; 2036 [FieldList,VecColorList]=set_field_list(UName,VName,CName); 2037 elseif GetFieldData.CheckScalar 2038 AName=GetFieldData.PanelScalar.scalar; 2039 XName=GetFieldData.XVarName; 2040 YName=GetFieldData.YVarName; 2041 FieldList={AName}; 2042 elseif GetFieldData.CheckPlot1D; 2043 YName=GetFieldData.CheckPlot1D.ordinate; 2044 end 2045 set(handles.Coord_x,'String',{XName}) 2046 set(handles.Coord_y,'String',{YName}) 2047 set(handles.FieldName,'Value',1) 2048 set(handles.FieldName,'String',[FieldList; {'get_field...'}]); 2049 % set(handles.ColorScalar,'Value',1) 2050 % set(handles.ColorScalar,'String',VecColorList); 2051 % UvData.FileType{1}='netcdf'; 2052 % set(handles.uvmat,'UserData',UvData) 2053 end 2054 % elseif isequal(field,'more...') 2055 % str=calc_field; 2056 % [ind_answer,v] = listdlg('PromptString','Select a file:',... 2057 % 'SelectionMode','single',... 2058 % 'ListString',str); 2059 % % edit the choice in the fields and actionname menu 2060 % scalar=cell2mat(str(ind_answer)); 2061 % update_menu(handles.FieldName,scalar) 2106 2062 end 2107 2063 … … 2124 2080 set(hget_field,'name','get_field_1') 2125 2081 end 2126 elseif isequal(field,'more...')2127 str=calc_field;2128 [ind_answer,v] = listdlg('PromptString','Select a file:',...2129 'SelectionMode','single',...2130 'ListString',str);2131 % edit the choice in the fields and actionname menu2132 scalar=cell2mat(str(ind_answer));2133 update_menu(handles.FieldName_1,scalar)2082 % elseif isequal(field,'more...') 2083 % str=calc_field; 2084 % [ind_answer,v] = listdlg('PromptString','Select a file:',... 2085 % 'SelectionMode','single',... 2086 % 'ListString',str); 2087 % % edit the choice in the fields and actionname menu 2088 % scalar=cell2mat(str(ind_answer)); 2089 % update_menu(handles.FieldName_1,scalar) 2134 2090 end 2135 2091 … … 2205 2161 value=get(handles.CheckObject,'Value'); 2206 2162 if value 2207 set(handles.CheckObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow2163 % set(handles.CheckObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow 2208 2164 hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle 2209 2165 if ishandle(hset_object) … … 2216 2172 defaultname={''}; 2217 2173 end 2218 [FileName, PathName , filterindex] = uigetfile( ...2174 [FileName, PathName] = uigetfile( ... 2219 2175 {'*.xml;*.mat', ' (*.xml,*.mat)'; 2220 2176 '*.xml', '.xml files '; ... … … 2242 2198 set(handles.DeleteObject,'Visible','on'); 2243 2199 set(handles.ViewObject,'Visible','on'); 2200 set(handles.ProjObject,'Visible','on'); 2244 2201 else 2245 set(handles.CheckObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green 2202 set(handles.DeleteObject,'Visible','off'); 2203 set(handles.ViewObject,'Visible','off'); 2204 set(handles.ProjObject,'Visible','off'); 2205 % set(handles.CheckObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green 2246 2206 end 2247 2207 %set(handles.series,'UserData',SeriesData) … … 2399 2359 % --- Executes on button press in status. 2400 2360 function status_Callback(hObject, eventdata, handles) 2401 val=get(handles.status,'Value'); 2402 2403 %% delete current display fig if selection is off 2404 if val==0 2361 2362 if get(handles.status,'Value') 2363 set(handles.status,'BackgroundColor',[1 1 0]) 2364 drawnow 2365 StatusData.time_ref=get(handles.RUN,'UserData');% get the time of launch 2366 Param=read_GUI(handles.series); 2367 RootPath=Param.InputTable{1,1}; 2368 OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files 2369 OutputDir=fullfile(RootPath,OutputSubDir); 2370 hfig=findobj(allchild(0),'name','series_status'); 2371 if isempty(hfig) 2372 hfig=figure('DeleteFcn',@stop_status); 2373 set(hfig,'MenuBar','none')% suppress the menu bar 2374 set(hfig,'NumberTitle','off')%suppress the fig number in the title 2375 set(hfig,'name','series_status') 2376 set(hfig,'tag','series_status') 2377 uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @view_file,'tag','list','UserData',OutputDir); 2378 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','titlebox','Max',2,'String',OutputDir); 2379 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 2380 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status); 2381 hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI); 2382 set(hrefresh,'UserData',StatusData) 2383 BarPosition=[0.05 0.81 0.01 0.05]; 2384 uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); 2385 drawnow 2386 end 2387 refresh_GUI(hrefresh,[]) 2388 else 2389 %% delete current display fig if selection is off 2405 2390 set(handles.status,'BackgroundColor',[0 1 0]) 2406 2391 hfig=findobj(allchild(0),'name','series_status'); … … 2410 2395 return 2411 2396 end 2412 set(handles.status,'BackgroundColor',[1 1 0]) 2413 drawnow 2414 % listtype={'civ1','fix1','patch1','civ2','fix2','patch2'}; 2415 % Param.CheckCiv1=get(handles.CheckCiv1,'Value'); 2416 % Param.CheckFix1=get(handles.CheckFix1,'Value'); 2417 % Param.CheckPatch1=get(handles.CheckPatch1,'Value'); 2418 % Param.CheckCiv2=get(handles.CheckCiv2,'Value'); 2419 % Param.CheckFix2=get(handles.CheckFix2,'Value'); 2420 % Param.CheckPatch2=get(handles.CheckPatch2,'Value'); 2421 % box_test=[Param.CheckCiv1 Param.CheckFix1 Param.CheckPatch1 Param.CheckCiv2 Param.CheckFix2 Param.CheckPatch2]; 2422 % 2423 % option_civ=find(box_test,1,'last');%last selected option (non-zero index of box_test) 2424 % filecell=get(handles.civ,'UserData');%retrieve the list of output files expected for PIV 2425 % test_new=0; 2426 % if ~isfield(filecell,'nc') 2427 % test_new=1; 2428 % [ref_i,ref_j,errormsg]=find_ref_indices(handles); 2429 % if ~isempty(errormsg) 2430 % msgbox_uvmat('ERROR',errormsg) 2431 % return 2432 % end 2433 % filecell=set_civ_filenames(handles,ref_i,ref_j,box_test);%determine the output file expected from the GUI status 2434 % end 2435 % if ~isequal(box_test(4:6),[0 0 0]) 2436 % civ_files=filecell.nc.civ2;%case of civ2 operations 2437 % else 2438 % civ_files=filecell.nc.civ1; 2439 % end 2440 % InputTable=get(handles.InputTable,'Data'); 2441 % OutputDir=fullfile(InputTable{1,1},[get(handles.OutputSubDir,'String') get(handles.OutputDirExt,'String')]); 2442 StatusData.time_ref=get(handles.RUN,'UserData');% get the time of launch 2443 % StatusData.option_civ=option_civ; 2444 Param=read_GUI(handles.series); 2445 RootPath=Param.InputTable{1,1}; 2446 %SubDir=Param.InputTable{1,2}; 2447 OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files 2448 OutputDir=fullfile(RootPath,OutputSubDir); 2449 % set(hlist,'UserData',OutputDir) 2450 hfig=findobj(allchild(0),'name','series_status'); 2451 if isempty(hfig) 2452 hfig=figure('DeleteFcn',@stop_status); 2453 set(hfig,'MenuBar','none')% suppress the menu bar 2454 set(hfig,'NumberTitle','off')%suppress the fig number in the title 2455 set(hfig,'name','series_status') 2456 set(hfig,'tag','series_status') 2457 % set(hfig,'UserData',civ_files) 2458 hlist= uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', {'open_uvmat'},'tag','list','UserData',OutputDir); 2459 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String',OutputDir); 2460 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 2461 %uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@close_GUI); 2462 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status); 2463 hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI); 2464 set(hrefresh,'UserData',StatusData) 2465 BarPosition=[0.05 0.81 0.01 0.05]; 2466 uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); 2467 drawnow 2468 end 2469 2470 refresh_GUI(hrefresh,[]) 2397 2398 2399 %------------------------------------------------------------------------ 2400 % launched by selecting a file on the list 2401 function view_file(hObject, eventdata) 2402 list=get(hObject,'String'); 2403 index=get(hObject,'Value'); 2404 rootroot=get(hObject,'UserData'); 2405 selectname=list{index}; 2406 ind_dot=regexp(selectname,'\.\.\.'); 2407 if ~isempty(ind_dot) 2408 selectname=selectname(1:ind_dot-1); 2409 end 2410 FullSelectName=fullfile(rootroot,selectname); 2411 if exist(FullSelectName,'dir')% a directory has been selected 2412 ListFiles=dir(FullSelectName); 2413 ListDisplay=cell(numel(ListFiles),1); 2414 for ilist=2:numel(ListDisplay)% suppress the first line '.' 2415 ListDisplay{ilist-1}=ListFiles(ilist).name; 2416 end 2417 set(hObject,'Value',1) 2418 set(hObject,'String',ListDisplay) 2419 if strcmp(selectname,'..') 2420 FullSelectName=fileparts(fileparts(FullSelectName)); 2421 end 2422 set(hObject,'UserData',FullSelectName) 2423 hfig=get(hObject,'parent'); 2424 htitlebox=findobj(hfig,'tag','titlebox'); 2425 set(htitlebox,'String',FullSelectName) 2426 elseif exist(FullSelectName,'file')%visualise the vel field if it exists 2427 FileType=get_file_type(FullSelectName); 2428 if strcmp(FileType,'txt') 2429 edit(FullSelectName) 2430 else 2431 uvmat(FullSelectName) 2432 end 2433 set(gcbo,'Value',1) 2434 end 2435 2436 2437 %------------------------------------------------------------------------ 2438 2471 2439 %------------------------------------------------------------------------ 2472 2440 % launched by refreshing the status figure 2473 2441 function refresh_GUI(hObject, eventdata) 2474 2442 %------------------------------------------------------------------------ 2475 % Tabchar={};2476 % BarPosition=[0.05 0.81 0.01 0.05];2477 2443 hfig=get(hObject,'parent'); 2478 h msgbox=findobj(hfig,'tag','msgbox');2444 htitlebox=findobj(hfig,'tag','titlebox'); 2479 2445 hlist=findobj(hfig,'tag','list'); 2480 % StatusData=get(hObject,'UserData'); 2481 OutputDir=get(hmsgbox,'String'); 2446 OutputDir=get(htitlebox,'String'); 2482 2447 ListFiles=dir(OutputDir); 2483 2448 ListDisplay=cell(numel(ListFiles),1); 2484 for ilist= 1:numel(ListDisplay)2485 ListDisplay{ilist }=ListFiles(ilist).name;2449 for ilist=2:numel(ListDisplay) 2450 ListDisplay{ilist-1}=ListFiles(ilist).name; 2486 2451 end 2487 2452 set(hlist,'String',ListDisplay) … … 2556 2521 % end 2557 2522 % hlist=findobj(hfig,'tag','list'); 2558 % h msgbox=findobj(hfig,'tag','msgbox');2523 % htitlebox=findobj(hfig,'tag','titlebox'); 2559 2524 % hwaitbar=findobj(hfig,'tag','waitbar'); 2560 2525 % set(hlist,'String',Tabchar) 2561 % set(h msgbox,'String', message)2526 % set(htitlebox,'String', message) 2562 2527 % if count>0 %&& ~test_new 2563 2528 % BarPosition(3)=0.9*count/nbfiles; … … 2597 2562 if isfield(m_file,'datenum') && m_file.datenum>sh_file.datenum 2598 2563 set(handles.ActionExt,'BackgroundColor',[1 1 0]) 2564 drawnow 2599 2565 answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']); 2600 2566 if strcmp(answer,'Yes') -
trunk/src/series/aver_stat.m
r594 r595 89 89 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 90 90 %%%%%%%%%%%% 91 NbSlice=1;%default92 if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)93 NbSlice=Param.IndexRange.NbSlice;94 end91 % NbSlice=1;%default 92 % if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice) 93 % NbSlice=Param.IndexRange.NbSlice; 94 % end 95 95 nbview=numel(i1_series);%number of input file series (lines in InputTable) 96 96 nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices) 97 97 nbfield_i=size(i1_series{1},2); %nb of fields for the i index 98 98 nbfield=nbfield_j*nbfield_i; %total number of fields 99 nbfield_i=floor(nbfield/NbSlice);%total number of indexes in a slice (adjusted to an integer number of slices)100 nbfield=nbfield_i*NbSlice; %total number of fields after adjustement99 %nbfield_i=floor(nbfield/NbSlice);%total number of indexes in a slice (adjusted to an integer number of slices) 100 %nbfield=nbfield_i*NbSlice; %total number of fields after adjustement 101 101 102 102 %determine the file type on each line from the first input file … … 173 173 174 174 %% MAIN LOOP ON SLICES 175 for i_slice=1:NbSlice176 index_slice=i_slice:NbSlice:nbfield;% select file indices of the slice175 % for i_slice=1:NbSlice 176 % index_slice=i_slice:NbSlice:nbfield;% select file indices of the slice 177 177 nbfiles=0; 178 178 nbmissing=0; 179 179 180 180 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% 181 for index=index_slice 181 for index=1:nbfield 182 %for index=index_slice 182 183 if checkrun 183 184 stopstate=get(Param.RUNHandle,'BusyAction'); … … 305 306 306 307 %writting the result file 307 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(1),i1_series{1}(end), i_slice,[]);308 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(1),i1_series{1}(end),j1_series{1}(1),j1_series{1}(end)); 308 309 if CheckImage{1} %case of images 309 310 if isequal(FileInfo{1}.BitDepth,16)||(numel(FileInfo)==2 &&isequal(FileInfo{2}.BitDepth,16)) … … 324 325 end 325 326 end % end averaging loop 326 end327 % end 327 328 %%%%%%%%%%%%%%%% end loop on slices %%%%%%%%%%%%%%%% 328 329 -
trunk/src/series/merge_proj.m
r592 r595 63 63 64 64 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%% 65 66 65 67 %% read input parameters from an xml file if input is a file name (batch mode) 66 68 checkrun=1; … … 157 159 end 158 160 NomTypeOut=NomType;% output file index will indicate the first and last ref index in the series 159 if checkrun==1160 ParamOut.Specific=[];%no specific parameter161 return %stop here for interactive input (option Param.Specific='?')162 end161 % if checkrun==1 162 % ParamOut.Specific=[];%no specific parameter 163 % return %stop here for interactive input (option Param.Specific='?') 164 % end 163 165 164 166 %% Set field names and velocity types … … 174 176 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% 175 177 for index=index_slice 176 177 178 if checkrun 178 update_waitbar(hseries.Waitbar,index/(nbfield))179 stopstate=get(hseries.RUN,'BusyAction');179 stopstate=get(Param.RUNHandle,'BusyAction'); 180 update_waitbar(Param.WaitbarHandle,index/nbfield) 180 181 else 181 182 stopstate='queue'; 182 183 end 183 184 if ~isequal(stopstate,'queue')% enable STOP command 185 return 186 end 184 187 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%% 185 188 Data=cell(1,nbview);%initiate the set Data -
trunk/src/uvmat.m
r591 r595 73 73 % _____________|____________ 74 74 % | | 75 % proj_field.m proj_field.m project the field on the projection objects (use calc_field.m)75 % proj_field.m proj_field.m project the field on the projection objects (use set_field_list.m) 76 76 % | | 77 77 % UvData.PlotAxes ViewData.PlotAxes (on view_field) … … 1041 1041 set(handles_Fields,'Value',1) 1042 1042 set(handles_Fields,'String',{'get_field...'}) 1043 hget_field=get_field(FileName); 1044 hhget_field=guidata(hget_field); 1045 get_field('RUN_Callback',hhget_field.RUN,[],hhget_field); 1043 FieldName_Callback([],[], handles) 1044 % hget_field=get_field(FileName); 1045 % hhget_field=guidata(hget_field); 1046 % get_field('RUN_Callback',hhget_field.RUN,[],hhget_field); 1046 1047 otherwise 1047 1048 set(handles_Fields,'Value',1) % set menu to 'image' … … 2121 2122 ParamIn.VelType=VelType; 2122 2123 XNameMenu=get(handles.Coord_x,'String'); 2123 ParamIn.Coord_x=XNameMenu(get(handles.Coord_x,'Value')); 2124 if ~isempty(XNameMenu) 2125 ParamIn.Coord_x=XNameMenu(get(handles.Coord_x,'Value')); 2126 end 2124 2127 YNameMenu=get(handles.Coord_y,'String'); 2125 ParamIn.Coord_y=YNameMenu(get(handles.Coord_y,'Value')); 2128 if ~isempty(YNameMenu) 2129 ParamIn.Coord_y=YNameMenu(get(handles.Coord_y,'Value')); 2130 end 2126 2131 end 2127 2132 check_tps = 0; … … 2597 2602 set(handles.ListObject_1,'Visible','off') 2598 2603 [PlotType,PlotParamOut]=plot_field(UvData.Field,handles.PlotAxes,read_GUI(handles.uvmat)); 2599 write_plot_param(handles,PlotParamOut) %update the auto plot parameters 2604 errormsg=fill_GUI(PlotParamOut,handles.uvmat); 2605 %write_plot_param(handles,PlotParamOut) %update the auto plot parameters 2600 2606 2601 2607 %% 2D or 3D fieldname are generally projected … … 2704 2710 else 2705 2711 [PlotType,PlotParamOut]=plot_field(ObjectData,haxes(imap),PlotParam{imap},PosColorbar{imap}); 2706 write_plot_param(plot_handles{imap},PlotParamOut) %update the auto plot parameters 2712 if imap==1 2713 errormsg=fill_GUI(PlotParamOut,handles.uvmat); 2714 else 2715 errormsg=fill_GUI(PlotParamOut,hview_field); 2716 end 2717 %write_plot_param(plot_handles{imap},PlotParamOut) %update the auto plot parameters 2707 2718 if isfield(Field,'CoordMesh')&&~isempty(Field.CoordMesh) 2708 2719 ObjectData.CoordMesh=Field.CoordMesh; % gives an estimated mesh size (useful for mouse action on the plot) … … 3104 3115 FieldList={}; 3105 3116 VecColorList={}; 3106 XName=''; 3107 YName=''; 3117 XName=GetFieldData.XVarName; 3108 3118 if GetFieldData.CheckVector 3109 3119 UName=GetFieldData.PanelVectors.vector_x; … … 3113 3123 CName=GetFieldData.PanelVectors.vec_color; 3114 3124 [FieldList,VecColorList]=set_field_list(UName,VName,CName); 3115 % FieldList={['vec(' UName ',' VName ')'];... 3116 % ['norm(' UName ',' VName ')'];... 3117 % ['curl(' UName ',' VName ')'];... 3118 % ['div(' UName ',' VName ')'];... 3119 % ['strain(' UName ',' VName ')']}; 3120 % VecColorList={['norm(' UName ',' VName ')'];... 3121 % UName;... 3122 % VName};... 3123 % if ~isempty(CName) 3124 % VecColorList=[{CName};VecColorList]; 3125 % end 3126 end 3127 if GetFieldData.CheckScalar 3125 elseif GetFieldData.CheckScalar 3128 3126 AName=GetFieldData.PanelScalar.scalar; 3129 3127 XName=GetFieldData.XVarName; 3130 3128 YName=GetFieldData.YVarName; 3131 3129 FieldList={AName}; 3132 end 3133 if GetFieldData.CheckPlot1D 3134 XName=GetFieldData.CheckPlot1D.abscissa; 3130 elseif GetFieldData.CheckPlot1D; 3135 3131 YName=GetFieldData.CheckPlot1D.ordinate; 3136 3132 end … … 4101 4097 PlotParam=read_GUI(handles.uvmat); 4102 4098 [tild,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam); 4103 write_plot_param(handles,PlotParamOut); %update the auto plot parameters 4099 errormsg=fill_GUI(PlotParamOut,handles.uvmat); 4100 %write_plot_param(handles,PlotParamOut); %update the auto plot parameters 4104 4101 4105 4102 %------------------------------------------------------------------------ … … 4183 4180 hhview_field=guidata(hview_field); 4184 4181 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 4185 [PlotType,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%read plotting parameters on the uvmat interfachhview_fiel 4186 write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object 4182 [PlotType,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%read plotting parameters on the uvmat interface 4183 4184 %write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object 4187 4185 haxes=findobj(hview_field,'tag','axes3'); 4188 4186 pos=get(hview_field,'Position'); … … 4378 4376 hhview_field=guidata(hview_field); 4379 4377 [PlotType,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%read plotting parameters on the GUI view_field); 4380 write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object 4378 errormsg=fill_GUI(PlotParam,hview_field); 4379 %write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object 4381 4380 haxes=findobj(hview_field,'tag','axes3'); 4382 4381 pos=get(hview_field,'Position');
Note: See TracChangeset
for help on using the changeset viewer.