Changeset 598 for trunk/src/series.m
- Timestamp:
- Apr 2, 2013, 9:13:42 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r596 r598 70 70 set(hObject,'Units','pixels') 71 71 set(handles.PairString,'ColumnName',{'pairs'}) 72 set(handles.PairString,'ColumnEditable', logical(0))72 set(handles.PairString,'ColumnEditable',false) 73 73 set(handles.PairString,'ColumnFormat',{'char'}) 74 74 set(handles.PairString,'Data',{''}) … … 84 84 [path_series,name,ext]=fileparts(which('series'));% path to the GUI series 85 85 path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series' 86 path_bin=fullfile(path_series,'bin');%path of the binary functions (compiled)86 %path_bin=fullfile(path_series,'bin');%path of the binary functions (compiled) 87 87 ActionPathList=regexprep(ActionList,'^.+$',path_series_fct);% set path=path_series to each function in the list ('^.+$'=any non empty nbre of char form beginning to end of char string) 88 ActionPathList=[ActionPathList regexprep(ActionList,'^.+$',path_bin)];% set path tocompiled functions88 ActionPathList=[ActionPathList ActionPathList];% set path to .sh commands for compiled functions 89 89 ActionExtList={'.m';'.sh'};% default choice of extensions (Matlab fct .m or compiled version .sh) 90 90 RunModeList={'local';'background'};% default choice of extensions (Matlab fct .m or compiled version .sh) … … 1366 1366 if exist(xmlfile,'file') 1367 1367 s=xml2struct(xmlfile); 1368 if strcmp(RunMode,'cluster ') && isfield(s,'BatchParam')1368 if strcmp(RunMode,'cluster_oar') && isfield(s,'BatchParam') 1369 1369 if isfield(s.BatchParam,'RunTime') 1370 1370 RunTime=s.BatchParam.RunTime; … … 1382 1382 end 1383 1383 end 1384 if isempty(RunTime) && strcmp(RunMode,'cluster ')1384 if isempty(RunTime) && strcmp(RunMode,'cluster_oar') 1385 1385 msgbox_uvmat('ERROR','RunTime name not found in PARAM.xml, compiled version .sh cannot run on cluster') 1386 1386 return 1387 1387 end 1388 Series.RunTime=RunTime;1388 % Series.RunTime=RunTime; 1389 1389 end 1390 1390 … … 1442 1442 if isempty(Series.IndexRange.NbSlice) 1443 1443 Series.IndexRange.first_i=first_i+(iprocess-1)*BlockLength; 1444 Series.IndexRange.last_i=first_i+(iprocess)*BlockLength-1; 1444 if Series.IndexRange.first_i>last_i 1445 break 1446 end 1447 Series.IndexRange.last_i=min(first_i+(iprocess)*BlockLength-1,last_i); 1445 1448 else 1446 1449 Series.IndexRange.first_i= first_i+iprocess-1; … … 1459 1462 case {'PCWIN','PCWIN64'} %Windows system 1460 1463 filexml=regexprep(filexml,'\\','\\\\');% add '\' so that '\' are left as characters 1461 system([fullfile(ActionPath,[ActionName '.sh']) ' ' Series.RunTime ' ' filexml]);% TODO: adapt to DOS system1464 system([fullfile(ActionPath,[ActionName '.sh']) ' ' RunTime ' ' filexml]);% TODO: adapt to DOS system 1462 1465 case {'GLNX86','GLNXA64','MACI64'}%Linux system 1463 system([fullfile(ActionPath,[ActionName '.sh']) ' ' Series.RunTime ' ' filexml]);1466 system([fullfile(ActionPath,[ActionName '.sh']) ' ' RunTime ' ' filexml]); 1464 1467 end 1465 1468 end … … 1492 1495 if isempty(Series.IndexRange.NbSlice)% process by blocks of i index 1493 1496 Series.IndexRange.first_i=first_i+(iprocess-1)*BlockLength; 1494 Series.IndexRange.last_i=first_i+(iprocess)*BlockLength-1; 1497 if Series.IndexRange.first_i>last_i 1498 NbProcess=iprocess-1; 1499 break% leave the loop, we are at the end of the calculation 1500 end 1501 Series.IndexRange.last_i=min(last_i,first_i+(iprocess)*BlockLength-1); 1495 1502 else% process by slices of i index if NbSlice is defined, computation in a single process if NbSlice =1 1496 1503 Series.IndexRange.first_i= first_i+iprocess-1; … … 1506 1513 1507 1514 %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); 1515 % filebat=fullfile_uvmat(DirBat,'',Series.InputTable{1,3},'.bat',OutputNomType,... 1516 % Series.IndexRange.first_i,Series.IndexRange.last_i,first_j,last_j); 1517 filebat=fullfile_uvmat(DirBat,'',Series.InputTable{1,3},'.sh',OutputNomType,... 1518 Series.IndexRange.first_i,Series.IndexRange.last_i,first_j,last_j); 1510 1519 batch_file_list{iprocess}=filebat; 1511 1520 [fid,message]=fopen(filebat,'w');% create the executable file … … 1551 1560 'hostname && date \n '... 1552 1561 'umask 002 \n'... 1553 fullfile(ActionPath,[ActionName '.sh']) ' ' Series.RunTime ' ' filexml];%allow writting access to created files for user group1562 fullfile(ActionPath,[ActionName '.sh']) ' ' RunTime ' ' filexml];%allow writting access to created files for user group 1554 1563 fprintf(fid,cmd);%fill the executable file with the char string cmd 1555 1564 fclose(fid);% close the executable file … … 1590 1599 fid=fopen(filename_joblist,'w'); 1591 1600 for p=1:length(batch_file_list) 1592 fprintf(fid,[batch_file_list{p} '\n']);% list of exe files (TODO: create them)1601 fprintf(fid,[batch_file_list{p} '\n']);% list of exe files 1593 1602 end 1594 1603 fclose(fid); … … 1705 1714 end 1706 1715 Series.IndexRange=rmfield(Series.IndexRange,'TimeTable'); 1707 Series.IndexRange=rmfield(Series.IndexRange,'MinIndex');1708 Series.IndexRange=rmfield(Series.IndexRange,'MaxIndex');1716 % Series.IndexRange=rmfield(Series.IndexRange,'MinIndex'); 1717 % Series.IndexRange=rmfield(Series.IndexRange,'MaxIndex'); 1709 1718 empty_line=false(size(Series.InputTable,1),1); 1710 1719 for iline=1:size(Series.InputTable,1) … … 1726 1735 end 1727 1736 end 1737 set(handles.ActionName,'BackgroundColor',[1 1 0]) 1738 drawnow 1728 1739 1729 1740 %% get Action name and path … … 1752 1763 end 1753 1764 [ActionPath,ActionName,ActionExt]=fileparts(FileName); 1754 % insert the choice in the menu 1765 1766 % insert the choice in the menu ActionName 1755 1767 ActionIndex=find(strcmp(ActionName,ActionList),1);% look for the selected function in the menu Action 1756 1768 if isempty(ActionIndex)%the input string does not exist in the menu … … 1759 1771 set(handles.ActionName,'String',ActionList) 1760 1772 end 1761 %set(handles.ActionName,'Value',ActionIndex) 1762 %list_path{ActionIndex}=PathName; 1773 1774 % record the file extension and extend the path list if it is a new extension 1775 ActionExtList=get(handles.ActionExt,'String'); 1776 ActionExtIndex=find(strcmp(ActionExt,ActionExtList), 1); 1777 if isempty(ActionExtIndex) 1778 set(handles.ActionExt,'String',[ActionExtList;{ActionExt}]) 1779 ActionExtIndex=numel(ActionExtList)+1; 1780 ActionPathNew=cell(size(ActionPathList,1),1);%new column of ActionPath 1781 ActionPathList=[ActionPathList ActionPathNew]; 1782 end 1783 set(handles.ActionName,'UserData',ActionPathList); 1784 1763 1785 % remove old Action options in the menu (keeping a menu length <nb_builtin_ACTION+5) 1764 1786 if length(ActionList)>nb_builtin_ACTION+5; %nb_builtin=nbre of functions always remaining in the initial menu 1765 1787 nbremove=length(ActionList)-nb_builtin_ACTION-5; 1766 1788 ActionList(nb_builtin_ACTION+1:end-5)=[]; 1767 ActionPathList(nb_builtin_ACTION+1:end-4 )=[];1789 ActionPathList(nb_builtin_ACTION+1:end-4,:)=[]; 1768 1790 ActionIndex=ActionIndex-nbremove; 1769 1791 end 1792 1793 % record action menu, choice and path 1770 1794 set(handles.ActionName,'Value',ActionIndex) 1771 1795 set(handles.ActionName,'String',ActionList) 1772 ActionPathList{ActionIndex}=PathName; 1773 set(handles.ActionPath,'enable','inactive')% indicate that the current path is accessible (not 'off') 1774 1775 % record the file extension and update the paths in userdata 1776 ActionExtList=get(handles.ActionExt,'String'); 1777 ActionExtIndex=find(strcmp(ActionExt,ActionExtList), 1); 1778 if isempty(ActionExtIndex) 1779 set(handles.ActionExt,'String',[ActionExtList;{ActionExt}]) 1780 set(handles.ActionExt,'Value',numel(ActionExtList)+1) 1781 ActionPathNew=cell(size(ActionPathList,1),1);%new column of ActionPath 1782 ActionPathNew{ActionIndex}=ActionPath; 1783 ActionPathList=[ActionPathList ActionPathNew]; 1784 end 1785 set(handles.ActionName,'UserData',ActionPathList); 1786 1787 %record the current menu in personal file profil_perso 1796 set(handles.ActionExt,'Value',ActionExtIndex) 1797 ActionPathList{ActionIndex,ActionExtIndex}=PathName; 1798 1799 %record the user defined menu additions in personal file profil_perso 1788 1800 dir_perso=prefdir; 1789 1801 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 1790 if nb_builtin_ACTION+1<= length(ActionList)-11802 if nb_builtin_ACTION+1<=numel(ActionList)-1 1791 1803 ActionListUser=ActionList(nb_builtin_ACTION+1:numel(ActionList)-1); 1792 1804 ActionPathListUser=ActionPathList(nb_builtin_ACTION+1:numel(ActionList)-1,:); … … 1811 1823 1812 1824 %% default setting for the visibility of the GUI elements 1813 set(handles.FieldTransform,'Visible','off')1814 set(handles.CheckObject,'Visible','off');1815 set(handles.ProjObject,'Visible','off');1816 set(handles.CheckMask,'Visible','off')1817 set(handles.Mask,'Visible','off')1825 % set(handles.FieldTransform,'Visible','off') 1826 % set(handles.CheckObject,'Visible','off'); 1827 % set(handles.ProjObject,'Visible','off'); 1828 % set(handles.CheckMask,'Visible','off') 1829 % set(handles.Mask,'Visible','off') 1818 1830 1819 1831 %% create the function handle for Action … … 1834 1846 end 1835 1847 1836 %% prepare the input param1837 [Series,tild,errormsg]=prepare_jobs(handles); 1848 %% Activate the Action fct 1849 [Series,tild,errormsg]=prepare_jobs(handles);% read the parameters from the GUI series 1838 1850 if ~isempty(errormsg) 1839 1851 msgbox_uvmat('ERROR',errormsg) … … 1842 1854 ParamOut=h_fun(Series); 1843 1855 1844 %% Put the first line of the selected Action fct as too tip help1856 %% Put the first line of the selected Action fct as tooltip help 1845 1857 try 1846 1858 [fid,errormsg] =fopen([ActionName '.m']); … … 1849 1861 set(handles.ActionName,'ToolTipString',InputText{1}{1})% put the first line of the selected function as tooltip help 1850 1862 end 1851 % if ~isequal(path_series,PathName)1852 % rmpath(PathName)1853 % end1854 Param_list={};1855 1863 1856 1864 %% Detect the types of input files … … 1998 2006 set(handles.ActionInput,'Visible','on') 1999 2007 set(handles.ActionInput_title,'Visible','on') 2008 set(handles.ActionInputView,'Visible','on') 2009 set(handles.ActionInputView,'Value',0) 2000 2010 set(handles.ActionInput,'String',ActionName) 2011 ParamOut.ActionInput.Program=ActionName; % record the program in ActionInput 2001 2012 SeriesData.ActionInput=ParamOut.ActionInput; 2002 2013 else 2003 2014 set(handles.ActionInput,'Visible','off') 2004 2015 set(handles.ActionInput_title,'Visible','off') 2016 set(handles.ActionInputView,'Visible','off') 2005 2017 if isfield(SeriesData,'ActionInput') 2006 2018 SeriesData=rmfield(SeriesData,'ActionInput'); … … 2008 2020 end 2009 2021 set(handles.series,'UserData',SeriesData) 2022 set(handles.ActionName,'BackgroundColor',[1 1 1]) 2023 2024 %------------------------------------------------------------------------ 2025 % --- Executes on button press in ActionInputView. 2026 function ActionInputView_Callback(hObject, eventdata, handles) 2027 %------------------------------------------------------------------------ 2028 if get(handles.ActionInputView,'Value') 2029 ActionName_Callback(hObject, eventdata, handles) 2030 end 2010 2031 2011 2032 %------------------------------------------------------------------------ … … 2427 2448 if strcmp(FileType,'txt') 2428 2449 edit(FullSelectName) 2450 elseif strcmp(FileType,'xml') 2451 editxml(FullSelectName) 2429 2452 else 2430 2453 uvmat(FullSelectName) … … 2606 2629 NbSlice=str2num(get(handles.num_NbSlice,'String')); 2607 2630 set(handles.num_NbProcess,'String',num2str(NbSlice)) 2631 2632
Note: See TracChangeset
for help on using the changeset viewer.