diff --git a/crp.m b/crp.m index 3afcb5ad007d7a74e28248e526e934b40a79eeda..6b8c0dfb7736ca3263ad81d2b241324f68f7b9ce 100644 --- a/crp.m +++ b/crp.m @@ -79,6 +79,9 @@ function xout=crp(varargin) % $Revision$ % % $Log$ +% Revision 5.7 2006/02/14 11:45:49 marwan +% *** empty log message *** +% % Revision 5.6 2006/02/06 13:46:17 marwan % plugin for order patterns recurrence plots supported % @@ -205,6 +208,18 @@ if isnumeric(varargin{1})==1 % read commandline input if e<0, e=1; disp('Warning: The threshold size E cannot be negative and is now set to 1.'), end if t<1, t=1; disp('Warning: The delay T cannot be smaller than one and is now set to 1.'), end t=round(t); m=round(m); mflag=method; + if m < 1, m = 1; end + if t < 1, t = 1; end + if method==7 & m > 1, + m=1; + disp('Warning: For order matrix a dimension of one is used.') + end + if method==8 & m == 1, + m=2; + disp(['Warning: For order patterns recurrence plots the dimension must',10,... + 'be larger than one. ',... + 'Embedding dimension is set to ',num2str(m),'.']) + end action='init'; Nx=length(x); Ny=length(y); @@ -241,10 +256,6 @@ if isnumeric(varargin{1})==1 % read commandline input if nonorm==1, y=(y-mean(y))/std(y); end yscale=(1:length(y))'; end - if method==7 & m > 1, - m=1; - disp('Warning: For order matrix a dimension of one is used.') - end ds=eye(m); @@ -297,6 +308,11 @@ else % read input from the GUI m=1; ds = 1; disp('Warning: For order matrix a dimension of one is used.') end + if mflag==8 & m == 1, + m=2; + errordlg(['For order patterns recurrence plots the',10,'dimension must be larger than one.'],'Dimension too small') + set(findobj('Tag','Dim','Parent',hCtrl),'Value',m) + end Nx=length(x); Ny=length(y); NX=Nx-t*(m-1);NY=Ny-t*(m-1); if (NX<1 | NY<1) & strcmpi(action,'apply'); @@ -529,6 +545,7 @@ switch(action) if plugin_exist & ( mflag < 4 | mflag == 8 | mflag == 9 ) & length(x) == length(y) % if plugin exist and method is MAX, MIN, EUC ord DIS if nogui == 1, disp('(plugin used)'), end + [X matext] = crp_plugin(x2, y2, 1, 1, e, mflag, hCRP, plugin_path, 0); else @@ -825,7 +842,14 @@ switch(action) Shuttle.t=t; Shuttle.cm=cm; Shuttle.txt_cross=txt_cross; - if isempty(X), warning(['Uuups! Empty matrix.',10,'I give up ...']); return; end + if isempty(X) + warn_str = ['Uuups! Empty matrix.',10,'I give up ...']; + if strcmpi(computer,'GLNXA64') + warn_str = [warn_str,10,'(Maybe non-appropriate plugin version due to different glibc.)'] + end + warning(warn_str); + return + end show_crp(X,Shuttle) else if nargout==1, xout=X;end diff --git a/crp2.m b/crp2.m index 1c74753e9bf3ccc8f2f411c3c030f3ad312e137f..bf751d284c16cc4216ba94af39b365a804cf0860 100644 --- a/crp2.m +++ b/crp2.m @@ -81,6 +81,9 @@ function xout=crp2(varargin) % $Revision$ % % $Log$ +% Revision 5.8 2006/02/14 11:44:50 marwan +% bug in plugin-call (dim and delay) resolved +% % Revision 5.7 2006/02/06 15:12:46 marwan % bug in multi-dimensional embedding solved % @@ -212,11 +215,23 @@ if isnumeric(varargin{1}) % read commandline input t=round(t); m0=round(m0); mflag=method; if e<0, e=1; disp('Warning: The threshold size E cannot be negative and is now set to 1.'), end if t<1, t=1; disp('Warning: The delay T cannot be smaller than one and is now set to 1.'), end + if m0 < 1, m0 = 1; end + if t < 1, t = 1; end + if size(x,1)==1, x=x'; end, if size(y,1)==1, y=y'; end + m=max([size(x,2) size(y,2)]); + + if method==7 & (m*m0) > 1, + m0=1; + error(['The neighbourhood criterion ''Oder matrix''',10,'is not implemented - use crp or crp_big instead.']) + end + if method==8 & (m*m0) == 1, + m0=2; + disp(['Warning: For order patterns recurrence plots the dimension must',10,... + 'be larger than one. ',... + 'Embedding dimension is set to ',num2str(m0),'.']) + end action='init'; - if size(x,1)==1, x=x'; end, if size(y,1)==1, y=y'; end - m=max([size(x,2) size(y,2)]); - if ~isempty(find(isnan(x))) disp('NaN detected (in first variable) - will be cleared.') for k=1:size(x,2), x(find(isnan(x(:,k))),:)=[]; end @@ -231,7 +246,7 @@ if isnumeric(varargin{1}) % read commandline input end Nx=size(x,1); Ny=size(y,1); - NX=Nx-t*(m0-1);NY=Ny-t*(m0-1); + NX=Nx-t*(m0-1);NY=Ny-t*(m0-1); x0=zeros(Nx,m);y0=zeros(Ny,m); x0(1:size(x,1),1:size(x,2))=x; y0(1:size(y,1),1:size(y,2))=y; @@ -247,10 +262,6 @@ if isnumeric(varargin{1}) % read commandline input error(['Too less data',10,... 'Either too much NaN or the number of columns in the vectors do not match.']) end - if method==7 & m0 > 1, - m0=1; - disp('Warning: For order matrix a dimension of one is used.') - end ds=eye(m); else % read input from the GUI @@ -297,9 +308,10 @@ else % read input from the GUI set(findobj('Tag','Sizetext','Parent',hCtrl),'enable','on'); end - if mflag==7 & m > 1, - m=1; ds = 1; - disp('Warning: For order matrix a dimension of one is used.') + if mflag==8 & (m * m0) == 1, + m0=2; + errordlg(['For order patterns recurrence plots the',10,'dimension must be larger than one.'],'Dimension too small') + set(findobj('Tag','Dim0','Parent',hCtrl),'Value',m0) end Nx=length(x); Ny=length(y); NX=Nx-t*(m-1);NY=Ny-t*(m-1); @@ -1183,7 +1195,14 @@ switch(action) Shuttle.t=t; Shuttle.cm=cm; Shuttle.txt_cross=txt_cross; - if isempty(X), warning(['Uuups! Empty matrix.',10,'I give up ...']); return; end + if isempty(X) + warn_str = ['Uuups! Empty matrix.',10,'I give up ...']; + if strcmpi(computer,'GLNXA64') + warn_str = [warn_str,10,'(Maybe non-appropriate plugin version due to different glibc.)'] + end + warning(warn_str); + return + end show_crp(X,Shuttle) else if nargout==1, xout=X; end @@ -1585,7 +1604,7 @@ set(0,'ShowHidden','Off') %%%%%%% error handling -% if 0 +%if 0 catch try, if nogui==0 for i=1:length(obj.enable), set(obj.children(i),'Enable',obj.enable{i}); end diff --git a/crp_big.m b/crp_big.m index e0bc7ae14edea32a3cb55552208902b00a09502a..61f7e733cdb96898b7e32efc0d024af4097d22c7 100644 --- a/crp_big.m +++ b/crp_big.m @@ -77,6 +77,9 @@ function xout=crp_big(varargin) % $Revision$ % % $Log$ +% Revision 5.6 2006/02/06 13:46:17 marwan +% plugin for order patterns recurrence plots supported +% % Revision 5.5 2005/11/23 07:30:30 marwan % modified interdependent algorithm % bug in showing RP fixed @@ -198,6 +201,18 @@ if isnumeric(varargin{1})==1 % read commandline input if e<0, e=1; disp('Warning: The threshold size E cannot be negative and is now set to 1.'), end if t<1, t=1; disp('Warning: The delay T cannot be smaller than one and is now set to 1.'), end t=round(t); m=round(m); mflag=method; + if m < 1, m = 1; end + if t < 1, t = 1; end + if method==7 & m > 1, + m=1; + disp('Warning: For order matrix a dimension of one is used.') + end + if method==8 & m == 1, + m=2; + disp(['Warning: For order patterns recurrence plots the dimension must',10,... + 'be larger than one. ',... + 'Embedding dimension is set to ',num2str(m),'.']) + end action='init'; Nx=length(x); Ny=length(y); @@ -234,10 +249,6 @@ if isnumeric(varargin{1})==1 % read commandline input if nonorm==1, y=(y-mean(y))/std(y); end yscale=(1:length(y))'; end - if method==7 & m > 1, - m=1; - disp('Warning: For order matrix a dimension of one is used.') - end ds=eye(m); @@ -290,6 +301,11 @@ else % read input from the GUI m=1; ds = 1; disp('Warning: For order matrix a dimension of one is used.') end + if mflag==8 & m == 1, + m=2; + errordlg(['For order patterns recurrence plots the',10,'dimension must be larger than one.'],'Dimension too small') + set(findobj('Tag','Dim','Parent',hCtrl),'Value',m) + end Nx=length(x); Ny=length(y); NX=Nx-t*(m-1);NY=Ny-t*(m-1); if (NX<1 | NY<1) & strcmpi(action,'apply'); @@ -875,7 +891,14 @@ switch(action) Shuttle.t=t; Shuttle.cm=cm; Shuttle.txt_cross=txt_cross; - if isempty(X), warning(['Uuups! Empty matrix.',10,'I give up ...']); return; end + if isempty(X) + warn_str = ['Uuups! Empty matrix.',10,'I give up ...']; + if strcmpi(computer,'GLNXA64') + warn_str = [warn_str,10,'(Maybe non-appropriate plugin version due to different glibc.)'] + end + warning(warn_str); + return + end show_crp(X,Shuttle) else if nargout==1, xout=X;end diff --git a/crp_man.pdf b/crp_man.pdf index da5ebba7d1b55f3825ee82d4c2a4ba7ecd58aec6..d3e9aea4d577f4a7bd249daea204a99990ea7fee 100755 Binary files a/crp_man.pdf and b/crp_man.pdf differ diff --git a/crqa.m b/crqa.m index a34482f835396ac8abb8e9f64a7e5a50bdf30cb6..2cad23d8760c5c12f497e127fd587b785af7c644 100644 --- a/crqa.m +++ b/crqa.m @@ -135,6 +135,9 @@ function xout=crqa(varargin) % $Revision$ % % $Log$ +% Revision 5.25 2006/02/14 11:45:49 marwan +% *** empty log message *** +% % Revision 5.24 2006/02/08 13:25:12 marwan % bug in plugin support (lmin and vmin not correct) resolved % @@ -351,8 +354,24 @@ errcode=1; disp('No valid arguments.') return end + if method==7 & m > 1, + m=1; + disp('Warning: For order matrix a dimension of one is used.') + end + + if (strcmpi(method,'Order Pattern') | strcmpi(method,'op')) & m == 1, + m=2; + h = findobj('Tag','crqa_m'); + if ~isempty(h) + errordlg(['For order patterns recurrence plots the',10,'dimension must be larger than one.'],'Dimension too small') + set(h(1),'String',num2str(m)) + else + disp(['Warning: For order patterns recurrence plots the dimension must',10,... + 'be larger than one. ',... + 'Embedding dimension is set to ',num2str(m),'.']) + end + end - Nx=length(x); Ny=length(y); if size(x,1)<size(x,2), x=x'; end if size(y,1)<size(y,2), y=y'; end @@ -430,6 +449,7 @@ errcode=1; disp('The delay T can not be smaller than one and is now set to 1.') end end + if m < 1; m = 1; end if isempty(w), w=Nx; wstep=1; end if w < 5+(m-1)*t, w=5+(m-1)*t; @@ -672,7 +692,7 @@ case 'init' h=uicontrol(props.edit,... 'Tag','crqa_m',... 'String',num2str(m),... - 'ToolTip','Select the embedding dimension.',... + 'ToolTip','Select the embedding dimension.',... 'Position',[104+30 32+.2+2.2 7 1.5000]); h=uicontrol(props.text,... @@ -791,7 +811,7 @@ case 'init' 'Position',[86+30 1.3+.5 29 9]); - h=uicontrol(props.button,... + h=uicontrol(props.button,... 'String','Store',... 'Tag','crqa_button_store',... 'Enable','Off',... @@ -813,7 +833,7 @@ case 'init' 'String','Close',... 'Position',[89+30 2.1+.5 22 2.2143]); - h=uicontrol(props.button,... + h=uicontrol(props.button,... 'String','Apply',... 'Tag','crqa_button_apply',... 'ToolTip','Starts the computation.',... diff --git a/mgui.m b/mgui.m index d92775c2ae7ef120f0981f035b1603235e266e66..ff7d8f5d059532a33ae089e489a1abeb597ccc9a 100755 --- a/mgui.m +++ b/mgui.m @@ -28,6 +28,9 @@ function mgui(action) % $Revision$ % % $Log$ +% Revision 1.11 2006/03/16 14:55:57 marwan +% code flattened +% % Revision 1.10 2006/02/14 11:45:49 marwan % *** empty log message *** % @@ -848,7 +851,7 @@ set(hfs,'UserData',funktion); tx{4}='We hope we could satisfy you.'; tx{5}='Thank you for working with us.'; tx{6}='Now you should go home.'; - tx{7}='Did you always find us in the WorldWideWeb?'; + tx{7}='Did you already find us in the WorldWideWeb?'; tx{8}='Your cat might be hungry.'; tx{9}='Maybe your Matlab license will be needed by others?'; tx{10}='Can you imagine, how long we have worked for that?'; diff --git a/mi.m b/mi.m index 36cc61e87bc24ebc0670d71fe2f9086b847559f6..f02c7be1338483f8f1162e25c7ef99fc76688155 100644 --- a/mi.m +++ b/mi.m @@ -18,8 +18,7 @@ function varargout=mi(varargin) % standard error (only for one- and two-dimensional data). % % MI(...) without any output arguments opens a GUI for interactively -% changing the parameters. If an output is specified with using the -% option 'gui', then the output will contain the figure handle. +% changing the parameters. % % By using the GUI, the mutual information can be stored into the % workspace. If their standard error is available, they will be @@ -42,7 +41,7 @@ function varargout=mi(varargin) % References: % Roulston, M. S.: % Estimating the errors on measured entropy and mutual -% information, Physica D 125, 1999, 285-294. +% information, Physica D, 125, 1999. % Copyright (c) 2002-2006 % Andre Sitz/ Norbert Marwan, Potsdam University, Germany @@ -52,6 +51,9 @@ function varargout=mi(varargin) % $Revision$ % % $Log$ +% Revision 3.9 2006/02/14 11:46:15 marwan +% *** empty log message *** +% % Revision 3.8 2005/03/16 11:19:02 marwan % help text modified % @@ -125,24 +127,23 @@ if nargin & isnumeric(varargin{1}) action='init'; if ~isempty(i_char) - if findstr(lower(varargin{i_char(1)}),'n') + if findstr(lower(varargin{i_char(1)}(1)),'n') nogui=1; action='compute'; end - if findstr(lower(varargin{i_char(1)}),'s') + if findstr(lower(varargin{i_char(1)}(1)),'s') nogui=2; action='compute'; end - if findstr(lower(varargin{i_char(1)}),'g') + if findstr(lower(varargin{i_char(1)}(1)),'g') nogui=-1; end end - if nargout & nogui==0 + if nargout & (nogui<1) nogui=1; action='compute'; end if nogui==-1; nogui=0; end - elseif nargin & ischar(varargin{1}) & ~isempty(varargin{1}) @@ -313,7 +314,6 @@ case 'init' for i=1:length(tags); h=[h; findobj('Tag',tags{i})]; end set(h,'Units','Norm') mi('compute') - if nargout; varargout={h8}; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% close windows @@ -379,6 +379,7 @@ case 'store' case 'compute' warning off + if ~nogui h_fig=findobj('tag','MI_Fig'); setptr(gcf,'watch'), @@ -423,7 +424,7 @@ case 'compute' set(h,'Enable','On') end end - setptr(h_fig(1),'arrow') + setptr(h_fig(1),'arrow') end warning on if nogui~=2, delete(hw); end @@ -458,9 +459,23 @@ case 'compute' end end, end if nogui~=2; waitbar(t/lag); end + if ~nogui & t*10/lag == ceil(t*10/lag) + h=findobj('Tag','button_store'); + if m==2 + out_str{1}=MI; out_str{2}=MI_sigma; + else + out_str{1}=MI; + end + set(h(1),'UserData',out_str) + mi('plot_mi') + end + + + end if nogui~=2; delete(hw); end if ~nogui + set(0,'ShowHidden','on') h=findobj('tag','button_apply'); set(h(1),'ToolTip','Starts the computation.','String','Apply','Callback','mi compute') for j=1:length(obj); @@ -495,74 +510,82 @@ case 'compute' if nargout==0 mi('plot_mi') end - + if nargout==0 & nogui + assignin('base','ans', MI) + ans=MI + end + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% output case 'plot_mi' - h=findobj('Tag','button_store'); - if isempty(h), return, end - x=get(h(1),'UserData'); - MI=x{1}; if m==2; MI_sigma=x{2}; end - - if ~isempty(findobj('Tag','MI_Fig')) - - h_axes=findobj('Tag','mi_axes','Parent',gcf); h_axes=h_axes(1); - h_res=findobj('Tag','mi_result','Parent',gcf); delete(h_res); - h_show=[findobj('Tag','text_show','Parent',gcf);... - findobj('Tag','edit_show1','Parent',gcf);... - findobj('Tag','edit_show2','Parent',gcf)]; - if lag==0 - set(h_axes,'Visible','off'),cla - set(h_show,'enable','off') - if m==2; - for k=1:length(MI) - out_str(k)={sprintf(repmat('%8.3f ±%6.3f ',1,2*length(MI)),reshape([MI(k,:);MI_sigma(k,:)],1,2*length(MI)))}; - end - else - for k=1:length(MI) - out_str(k)={sprintf(repmat('%8.3f ',1,length(MI)),MI(k,:))}; - end - end - h=uicontrol(props.text,... - 'Tag','mi_result',... - 'HorizontalAlignment', 'left',... - 'FontWeight', 'bold',... - 'String',['Mutual Information: ']); - ex=get(h,'Extent'); set(h,'Position',[11 21 ex(3:4)]); - h=uicontrol(props.listbox,... - 'Tag','mi_result',... - 'Position',[9 7 72.8333 3.0714],... - 'HorizontalAlignment', 'left',... - 'String',out_str); - ex1=get(h,'Extent'); if ex1(3)>75, ex1(3)=75; end - if m<=10 - set(h,'Position',[11 21-m*ex(4) ex1(3) ex1(4)*m]); - else - set(h,'Position',[11 21-10*ex(4) ex1(3) ex1(4)*10]); - end - - else - set(h_axes,'Visible','on'); tx=sprintf('%i|',1:m); - set(h_show(end-1:end),'String',tx(1:end-1)) - plot(0) - dimx=get(h_show(end-1),'Value'); - dimy=get(h_show(end),'Value'); - if m==2; - s1=[permute(MI(dimx,dimy,:),[3,1,2])+3*permute(MI_sigma(dimx,dimy,:),[3,1,2]); flipud(permute(MI(dimx,dimy,:),[3,1,2])-3*permute(MI_sigma(dimx,dimy,:),[3,1,2]))]'; - s3=[0:size(MI,3)-1, size(MI,3)-1:-1:0]; - if all(size(s3) == size(s1)) - patch(s3,s1,-10,'FaceColor',[.9 .9 1],'EdgeColor',[.85 .85 1]) - end - hold on - end - plot(0:size(MI,3)-1,permute(MI(dimx,dimy,:),[3,1,2])), grid on - xlabel('Lag'), ylabel('Mutual Information') - hold off - set(gca,'Tag','mi_axes','layer','top') - end - end - try, set(0,props.root), end + h_fig = findobj('Tag','MI_Fig'); + if ~isempty(h_fig) + + h=findobj('Tag','button_store','Parent',h_fig(1)); + if isempty(h), return, end + x=get(h(1),'UserData'); + MI=x{1}; if m==2; MI_sigma=x{2}; end + + set(0,'current',h_fig(1)) + h_axes=findobj('Tag','mi_axes','Parent',h_fig(1)); h_axes=h_axes(1); + h_res=findobj('Tag','mi_result','Parent',h_fig(1)); delete(h_res); + h_show=[findobj('Tag','text_show','Parent',h_fig(1));... + findobj('Tag','edit_show1','Parent',h_fig(1));... + findobj('Tag','edit_show2','Parent',h_fig(1))]; + if lag==0 + set(h_axes,'Visible','off'),cla + set(h_show,'enable','off') + if m==2; + for k=1:length(MI) + out_str(k)={sprintf(repmat('%8.3f ±%6.3f ',1,2*length(MI)),reshape([MI(k,:);MI_sigma(k,:)],1,2*length(MI)))}; + end + else + for k=1:length(MI) + out_str(k)={sprintf(repmat('%8.3f ',1,length(MI)),MI(k,:))}; + end + end + h=uicontrol(props.text,... + 'Tag','mi_result',... + 'HorizontalAlignment', 'left',... + 'FontWeight', 'bold',... + 'String',['Mutual Information: ']); + ex=get(h,'Extent'); set(h,'Position',[11 21 ex(3:4)]); + h=uicontrol(props.listbox,... + 'Tag','mi_result',... + 'Position',[9 7 72.8333 3.0714],... + 'HorizontalAlignment', 'left',... + 'String',out_str); + ex1=get(h,'Extent'); if ex1(3)>75, ex1(3)=75; end + if m<=10 + set(h,'Position',[11 21-m*ex(4) ex1(3) ex1(4)*m]); + else + set(h,'Position',[11 21-10*ex(4) ex1(3) ex1(4)*10]); + end + + else + set(h_axes,'Visible','on'); tx=sprintf('%i|',1:m); + set(h_show(end-1:end),'String',tx(1:end-1)) + plot(0) + dimx=get(h_show(end-1),'Value'); + dimy=get(h_show(end),'Value'); + if m==2; + s1=[permute(MI(dimx,dimy,:),[3,1,2])+3*permute(MI_sigma(dimx,dimy,:),[3,1,2]); flipud(permute(MI(dimx,dimy,:),[3,1,2])-3*permute(MI_sigma(dimx,dimy,:),[3,1,2]))]'; + s3=[0:size(MI,3)-1, size(MI,3)-1:-1:0]; + if all(size(s3) == size(s1)) + patch(s3,s1,-10,'FaceColor',[.9 .9 1],'EdgeColor',[.85 .85 1]) + end + hold on + end + plot(0:size(MI,3)-1,permute(MI(dimx,dimy,:),[3,1,2])), grid on + xlabel('Lag'), ylabel('Mutual Information') + hold off + set(gca,'Tag','mi_axes','layer','top','xlim',[0 lag]) + end + drawnow + try, set(0,props.root), end + end + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% the end case 'end' diff --git a/phasespace.m b/phasespace.m index 83057c025c309d0a278a03e913079ef505883802..1eb78b135300ae7669dff0cce246cafaf470dc34 100644 --- a/phasespace.m +++ b/phasespace.m @@ -21,7 +21,7 @@ function phasespace(varargin) % % Example: phasespace(cos(0:.1:32).*[321:-1:1]) % -% See also PSS. +% See also FNN, PSS. % % References: % Takens, F.: @@ -36,6 +36,9 @@ function phasespace(varargin) % $Revision$ % % $Log$ +% Revision 2.2 2006/02/14 11:46:15 marwan +% *** empty log message *** +% % Revision 2.1 2004/11/10 07:07:56 marwan % initial import % diff --git a/private/create_Ctrlfig.m b/private/create_Ctrlfig.m index 34dcda0cbbbf828a1d6471c5530f5016948a2e31..b627d27e74ec52a80beb4fc429e2b6404e56f044 100644 --- a/private/create_Ctrlfig.m +++ b/private/create_Ctrlfig.m @@ -10,6 +10,9 @@ function h_axes=create_Ctrlfig(programme,h,ds,m,t,e,method) % $Revision$ % % $Log$ +% Revision 4.10 2006/02/14 11:46:34 marwan +% *** empty log message *** +% % Revision 4.9 2005/03/16 12:21:30 marwan % add support for joint recurrence plots % @@ -30,143 +33,143 @@ global props scr=get(0,'ScreenSize'); h9=figure('Tag','CRPFig',... % Control Figure 'Position',[5*scr(3)/8+10 scr(4)/8 1*scr(3)/6 3*scr(4)/4 ],... - 'Color',props.window.Color,... + 'Color',props.window.Color,... 'NumberTitle','off',... - 'Name',['Control (' h ')'],... - 'MenuBar','None',... - 'DeleteFcn',[programme,' handlevisON'],... - 'BusyAction','cancel',... - 'Resize','Off'); + 'Name',['Control (' h ')'],... + 'MenuBar','None',... + 'DeleteFcn',[programme,' handlevisON'],... + 'BusyAction','cancel',... + 'Resize','Off'); set(h9,props.window,'Units','Norm') h0=uicontrol(props.frame, ... % Frame Embedding 'Units','Normalized',... - 'Position',[.1 .525 .8 .445]); + 'Position',[.1 .525 .8 .445]); h0=uicontrol(props.text,... % Text Embedding 'Units','Normalized', ... - 'FontAngle','italic', ... - 'Position',[.12 .939 .6 .02], ... - 'String','Embedding'); + 'FontAngle','italic', ... + 'Position',[.12 .939 .6 .02], ... + 'String','Embedding'); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h1(3) h1(4)]) h0=uicontrol(props.text,... % Text Dimension 'Units','Normalized',... - 'Tag','Dimtext',... - 'String','Dimension:',... - 'Position',[.16 .895 .35 .02]); + 'Tag','Dimtext',... + 'String','Dimension:',... + 'Position',[.16 .895 .35 .02]); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) if method==7, set(h0,'Enable','Off'); end h0=uicontrol(props.popup,... % Input Dimension 'Units','Normalized',... - 'Tag','Dim',... - 'String','1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20',... - 'Position',[.58 .9 .249 .026], ... - 'Value',m,... - 'UserData', ds,... - 'Callback',[programme,' fitdim'],... - 'ToolTip','Select the embedding dimension.'); + 'Tag','Dim',... + 'String','1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20',... + 'Position',[.58 .9 .249 .026], ... + 'Value',m,... + 'UserData', ds,... + 'Callback',[programme,' fitdim'],... + 'ToolTip','Select the embedding dimension.'); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) if method==7, set(h0,'Enable','Off'); end h0=uicontrol(props.text,... % Text Delay 'Units','Normalized',... - 'Tag','Delaytext',... - 'String','Delay:',... - 'Position',[.16 .847 .35 .02]); + 'Tag','Delaytext',... + 'String','Delay:',... + 'Position',[.16 .847 .35 .02]); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) if method==7, set(h0,'Enable','Off'); end h0=uicontrol(props.edit,... % Input Delay 'Units','Normalized',... - 'Tag','Delay',... - 'String',t,... - 'Position',[.58 .85 .249 .026],... - 'ToolTip','Insert the embedding delay time.'); + 'Tag','Delay',... + 'String',t,... + 'Position',[.58 .85 .249 .026],... + 'ToolTip','Insert the embedding delay time.'); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) if method==7, set(h0,'Enable','Off'); end h0=uicontrol(props.text,... % Text Vector Switching 'Units','Normalized',... - 'String','Vector Switching:',... - 'Position',[.16 .8 .6 .02]); + 'String','Vector Switching:',... + 'Position',[.16 .8 .6 .02]); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) for i=1:5, for j=1:4 % Input Vector Switching h0 = uicontrol(props.button,... 'Units','normalized', ... - 'Callback',[programme,' vectorswitch'], ... - 'Position',[.18+(j-1)*0.167 0.765-(i-1)*0.034 .14 0.028], ... - 'String',(i-1)*4+j, ... - 'ToolTip','Switch this vector.',... - 'Tag',['DimShift' num2str((i-1)*4+j)]); + 'Callback',[programme,' vectorswitch'], ... + 'Position',[.18+(j-1)*0.167 0.765-(i-1)*0.034 .14 0.028], ... + 'String',(i-1)*4+j, ... + 'ToolTip','Switch this vector.',... + 'Tag',['DimShift' num2str((i-1)*4+j)]); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) end, end for i=1:20 - if i>m, set(findobj('Tag',['DimShift' num2str(i)]), 'Enable', 'off'); + if i>m, set(findobj('Tag',['DimShift' num2str(i)]), 'Enable', 'off'); else, set(findobj('Tag',['DimShift' num2str(i)]), 'Enable', 'on'); end end h0=uicontrol(props.text,... % Text Copyright 'Units','Normalized',... - 'HorizontalAlignment','center',... - 'Position',[.15 .534 .7 .06]); + 'HorizontalAlignment','center',... + 'Position',[.15 .534 .7 .06]); h2=textwrap(h0,{[char(169),' AGNLD'],'University of Potsdam','1998-2006'}); set(h0,'String',h2) h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) h0=uicontrol(props.frame, ... % Frame Neighbourhood 'Units','Normalized',... - 'Position',[.1 .279 .8 .22]); + 'Position',[.1 .279 .8 .22]); h0=uicontrol(props.text,... % Text Neighbourhood 'Units','Normalized',... - 'FontAngle','italic', ... - 'String','Neighbourhood',... - 'Position',[.12 .466 .6 .02]); + 'FontAngle','italic', ... + 'String','Neighbourhood',... + 'Position',[.12 .466 .6 .02]); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h1(3) h1(4)]) h0=uicontrol(props.checkbox, ... % Button Unthresholded 'Units','Normalized',... - 'Position',[.16 .415 .51 .032], ... - 'String','Unthresholded', ... - 'CallBack',[programme,' unthresh'],... - 'Tag','Unthresh',... - 'ToolTip','Switch between thresholded and unthresholded CRP.' ); + 'Position',[.16 .415 .51 .032], ... + 'String','Unthresholded', ... + 'CallBack',[programme,' unthresh'],... + 'Tag','Unthresh',... + 'ToolTip','Switch between thresholded and unthresholded CRP.' ); if method==9, set(h0,'Value',1); end if method==7 | method==8, set(h0,'Enable','Off'); end h1=uicontrol(props.popup, ... % Button Unthresholded Scale 'Units','Normalized',... - 'Position',[.69 .415 .14 .032], ... - 'String','1|1/2|1/4|1/6|1/8', ... - 'Value',1,... - 'CallBack',[programme,' log'],... - 'Enable','off',... - 'Tag','Log',... - 'ToolTip','Switch between various scaled CRP.' ); + 'Position',[.69 .415 .14 .032], ... + 'String','1|1/2|1/4|1/6|1/8', ... + 'Value',1,... + 'CallBack',[programme,' log'],... + 'Enable','off',... + 'Tag','Log',... + 'ToolTip','Switch between various scaled CRP.' ); if method==9, set(h1,'Enable','On'); end h2=uicontrol(props.popup,... % Input Neighbourhood Method 'Units','Normalized',... - 'String','Maximum Norm|Euclidean Norm|Minimum Norm|Normalized Norm|Fixed Amount|Interdependent|Order Matrix|Order Pattern',... - 'Position',[.16 .363 .67 .032],... - 'Tag','Method',... - 'CallBack',[programme,' unthresh'],... - 'ToolTip','Select the method of finding neighbours.'); + 'String','Maximum Norm|Euclidean Norm|Minimum Norm|Normalized Norm|Fixed Amount|Interdependent|Order Matrix|Order Pattern',... + 'Position',[.16 .363 .67 .032],... + 'Tag','Method',... + 'CallBack',[programme,' unthresh'],... + 'ToolTip','Select the method of finding neighbours.'); if method==9, set(h2,'Enable','Off'); else, set(h2,'Value',method); end h0=uicontrol(props.text,... % Text Threshold 'Units','Normalized',... - 'Tag','Sizetext',... - 'String','Threshold:',... - 'Position',[.16 .311 .35 .02]); + 'Tag','Sizetext',... + 'String','Threshold:',... + 'Position',[.16 .311 .35 .02]); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) if method==9 | method==8, set(h0,'Enable','Off'); end @@ -174,10 +177,10 @@ global props h0=uicontrol(props.edit,... % Input Threshold 'Units','Normalized',... - 'Tag','Size',... - 'Position',[.58 .315 .249 .026],... - 'String',e,... - 'ToolTip','Insert the size of neighbourhood.' ); + 'Tag','Size',... + 'Position',[.58 .315 .249 .026],... + 'String',e,... + 'ToolTip','Insert the size of neighbourhood.' ); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) if method==9 | method==8, set(h0,'Enable','Off'); end @@ -185,50 +188,50 @@ global props if ~isunix h0=uicontrol(props.frame, ... % Frame Embedding 'Units','Normalized',... - 'Position',[.1 .21 .8 .045]); + 'Position',[.1 .21 .8 .045]); end h0=uicontrol(props.checkbox, ... % Checkbox Stretch Plot 'Units','Normalized',... - 'Position',[.1 .21 .8 .045], ... - 'String','Streched Plot', ... - 'Tag','Stretch',... - 'CallBack',[programme,' stretch'],... - 'Value',1,... - 'ToolTip','Streches the plotted CRP to a squared plot.' ); + 'Position',[.1 .21 .8 .045], ... + 'String','Streched Plot', ... + 'Tag','Stretch',... + 'CallBack',[programme,' stretch'],... + 'Value',1,... + 'ToolTip','Streches the plotted CRP to a squared plot.' ); h0=uicontrol(props.button, ... % Button Store Matrix 'Units','Normalized',... - 'Position',[.1 .15 .38 .045], ... - 'String','Store Matrix', ... - 'Tag','Store',... - 'CallBack',[programme,' store'],... - 'Value',1,... - 'ToolTip','Stores the CRP matrix into variable X in the workspace.' ); + 'Position',[.1 .15 .38 .045], ... + 'String','Store Matrix', ... + 'Tag','Store',... + 'CallBack',[programme,' store'],... + 'Value',1,... + 'ToolTip','Stores the CRP matrix into variable X in the workspace.' ); h0=uicontrol(props.button,... % Button Help 'Units','Normalized',... - 'String','Help',... - 'Position',[.52 .15 .38 .045],... - 'Tag','Help',... - 'Callback',['helpwin ',programme],... - 'ToolTip','Opens the helpwindow.'); + 'String','Help',... + 'Position',[.52 .15 .38 .045],... + 'Tag','Help',... + 'Callback',['helpwin ',programme],... + 'ToolTip','Opens the helpwindow.'); h0=uicontrol(props.button,... % Button Apply 'Units','Normalized',... - 'String','Apply',... - 'Position',[.1 .09 .8 .045],... - 'Tag','Apply',... - 'Callback',[programme,' compute'],... - 'ToolTip','Starts the computation - be patient.'); + 'String','Apply',... + 'Position',[.1 .09 .8 .045],... + 'Tag','Apply',... + 'Callback',[programme,' compute'],... + 'ToolTip','Starts the computation - be patient.'); h0=uicontrol(props.button,... % Button Close 'Units','Normalized',... - 'String','Close',... - 'Position',[.1 .03 .8 .045],... - 'Tag','Close',... - 'BusyAction','cancel',... - 'Callback',[programme,' close'],... - 'ToolTip','Closes CRP windows.'); + 'String','Close',... + 'Position',[.1 .03 .8 .045],... + 'Tag','Close',... + 'BusyAction','cancel',... + 'Callback',[programme,' close'],... + 'ToolTip','Closes CRP windows.'); set(h9, 'HandleVis','CallBack') diff --git a/private/crp_plugin.m b/private/crp_plugin.m index 0c3c6192c6a2f013f98971732522dfa71b5a2159..268d3a0fa1109bf303138b64c637e7f1dabbb5fb 100644 --- a/private/crp_plugin.m +++ b/private/crp_plugin.m @@ -2,7 +2,7 @@ function [X, matext] = crp_plugin(x, y, m, t, e, mflag, hCRP, plugin_path, silen % CRP_PLUGIN Loads and executes the extern plugin % Used by CRP Toolbox -% Copyright (c) 2005 by AMRON +% Copyright (c) 2005-2006 by AMRON % Norbert Marwan, Potsdam University, Germany % http://www.agnld.uni-potsdam.de % @@ -10,6 +10,9 @@ function [X, matext] = crp_plugin(x, y, m, t, e, mflag, hCRP, plugin_path, silen % $Revision$ % % $Log$ +% Revision 4.4 2006/02/14 11:46:53 marwan +% dimension and delay for plugin released +% % Revision 4.3 2006/02/06 14:44:36 marwan % plugin support for order patterns % @@ -37,23 +40,30 @@ try tmp_rpdatafile = tempname; if ~silent, set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Export Data'),drawnow, end save(tmp_xdatafile,'x','-ascii','-tabs'); - save(tmp_ydatafile,'y','-ascii','-tabs'); + if ~isequal(x,y), save(tmp_ydatafile,'y','-ascii','-tabs'); end - % call extern rp programme + % prepare the arguments for the external plugin if ~silent, set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Compute Recurrence Points'),drawnow, end m_str = {'MAX', 'EUC', 'MIN', 'NR', 'FAN', 'IN', 'OM', 'OP', 'EUC'}; dis_sign = 1; if mflag == 9, dis_sign = -1; end - system([plugin_path,filesep,rp_plugin,' -m ',num2str(m), ... + unix_str = [plugin_path,filesep,rp_plugin,' -m ',num2str(m), ... ' -t ',num2str(t), ... ' -e ',num2str(dis_sign * e), ... ' -n ',m_str{mflag}, ... ' -w ',num2str(0), ... - ' -i ',tmp_xdatafile, ... - ' -j ',tmp_ydatafile, ... - ' -r ',tmp_rpdatafile, ... + ' -i ',tmp_xdatafile]; + if ~isequal(x,y) + unix_str = [unix_str,' -j ',tmp_ydatafile]; + end + + unix_str = [unix_str,' -r ',tmp_rpdatafile, ... ' -f TIF', ... - ' -s']); + ' -s']; + + % call the external plugin + system(unix_str); + % import rp if ~silent, set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Import Recurrence Points'),drawnow, end X = imread(tmp_rpdatafile); @@ -61,7 +71,7 @@ try delete(tmp_rpdatafile); delete(tmp_xdatafile); - delete(tmp_ydatafile); + if ~isequal(x,y), delete(tmp_ydatafile); end if ~silent, set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Plot Recurrence Points'),drawnow, end diff --git a/private/show_crp.m b/private/show_crp.m index 570b74e508b7e464b4970f952f0cded85520dae7..f18ae5a7451684fcfcba69311ead183d81c467db 100644 --- a/private/show_crp.m +++ b/private/show_crp.m @@ -10,6 +10,9 @@ function show_crp(X,Shuttle) % $Revision$ % % $Log$ +% Revision 4.10 2005/04/15 09:03:03 marwan +% minor bugfix in plugin section +% % Revision 4.9 2005/04/08 09:51:46 marwan % plugin added % @@ -45,7 +48,10 @@ NY=size(X,1); case {1,2,3,4,5,6,7,8} errcode=12; - set(findobj('Tag','CRPData','Parent',findobj('Parent',Shuttle.hCRP,'Tag','CRPPlot')),'visible','on','xdata',Shuttle.xscale(1:NX),... + set(findobj('Tag','CRPData',... + 'Parent',findobj('Parent',Shuttle.hCRP,'Tag','CRPPlot')),... + 'visible','on',... + 'xdata',Shuttle.xscale(1:NX),... 'ydata',Shuttle.yscale(1:NY),... 'cdata',uint8(X),'UserData',X) set(Shuttle.hCRP,'colormap',flipud(gray(2)))