changeset 37:beb8a3f4a345

Renamed prefs to options throughout.
author samer
date Mon, 28 Jan 2013 10:52:11 +0000
parents 9e7be347b3a0
children 9d24b616bb06
files arrows/@agraph/agraph.m arrows/@ainfig/ainfig.m arrows/@arr/arr.m arrows/@arrf/arrf.m arrows/@auinum/auinum.m arrows/@emousepos/emousepos.m arrows/@esender/esender.m arrows/@imager/imager.m arrows/@mousepos/mousepos.m arrows/@plotter/plotter.m arrows/@rgbimager/rgbimager.m arrows/@scatterer/scatterer.m arrows/@vplotter/vplotter.m arrows/additive_split.m arrows/alinein.m arrows/arrow_repl.m arrows/arrow_sched.m arrows/audio_bench.m arrows/audio_bench1.m arrows/audio_norm.m arrows/audioin.m arrows/audioout.m arrows/audioplay.m arrows/audiorec.m arrows/azeromean.m arrows/dsp/alpc.m arrows/dsp/amelceps.m arrows/dsp/amelspec.m arrows/dsp/aspectrum.m arrows/mscaler.m arrows/stats/afitgauss.m arrows/stats/ahistimg.m arrows/stats/ahistplot.m arrows/stats/aica.m arrows/stats/apca.m arrows/stats/appca.m arrows/stats/nica.m arrows/stats/nica_nn.m arrows/ugather.m arrows/uiter.m arrows/uiterate.m arrows/umgather.m arrows/vecedit.m arrows/with_arrow.m audio/@linein/linein.m audio/@lineout/lineout.m audio/@mp3data/mp3data.m audio/@sndstream/sndstream.m audio/@wavsink/wavsink.m audio/mp3enc.m audio/oggenc.m audio/playaudio.m audio/playaudio_unfold.m audio/sndread.m dsp/specgrm.m dsp/synth/audio_sonifier.m dsp/synth/noodle.m dsp/synth/sonify.m dsp/synth/sonify_disc.m dsp/synth/sonify_formant.m dsp/wienerfilt.m general/algo/gatherer.m general/algo/iterate.m general/algo/iterate_gui.m general/algo/iterate_timed.m general/algo/pauser.m general/arrutils/order.m general/cellutils/cscanl.m general/fileutils/listfiles.m general/funutils/@function_handle/decorate.m general/funutils/groupby.m general/funutils/scanner_add_plotter.m general/getparam.m general/numerical/fixpoint.m general/options.m sched/rsched.m sched/schedrec.m sched/timed_action.m sequences/+seq/windower.m sequences/@seq/foldl.m sequences/@seq/gathern.m sequences/@seq/limit.m sequences/@seq/meandata.m sequences/@seq/seq.m sequences/framedata.m sequences/rndwindow.m signals/resamplex.m signals/transfer.m sinks/@sink/supply.m
diffstat 89 files changed, 134 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/arrows/@agraph/agraph.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@agraph/agraph.m	Mon Jan 28 10:52:11 2013 +0000
@@ -14,7 +14,7 @@
 %
 % This class is no use instantiated directly. Should be subclassed.
 function o=agraph(nin,varargin)
-	s.opts=prefs('fig',[],'name','','autoflush',0,varargin{:});
+	s.opts=options('fig',[],'name','','autoflush',0,varargin{:});
 	if isempty(s.opts.fig), warning('agraph requires figure'); end
 	o=class(s,'agraph',arrow(nin,0));
 end
--- a/arrows/@ainfig/ainfig.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@ainfig/ainfig.m	Mon Jan 28 10:52:11 2013 +0000
@@ -12,7 +12,7 @@
 
 function o=ainfig(fig,fn,varargin)
 	s.fn=fn;
-	s.opts=prefs('fig',fig,'ylim',[],'xlim',[],'colormap',[],varargin{:});
+	s.opts=options('fig',fig,'ylim',[],'xlim',[],'colormap',[],varargin{:});
 	o=class(s,'ainfig',agraph(1,s.opts));
 end
 
--- a/arrows/@arr/arr.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@arr/arr.m	Mon Jan 28 10:52:11 2013 +0000
@@ -23,7 +23,7 @@
 
 function o=arr(fn,varargin)
 	if nargin==0, fn=@id; end
-	opts=prefs('nargin',[],'nargout',[],'sizefn',[],varargin{:});
+	opts=options('nargin',[],'nargout',[],'sizefn',[],varargin{:});
 	if isempty(opts.nargin), opts.nargin=nargin(fn); end
 	if isempty(opts.nargout), opts.nargout=nargout(fn); end
 	if opts.nargout<0, opts.nargout=1; end % assume 1 if we can't tell
--- a/arrows/@arrf/arrf.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@arrf/arrf.m	Mon Jan 28 10:52:11 2013 +0000
@@ -11,6 +11,6 @@
 % the state of an arr arrow is always an empty matrix.
 
 function o=arrf(ffn,nin,nout,varargin)
-	opts=prefs('sizefn',[],varargin{:});
+	opts=options('sizefn',[],varargin{:});
 	o=class(struct('fn',ffn,'sizefn',opts.sizefn),'arrf',arrow(nin,nout));
 end
--- a/arrows/@auinum/auinum.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@auinum/auinum.m	Mon Jan 28 10:52:11 2013 +0000
@@ -9,7 +9,7 @@
 
 function o=auinum(x0,varargin)
 	s.x0=x0;
-	s.opts=prefs('fig',[],varargin{:});
+	s.opts=options('fig',[],varargin{:});
 	if isempty(s.opts.fig), s.opts.fig=gcf; end
 	o=class(s,'auinum',arrow(0,1));
 end
--- a/arrows/@emousepos/emousepos.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@emousepos/emousepos.m	Mon Jan 28 10:52:11 2013 +0000
@@ -13,7 +13,7 @@
 % the last mouse-move event in the current time-slice.
 
 function o=mousepos(varargin)
-	s.opts=prefs('fig',[],'xlim',[],'ylim',[],varargin{:});
+	s.opts=options('fig',[],'xlim',[],'ylim',[],varargin{:});
 	if isempty(s.opts.fig), s.opts.fig=gcf; end
 	o=class(s,'emousepos',arrow(0,1));
 end
--- a/arrows/@esender/esender.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@esender/esender.m	Mon Jan 28 10:52:11 2013 +0000
@@ -11,7 +11,7 @@
 % coordinates.
 
 function o=esender(varargin)
-	s.opts=prefs('fig',[],'init','','title','','name','',varargin{:});
+	s.opts=options('fig',[],'init','','title','','name','',varargin{:});
 	if isempty(s.opts.fig), s.opts.fig=gcf; end
 	o=class(s,'esender',arrow(0,1));
 end
--- a/arrows/@imager/imager.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@imager/imager.m	Mon Jan 28 10:52:11 2013 +0000
@@ -20,7 +20,7 @@
 % the handle graphics object returned by the imaging function.
 
 function o=imager(varargin)
-	s.opts=prefs('dlim',[],'xlim',[],'ylim',[],'clim',[],'colormap',[],'imagefn',@imagexy,'args',{},varargin{:});
+	s.opts=options('dlim',[],'xlim',[],'ylim',[],'clim',[],'colormap',[],'imagefn',@imagexy,'args',{},varargin{:});
 	if isempty(s.opts.clim), s.opts.clim=s.opts.dlim; end
 	o=class(s,'imager',agraph(1,s.opts));
 end
--- a/arrows/@mousepos/mousepos.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@mousepos/mousepos.m	Mon Jan 28 10:52:11 2013 +0000
@@ -13,7 +13,7 @@
 % coordinates.
 
 function o=mousepos(varargin)
-	s.opts=prefs('fig',[],'xlim',[],'ylim',[],varargin{:});
+	s.opts=options('fig',[],'xlim',[],'ylim',[],varargin{:});
 	if isempty(s.opts.fig), s.opts.fig=gcf; end
 	o=class(s,'mousepos',arrow(0,1));
 end
--- a/arrows/@plotter/plotter.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@plotter/plotter.m	Mon Jan 28 10:52:11 2013 +0000
@@ -16,7 +16,7 @@
 % the handle graphics object returned by the plotting function.
 
 function o=plotter(varargin)
-	s.opts=prefs('dlim',[],'dom',[],'ylim',[],'xlim',[],'plotfn',@plot,'args',{},'transpose',0,varargin{:});
+	s.opts=options('dlim',[],'dom',[],'ylim',[],'xlim',[],'plotfn',@plot,'args',{},'transpose',0,varargin{:});
 	if isempty(s.opts.ylim), s.opts.ylim=s.opts.dlim; end
 	o=class(s,'plotter',agraph(1,s.opts));
 end
--- a/arrows/@rgbimager/rgbimager.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@rgbimager/rgbimager.m	Mon Jan 28 10:52:11 2013 +0000
@@ -14,7 +14,7 @@
 % the handle graphics object returned by the imaging function.
 
 function o=imager(varargin)
-	s.opts=prefs('xlim',[],'ylim',[],'args',{},varargin{:});
+	s.opts=options('xlim',[],'ylim',[],'args',{},varargin{:});
 	o=class(s,'rgbimager',agraph(1,s.opts));
 end
 
--- a/arrows/@scatterer/scatterer.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@scatterer/scatterer.m	Mon Jan 28 10:52:11 2013 +0000
@@ -11,7 +11,7 @@
 % scatterer is an arrow which displays input on scatter (xy) plot.
 
 function o=scatterer(varargin)
-	s.opts=prefs('xlim',[],'ylim',[],'zlim',[],'scatfn',@scat,'args',{},varargin{:});
+	s.opts=options('xlim',[],'ylim',[],'zlim',[],'scatfn',@scat,'args',{},varargin{:});
 	o=class(s,'scatterer',agraph(1,s.opts));
 end
 
--- a/arrows/@vplotter/vplotter.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/@vplotter/vplotter.m	Mon Jan 28 10:52:11 2013 +0000
@@ -15,7 +15,7 @@
 % the handle graphics object returned by the plotting function.
 
 function o=vplotter(varargin)
-	s.opts=prefs('ylim',[],'xlim',[],'plotfn',@plot,'args',{},varargin{:});
+	s.opts=options('ylim',[],'xlim',[],'plotfn',@plot,'args',{},varargin{:});
 	o=class(s,'vplotter',agraph(1,s.opts));
 end
 
--- a/arrows/additive_split.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/additive_split.m	Mon Jan 28 10:52:11 2013 +0000
@@ -12,7 +12,7 @@
 % the two supplied arrows and added together to create the output.
 
 function o=additive_split(a1,a2,varargin)
-	opts=prefs(varargin{:});
+	opts=options(varargin{:});
 
 	o = states(azeromean(gaussian,opts))*(a1+a2)*aplus;
 end
--- a/arrows/alinein.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/alinein.m	Mon Jan 28 10:52:11 2013 +0000
@@ -14,6 +14,6 @@
 % Default buffer size is N+M*opts.width for low latency.
 
 function a=linein(rate,block,hop,varargin)
-	opts=prefs('channels',1,'width',1,varargin{:});
+	opts=options('channels',1,'width',1,varargin{:});
 	opts.bufsize=getparam(opts,'bufsize',block+hop*opts.width);
 	a=audioin(linesource(opts.channels,rate,opts),block,hop,opts.width);
--- a/arrows/arrow_repl.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/arrow_repl.m	Mon Jan 28 10:52:11 2013 +0000
@@ -31,7 +31,7 @@
 
 
 function varargout=arrow_repl(sys,sizes_in,varargin)
-	opts = prefs('gui',0,varargin{:});
+	opts = options('gui',0,varargin{:});
 	[varargout{1:nargout}]=with_arrow(sys,@unit_repl,sizes_in,opts,'keyboard',0,'pause',0);
 
 	function varargout=unit_repl(unit)
--- a/arrows/arrow_sched.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/arrow_sched.m	Mon Jan 28 10:52:11 2013 +0000
@@ -40,7 +40,7 @@
 % number of outputs--these are all discarded while running.
 
 function varargout=arrow_sched(sys,period,varargin)
-	opts=prefs('sched_fig',0,'draw',0,'exec_mode','fixedSpacing','start',0,varargin{:});
+	opts=options('sched_fig',0,'draw',0,'exec_mode','fixedSpacing','start',0,varargin{:});
 	[varargout{1:nargout}]=with_arrow(sys,@with_sched,{},opts,'keyboard',0);
 
 	function varargout=with_sched(unit)
--- a/arrows/audio_bench.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/audio_bench.m	Mon Jan 28 10:52:11 2013 +0000
@@ -38,7 +38,7 @@
 % from audio_bench.
 
 function [o,path,r]=audio_bench(N,M,filelist,a,varargin)
-	opts=prefs('fs',22050,'period',0.003,'outbuf',3,'run',0,'start',1,'output',1, ...
+	opts=options('fs',22050,'period',0.003,'outbuf',3,'run',0,'start',1,'output',1, ...
 					'scope',0,'state',[],'batch',1,'liveaudio',0,'playthru',0,'draw',1,varargin{:});
 
 	if opts.scope>0
--- a/arrows/audio_bench1.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/audio_bench1.m	Mon Jan 28 10:52:11 2013 +0000
@@ -38,7 +38,7 @@
 % from audio_bench.
 
 function [o,path]=audio_bench(N,M,filelist,a,varargin)
-	opts=prefs('fs',22050,'batch',1,'liveaudio',0,varargin{:});
+	opts=options('fs',22050,'batch',1,'liveaudio',0,varargin{:});
 
 	fprintf('Creating audio source with %d files.\n',length(filelist));
 	if opts.liveaudio
--- a/arrows/audio_norm.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/audio_norm.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,6 +1,6 @@
 % audio_norm - Arrow to do audio loudness normalisation using arbitrary estimator
 function o= audio_norm(src,fs,N,M,W,Lag,dynorm,varargin)
-	opts=prefs('spectra',1,'lim',[-6,-1],'play',0,varargin{:});
+	opts=options('spectra',1,'lim',[-6,-1],'play',0,varargin{:});
 
 	if opts.spectra, 
 		spectra=@(f,clim)obs_with(aspectrum(N)*arr(@log10)*imager('clim',clim,'fig',f));
--- a/arrows/audioin.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/audioin.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,4 +1,4 @@
 function o=audioin(ch,rate,N,M,varargin), 
 	if nargin<4, M=N; end
-	opts=prefs('width',1,varargin{:});
+	opts=options('width',1,varargin{:});
 	o=abufsig(linein(ch,rate,opts),N,M,opts.width);
--- a/arrows/audioout.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/audioout.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,3 +1,3 @@
 function o=audioout(ch,rate,varargin), 
-	opts=prefs('window',[],varargin{:});
+	opts=options('window',[],varargin{:});
 	o=abufsink(lineout(ch,rate,'pad',ceil(0.2*rate),opts),opts.window);
--- a/arrows/audioplay.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/audioplay.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,6 +1,6 @@
 function a=audioplay(ch,rate,window,varargin)
 	if nargin<3, window=[]; end
-	opts=prefs('buffer',1,'queue',4,'dspargs',{},varargin{:});
+	opts=options('buffer',1,'queue',4,'dspargs',{},varargin{:});
 
 	a=asysobj(@(sz)dsp.AudioPlayer(rate,'BufferSizeSource','Property', ...
 					'BufferSize',   opts.buffer*sz{1}(1), ...
--- a/arrows/audiorec.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/audiorec.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,6 +1,6 @@
 function a=audiorec(ch,rate,N,M,varargin)
 	if nargin<4, M=N; end
-	opts=prefs('buffer',1,'queue',4,'dspargs',{},varargin{:});
+	opts=options('buffer',1,'queue',4,'dspargs',{},varargin{:});
 
 	a=asysobj(@(sz)dsp.AudioRecorder('OutputDataType','double','NumChannels',ch,'SampleRate',rate, ...
 					'SamplesPerFrame',M,'BufferSizeSource','Property', ...
--- a/arrows/azeromean.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/azeromean.m	Mon Jan 28 10:52:11 2013 +0000
@@ -9,7 +9,7 @@
 % -> arrow({[[N]]},{[[N]]},azeromean_state).
 
 function o=azeromean(model,varargin)
-	opts=prefs('offset',nan,'rate',1e-7,'tension',0,varargin{:});
+	opts=options('offset',nan,'rate',1e-7,'tension',0,varargin{:});
 	score=scorefn(model);
 
 	rate=opts.rate;
--- a/arrows/dsp/alpc.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/dsp/alpc.m	Mon Jan 28 10:52:11 2013 +0000
@@ -10,7 +10,7 @@
 % -> arrow({[[N,1]]},{[[M,1]]},empty).
 
 function o=alpc(N,M,varargin)
-	opts=prefs('window',@hanning,'nargout',1,varargin{:});
+	opts=options('window',@hanning,'nargout',1,varargin{:});
 	w=spdiag(opts.window(N));
 	if opts.nargout<=1
 		o=arr(@fn);
--- a/arrows/dsp/amelceps.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/dsp/amelceps.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,6 +1,6 @@
 % melceps - arrow from audio to log mel cepstrum (MFCCs)
 function o=melceps(N,M,L,fs,varargin)
-	opts=prefs('norm_rate',1e-6,'plot_melspec',1,'lowf',100,varargin{:});
+	opts=options('norm_rate',1e-6,'plot_melspec',1,'lowf',100,varargin{:});
 	if opts.plot_melspec, 
 		mp=obs_with(imgtrace(256,'fig',9,'clim',[-20,20])); 
 		figure(9); colormap(bipolar1);
--- a/arrows/dsp/amelspec.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/dsp/amelspec.m	Mon Jan 28 10:52:11 2013 +0000
@@ -13,7 +13,7 @@
 % Uses antialiased triangular filterbank from lowf to fs/2.
 
 function o=amelspec(N,M,fs,varargin)
-	opts=prefs('windowfn',@hanning,'lowf',100,'floor',5e-9,varargin{:});
+	opts=options('windowfn',@hanning,'lowf',100,'floor',5e-9,varargin{:});
 	melW = lin2mel(N,fs,[opts.lowf,fs/2],M);
 	noise_floor=opts.floor;
 	o = apowspec(opts.windowfn(N))*arr(@cc);
--- a/arrows/dsp/aspectrum.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/dsp/aspectrum.m	Mon Jan 28 10:52:11 2013 +0000
@@ -9,7 +9,7 @@
 % -> arrow({[[N,T]]},{[[dftbins(N),T]]},empty).
 
 function o=aspectrum(N,varargin)
-	opts=prefs('specfn',@powspec,'window',@hanning,varargin{:});
+	opts=options('specfn',@powspec,'window',@hanning,varargin{:});
 	specfn=opts.specfn;
 	w=spdiag(opts.window(N));
 	o=arr(@fn);
--- a/arrows/mscaler.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/mscaler.m	Mon Jan 28 10:52:11 2013 +0000
@@ -12,7 +12,7 @@
 % -> arrow({[[N]]},{[[N]]},mscaler_state).
 
 function o=mscaler(model,varargin)
-	opts=prefs('scale',1,'offset',0, ...
+	opts=options('scale',1,'offset',0, ...
 		'scale_rate',0.02,'offset_rate',1e-7,'batch',4, ...
 		'nargout', 1, ...
 		varargin{:});
--- a/arrows/stats/afitgauss.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/stats/afitgauss.m	Mon Jan 28 10:52:11 2013 +0000
@@ -15,7 +15,7 @@
 
 function o=afitgauss(L,varargin)
 
-	opts=prefs('zeromean',0,varargin{:});
+	opts=options('zeromean',0,varargin{:});
 
 	GMM=gmm;
 	%K=L/(L+1);
--- a/arrows/stats/ahistimg.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/stats/ahistimg.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,5 +1,5 @@
 function o=ahistimg(map,varargin)
-	opts=prefs('log',false,'period',1,'memory',inf,varargin{:});
+	opts=options('log',false,'period',1,'memory',inf,varargin{:});
 	o=estates(ahist(map,opts.memory),opts.period);
 	if opts.log, 
 		p=arr(@(t)log(t+1))*imager('xdom',centres(map),opts);
--- a/arrows/stats/ahistplot.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/stats/ahistplot.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,5 +1,5 @@
 function o=ahistplot(map,varargin)
-	opts=prefs('log',false,'period',1,'memory',inf,varargin{:});
+	opts=options('log',false,'period',1,'memory',inf,varargin{:});
 	o=estates(ahist(map,opts.memory),opts.period);
 	if opts.log, p=arr(@(t)log(t'));
 	else p=arr(@transpose); end
--- a/arrows/stats/aica.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/stats/aica.m	Mon Jan 28 10:52:11 2013 +0000
@@ -9,7 +9,7 @@
 % -> arrow({[[N]]},{[[N]]},aica_state).
 
 function o=aica(model,W0,varargin)
-	opts=prefs('rate',1e-4,varargin{:});
+	opts=options('rate',1e-4,varargin{:});
 	score=scorefn(model);
 
 	rate=opts.rate;
--- a/arrows/stats/apca.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/stats/apca.m	Mon Jan 28 10:52:11 2013 +0000
@@ -11,7 +11,7 @@
 % -> arrow({[[N]]},{[[M]]},apca_state).
 
 function o=apca(W0,varargin)
-	opts=prefs('rate',1e-7,'ordered',1,'subsample',1,'plotfig',0,varargin{:});
+	opts=options('rate',1e-7,'ordered',1,'subsample',1,'plotfig',0,varargin{:});
 
 	rate=opts.rate;
 	if opts.ordered
--- a/arrows/stats/appca.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/stats/appca.m	Mon Jan 28 10:52:11 2013 +0000
@@ -13,7 +13,7 @@
 
 function o=appca(W0,varargin)
 	[N,M]=size(W0);
-	opts=prefs('rate',0.0001,'subsample',1,'plotfig',0,'zeromean',1,varargin{:});
+	opts=options('rate',0.0001,'subsample',1,'plotfig',0,'zeromean',1,varargin{:});
 	switch opts.plottype
 		case 'plot', eigplot=@plotter;
 		case 'image', eigplot=@imager;
--- a/arrows/stats/nica.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/stats/nica.m	Mon Jan 28 10:52:11 2013 +0000
@@ -4,7 +4,7 @@
 
 function o=nica(A0,varargin)
 	[N,M] = size(A0);
-	opts=prefs('rate',0.005,'dwa_thresh',0.01,'batch',N, ...
+	opts=options('rate',0.005,'dwa_thresh',0.01,'batch',N, ...
 		'train', 1, ...
 		'noise_std', 1, ...
 		'qpopts',{}, ...
--- a/arrows/stats/nica_nn.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/stats/nica_nn.m	Mon Jan 28 10:52:11 2013 +0000
@@ -4,7 +4,7 @@
 
 function o=nica_nn(A0,varargin)
 	[N,M] = size(A0);
-	opts=prefs('rate',0.005,'dwa_thresh',0.01,'batch',N, ...
+	opts=options('rate',0.005,'dwa_thresh',0.01,'batch',N, ...
 		'train', 1, ...
 		'noise_std', 1, ...
 		'qpopts',{}, ...
--- a/arrows/ugather.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/ugather.m	Mon Jan 28 10:52:11 2013 +0000
@@ -18,7 +18,7 @@
 % requested, the system is run until an EOF exception is caught.
 
 function X=ugather(u,its,varargin)
-	opts=prefs('expand',1,varargin{:});
+	opts=options('expand',1,varargin{:});
 	if opts.expand && isinf(its)
 		X=zeros(u.sizes_out{1}(1),32); % initial size is arbitrarily 32
 		done=uiter(u,its,@gatherxx,[],'label','ugather',opts);
--- a/arrows/uiter.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/uiter.m	Mon Jan 28 10:52:11 2013 +0000
@@ -23,7 +23,7 @@
 % rethrowing the exception.
 
 function [itsdone,state]=uiter(u,its,nextfn,state,varargin)
-	opts=prefs('label','uiter','draw',1,'quiet',0,'chunk',1,varargin{:});
+	opts=options('label','uiter','draw',1,'quiet',0,'chunk',1,varargin{:});
 	quiet=opts.quiet; draw=opts.draw;
 	chunk=opts.chunk;
 	u.starting();
--- a/arrows/uiterate.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/uiterate.m	Mon Jan 28 10:52:11 2013 +0000
@@ -20,7 +20,7 @@
 end
 
 function itsdone=uiter1(u,its,itfn,varargin)
-	opts=prefs('draw',1,'quiet',0,'chunk',1,varargin{:});
+	opts=options('draw',1,'quiet',0,'chunk',1,varargin{:});
 	quiet=opts.quiet; draw=opts.draw;
 	chunk=opts.chunk;
 	u.starting();
--- a/arrows/umgather.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/umgather.m	Mon Jan 28 10:52:11 2013 +0000
@@ -17,7 +17,7 @@
 % requested, the system is run until an EOF exception is caught.
 
 function varargout=umgather(u,its,varargin)
-	opts=prefs('draw',0,varargin{:});
+	opts=options('draw',0,varargin{:});
 	nout=length(u.sizes_out);
 	gatherers=map(@(sz)gatherer(sz,opts),u.sizes_out);
 	if opts.draw, dfn=@drawnow; else dfn=@nop; end
--- a/arrows/vecedit.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/vecedit.m	Mon Jan 28 10:52:11 2013 +0000
@@ -10,7 +10,7 @@
 % vecedit takes all options accepted by emousepos and plotter.
 function o=vecedit(x0,varargin)
 	N=length(x0); x0=x0(:);
-	opts=prefs(varargin{:});
+	opts=options(varargin{:});
 	o = emousepos(opts) * erate(loop(@edit,@(z)x0) * obs_with(plotter(opts)),{[2,1]}) * alatch(x0);
 
 	function [f,g]=edit(m,f)
--- a/arrows/with_arrow.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/arrows/with_arrow.m	Mon Jan 28 10:52:11 2013 +0000
@@ -25,7 +25,7 @@
 
 
 function varargout=with_arrow(sys,cmd,sizes_in,varargin)
-	opts=prefs('pause',0,'gui',0,'keyboard',0,varargin{:});
+	opts=options('pause',0,'gui',0,'keyboard',0,varargin{:});
 	ud.figs=[];
 	ud.arrows={};
 	set(0,'UserData',ud);
--- a/audio/@linein/linein.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/audio/@linein/linein.m	Mon Jan 28 10:52:11 2013 +0000
@@ -14,7 +14,7 @@
 	methods
 		function s=linein(channels,rate,varargin)
 			s=s@sigbase(channels,rate);
-			s.opts = prefs('bufsize',0,'bits',16,varargin{:});
+			s.opts = options('bufsize',0,'bits',16,varargin{:});
 		end
 		function c=tostring(sig), c='linein'; end
 
--- a/audio/@lineout/lineout.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/audio/@lineout/lineout.m	Mon Jan 28 10:52:11 2013 +0000
@@ -15,7 +15,7 @@
 	end
 	methods
 		function s=lineout(channels,rate,varargin)
-			s.opts = prefs('bufsize',0,'bits',16,'pad',0,varargin{:});
+			s.opts = options('bufsize',0,'bits',16,'pad',0,varargin{:});
 			s.chans=channels;
 			s.fs=rate;
 		end
--- a/audio/@mp3data/mp3data.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/audio/@mp3data/mp3data.m	Mon Jan 28 10:52:11 2013 +0000
@@ -17,7 +17,7 @@
 		function a=mp3data(fn,varargin)
 			fprintf('reading MP3 header...');
 			[sz,fs] = mp3read(fn,'size');
-			opts=prefs('rate',fs,'mono',0,varargin{:});
+			opts=options('rate',fs,'mono',0,varargin{:});
 
 			% first extra argument is whether or not we want mono
 			mp3args={opts.mono};
--- a/audio/@sndstream/sndstream.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/audio/@sndstream/sndstream.m	Mon Jan 28 10:52:11 2013 +0000
@@ -22,7 +22,7 @@
 	end
 	methods
 		function s=sndstream(streamfn,varargin)
-			opts=prefs('channels',nan,'rate',nan,'bits',16, ...
+			opts=options('channels',nan,'rate',nan,'bits',16, ...
 						  'stringfn',@()sprintf('sndstream(%s)',tostring(streamfn)), ...
 						  varargin{:});
 
--- a/audio/@wavsink/wavsink.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/audio/@wavsink/wavsink.m	Mon Jan 28 10:52:11 2013 +0000
@@ -23,7 +23,7 @@
 
 	methods
 		function s=wavsink(ch,rate,streamfn,stringfn,varargin)
-			opts=prefs('bits',16,varargin{:});
+			opts=options('bits',16,varargin{:});
 			s.streamfn=streamfn;
 			s.stringfn=stringfn;
 			s.format=audio_format(ch,rate,opts.bits);
--- a/audio/mp3enc.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/audio/mp3enc.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,3 +1,3 @@
 function s=mp3enc(ch,rate,file,varargin)
-	opts=prefs('quality',5,varargin{:});
+	opts=options('quality',5,varargin{:});
 	s=pipesink(ch,rate,sprintf('lame -h -V %d - "%s"',opts.quality,file));
--- a/audio/oggenc.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/audio/oggenc.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,3 +1,3 @@
 function s=oggenc(ch,rate,file,varargin)
-	opts=prefs('quality',5,varargin{:});
+	opts=options('quality',5,varargin{:});
 	s=pipesink(ch,rate,sprintf('oggenc -q %d -o "%s" -',opts.quality,file));
--- a/audio/playaudio.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/audio/playaudio.m	Mon Jan 28 10:52:11 2013 +0000
@@ -30,7 +30,7 @@
 %
 % All options get passed to iterator too, so those options apply.
 
-	opts=prefs('pause',0,'iterator',@iterate,varargin{:});
+	opts=options('pause',0,'iterator',@iterate,varargin{:});
 	it=feval(getparam(opts,'hook',@id),{@playbuf,Y});
 	maxbuf=getparam(opts,'maxbuf',size(Y,2));
 	sync_delta=getparam(opts,'sync_delta',0.005);
--- a/audio/playaudio_unfold.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/audio/playaudio_unfold.m	Mon Jan 28 10:52:11 2013 +0000
@@ -43,7 +43,7 @@
 % NB: the rewind function should only be called when the timer is stopped.
 
 	N=buflen;
-	opts=prefs('onstop',@nop,'onstart',@nop,'onfinish',@nop, ...
+	opts=options('onstop',@nop,'onstart',@nop,'onfinish',@nop, ...
 		'period_adjust',0.9,'preload',2,'sched',@iterate_timed,varargin{:});
 
 	it=feval(getparam(opts,'hook',@id),{@playbuf,S});
--- a/audio/sndread.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/audio/sndread.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,5 +1,5 @@
 function X=sndread(file,FS,varargin)
-	opts=prefs('bs',1024,varargin{:});
+	opts=options('bs',1024,varargin{:});
 	sig=sndfile(file,opts);
 	i=info(sig); 
 	if isfinite(i.length), init=ceil(1.01*i.length*rate(sig)/opts.bs); 
--- a/dsp/specgrm.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/dsp/specgrm.m	Mon Jan 28 10:52:11 2013 +0000
@@ -26,7 +26,7 @@
 
 	% Make Spectrogram Display if no arg out
 	if nargout==0
-		tfdimage(y,n,m,getparam(prefs(varargin{:}),'fs',1));
+		tfdimage(y,n,m,getparam(options(varargin{:}),'fs',1));
 		clear y;
 	end
 
--- a/dsp/synth/audio_sonifier.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/dsp/synth/audio_sonifier.m	Mon Jan 28 10:52:11 2013 +0000
@@ -29,7 +29,7 @@
 % }.
 
 function f=audio_sonifier(dur,varargin)
-	audio_info = prefs( ...
+	audio_info = options( ...
 				'transpose',0,'gen','sine','fs',11025, 'cutoff',0.4, ...
 				'attack',5,'decay',200,'release',5,varargin{:});
 
@@ -38,7 +38,7 @@
 end
 
 function player=sonify_audio(audio,dur,seq,onfinish)
-	disp('preparing audio signal.');
+	%disp('preparing audio signal.');
 	sched  = playaudio_async( ...
 		sonify(seq,dur,audio_opts(audio)), audio.lineout, ...
 		'defer',1,'its',2^31,'onfinish',@(a)onfinish());
@@ -49,12 +49,12 @@
 			'startq', @(q,o)sched.startat(o+quant(q,nows))));
 %			'wait',   sig.wait));
 
-	disp('audio playback ready to go.');
+	%disp('audio playback ready to go.');
 end
 
 function opts=audio_opts(A)
 	c=@(t)round(A.fs*t/1000);
-	opts=prefs('bpm',60, 'transpose',A.transpose-69, ...
+	opts=options('bpm',60, 'transpose',A.transpose-69, ...
 		'env',envadr(c(A.attack),c(A.decay),c(A.release)), ...
 		'gen',A.gen,'bl_cutoff',A.cutoff,'fs',A.fs,'buffer',0.125);
 end
--- a/dsp/synth/noodle.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/dsp/synth/noodle.m	Mon Jan 28 10:52:11 2013 +0000
@@ -13,7 +13,7 @@
 %    }
 % -> seq([[1,N]]) ~'sequence of audio buffers'.
 
-opts=prefs('bpm',120,'buffer',0.4, ...
+opts=options('bpm',120,'buffer',0.4, ...
 	'decay1',8000,'decay2',1600, ...
 	'attack1', 16, 'attack2', 16, ...
 	'release1', 64, 'release2', 64, ...
--- a/dsp/synth/sonify.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/dsp/synth/sonify.m	Mon Jan 28 10:52:11 2013 +0000
@@ -22,7 +22,7 @@
 %    }
 % -> seq([[1,T]]).
 
-	opts=prefs( ...
+	opts=options( ...
 		'bpm',240,'transpose',0,    ...
 		'gen','sine','betap',[2,8], ...
 		'fs',11025, 'buffer',0.125, ...
--- a/dsp/synth/sonify_disc.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/dsp/synth/sonify_disc.m	Mon Jan 28 10:52:11 2013 +0000
@@ -11,7 +11,7 @@
 %    }
 % -> seq([[1,T]]).
 
-	opts=prefs('env',[],'bpm',240,'fs',11025,'buffer',0.125, varargin{:});
+	opts=options('env',[],'bpm',240,'fs',11025,'buffer',0.125, varargin{:});
 
 	sample_rate=opts.fs;
 	dm=60*opts.fs/opts.bpm;
--- a/dsp/synth/sonify_formant.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/dsp/synth/sonify_formant.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,7 +1,7 @@
 % sonify_formant - sonify using formant synthesis
 function Y=sonify_formant(Controllers,S,varargin)
 
-	opts=prefs('bpm',240,'fs',11025,'buffer',0.125,'q',0.05,'cfilter',[],varargin{:});
+	opts=options('bpm',240,'fs',11025,'buffer',0.125,'q',0.05,'cfilter',[],varargin{:});
 
 	CC = cellmap(@(f)f/opts.fs,Controllers);
 	f0 = window(map(@getf0,S));
--- a/dsp/wienerfilt.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/dsp/wienerfilt.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,5 +1,5 @@
 function Y=wienerfilt(T,S,X,varargin)
-	opts=prefs(varargin{:});
+	opts=options(varargin{:});
 	Y=zipwith(@worker,T,S,X);
 
 	function Y=worker(T,S,X)
--- a/general/algo/gatherer.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/algo/gatherer.m	Mon Jan 28 10:52:11 2013 +0000
@@ -14,7 +14,7 @@
 %    collect :: void =>[[N,L]]  ~'action to return buffer contents and reset';
 % }.
 function api=gatherer(size_in,varargin)
-	opts=prefs('chunk',256,'init',512,'grow',2,'max',1e9,varargin{:});
+	opts=options('chunk',256,'init',512,'grow',2,'max',1e9,varargin{:});
 	n=uint32(0); 
 	cap=opts.init; % initial capacity of buffer
 	buf=zeros(size_in(1),cap); % buffer
--- a/general/algo/iterate.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/algo/iterate.m	Mon Jan 28 10:52:11 2013 +0000
@@ -31,14 +31,14 @@
 
 if iscell(varargin{1})
 	[f,x]=varargin{1}{:};
-	options=varargin(2:end);
+	varargs=varargin(2:end);
 else
 	f=varargin{1};
 	x=varargin{2};
-	options=varargin(3:end);
+	varargs=varargin(3:end);
 end
 
-opts=prefs('its',inf,'quiet',1,'save',0,'recover',0,'id','iterstate@',options{:});
+opts=options('its',inf,'quiet',1,'save',0,'recover',0,'id','iterstate@',varargs{:});
 pauserfn=pauser(opts);
 post=isfield(opts,'post');
 pre=isfield(opts,'pre');
--- a/general/algo/iterate_gui.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/algo/iterate_gui.m	Mon Jan 28 10:52:11 2013 +0000
@@ -14,7 +14,7 @@
 % to do: user configurable keys to allow multiple plotseqs
 % in same figure, each watching different keys.
 
-	opts=prefs('keyctl','set',varargin{:});
+	opts=options('keyctl','set',varargin{:});
 
 	[S,h]=stfn(S0);
 	set(h,'ButtonDownFcn',@btndn);
--- a/general/algo/iterate_timed.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/algo/iterate_timed.m	Mon Jan 28 10:52:11 2013 +0000
@@ -21,7 +21,7 @@
 % NB: Unlike ITERATE, this does NOT respect the id, save, and recover properties.
 % Neither does it respect the OPTPAUSE property 'pause'.
 
-	opts=prefs('its',inf,'drawnow',0, 'quiet', 0, 'defer', 0, ...
+	opts=options('its',inf,'drawnow',0, 'quiet', 0, 'defer', 0, ...
 		'busy_mode','queue','exec_mode','fixedRate', ...
 		'onfinish',@nop,'onstart',@nop,'onstop',@nop,varargin{:});
 
--- a/general/algo/pauser.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/algo/pauser.m	Mon Jan 28 10:52:11 2013 +0000
@@ -9,7 +9,7 @@
 % pauser(opts) returns a function that does exactly what optpause(opts)
 % does.
 
-	opt=prefs(varargin{:});
+	opt=options(varargin{:});
 	ps=getparam(opt,'pause',0);
 	dn=getparam(opt,'drawnow',1);
 	if ps, 
--- a/general/arrutils/order.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/arrutils/order.m	Mon Jan 28 10:52:11 2013 +0000
@@ -2,5 +2,6 @@
 % order - return sort order of given
 %
 % order :: [[N]] -> [[N]->[N]].
+% order :: [[N,M]] -> [[N,M]->[N]].
 
 [Y,I]=sort(X);
--- a/general/cellutils/cscanl.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/cellutils/cscanl.m	Mon Jan 28 10:52:11 2013 +0000
@@ -9,7 +9,7 @@
 function Y=cscanl(f,y,X,varargin)
 	Y=cell(size(X));
 	if nargin>3
-		opts=prefs('draw',0,varargin{:});
+		opts=options('draw',0,varargin{:});
 		for i=1:size(X,2)
 			y1=f(y,X{i});
 			Y{i}=y1;
--- a/general/fileutils/listfiles.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/fileutils/listfiles.m	Mon Jan 28 10:52:11 2013 +0000
@@ -11,7 +11,7 @@
 %    }
 % -> {[N]->text}        ~'cell array of N paths'.
 
-opts=prefs('rec',0,varargin{:});
+opts=options('rec',0,varargin{:});
 
 if isfield(opts,'pattern'),
 	dirpat = fullfile(dirname,opts.pattern);
--- a/general/funutils/@function_handle/decorate.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/funutils/@function_handle/decorate.m	Mon Jan 28 10:52:11 2013 +0000
@@ -8,7 +8,7 @@
 %    } 
 % -> (A->B{:}) ~'new function incorporating pre and post actions'.
 function f1=decorate(f,varargin)
-	opts=prefs(varargin{:});
+	opts=options(varargin{:});
 	pf=pauser(opts);
 	if isfield(opts,'pre') || isfield(opts,'post')
 		pre=getparam(opts,'pre',@nop);
--- a/general/funutils/groupby.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/funutils/groupby.m	Mon Jan 28 10:52:11 2013 +0000
@@ -12,7 +12,7 @@
 	i=1; j=1;
 	while j<=N
 		if i==j, z=f(x(i,:)); end
-		if j==N || f(x(j+1,:)~=z)
+		if j==N || any(f(x(j+1,:))~=z)
 			y=vertcat(y,{x(i:j,:)});
 			i=j+1; j=i;
 		else j=j+1; 
--- a/general/funutils/scanner_add_plotter.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/funutils/scanner_add_plotter.m	Mon Jan 28 10:52:11 2013 +0000
@@ -10,7 +10,7 @@
 % -> (S,X->X) ~'new scanning function'.
 
 function f1=scanner_add_plotter(f,opts)
-	opts=prefs('draw',0,varargin{:});
+	opts=options('draw',0,varargin{:});
 	if ~opts.draw, f1=f; else ps=pauser(opts); f1=@g; end
 	function y1=g(y,x), y1=f(y,x); opts.plotfn(x,y,y1); ps(); end
 end
--- a/general/getparam.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/getparam.m	Mon Jan 28 10:52:11 2013 +0000
@@ -3,7 +3,7 @@
 %
 % getparam :: struct Fields, string~'field name', A~'default value' -> A.
 %
-% Typical usage is with structures returned by prefs.
+% Typical usage is with structures returned by options.
 
 if isfield(s,field), a=s.(field); else a=def; end
 
--- a/general/numerical/fixpoint.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/general/numerical/fixpoint.m	Mon Jan 28 10:52:11 2013 +0000
@@ -11,7 +11,7 @@
 % -> maybe A ~'final value or nan if none'.
 
 
-opts=prefs('its',inf,'testfn',@epseq,varargin{:});
+opts=options('its',inf,'testfn',@epseq,varargin{:});
 
 conv=opts.testfn;
 its =opts.its; 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/general/options.m	Mon Jan 28 10:52:11 2013 +0000
@@ -0,0 +1,40 @@
+% options - create name-value map as a structure
+%
+% Arguments can be name value pairs, eg
+%   opts=options('foo',5,'bar',7)
+%   opts.foo=4
+%   opts.bar=7
+%
+% Or structures
+%   opts=options(defopts,'foo',5)
+%
+% Later arguments override earlier ones. A typical usage is 
+% with variable argument lists and GETPARAM, eg
+%
+%   function somefun(a,b,varargin)
+%   ...
+%   opts=options('foo',5,varargin{:});
+%   fooness=opts.foo;
+%   barness=getparam(opts,'bar',12);
+%
+% See also: GETPARAM, GETFIELD, ISFIELD
+function P=options(varargin)
+
+P=struct;
+n=1;
+while n<=length(varargin)
+	arg=varargin{n};
+	if isstruct(arg)
+		P=cpfields(fieldnames(arg),arg,P); 
+	elseif iscell(arg)	
+		pairs=arg;
+		for k=1:length(pairs)
+			P=setfield(P,pairs{k}{1},pairs{k}{2});
+		end
+	else
+		P=setfield(P,varargin{n},varargin{n+1});
+		n=n+1;
+	end
+	n=n+1;
+end
+
--- a/sched/rsched.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sched/rsched.m	Mon Jan 28 10:52:11 2013 +0000
@@ -51,7 +51,7 @@
 	warning('off','MATLAB:TIMER:STARTDELAYPRECISION');
 	warning('off','MATLAB:TIMER:RATEPRECISION');
 
-	opts=prefs('defer',0,'its',inf,'final',0, ...
+	opts=options('defer',0,'its',inf,'final',0, ...
 			'onstart',@nop,'onstop',@nop,'onfinish',@nop, ...
 			'busy_mode','queue','exec_mode','fixedRate',varargin{:});
 
@@ -94,7 +94,7 @@
 	function startat(t0) % !! what if timer is already running?
 		check('Timer is already running');
 		SchedStart=t0;
-		start_delay = t0-nows-STARTERR
+		start_delay = t0-nows-STARTERR;
 		if start_delay<0
 			fprintf('\n| WARNING: start delay=%f, starting now.',start_delay);
 			start_delay=0;
--- a/sched/schedrec.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sched/schedrec.m	Mon Jan 28 10:52:11 2013 +0000
@@ -3,7 +3,7 @@
 % schedrec :: schedule => sched_api.
 
 function API=schedrec(sch0,varargin)
-	opts=prefs('error',0,'weight',1,varargin{:});
+	opts=options('error',0,'weight',1,varargin{:});
 
 	ERROR=opts.error*opts.weight; 
 	K=opts.weight;
--- a/sched/timed_action.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sched/timed_action.m	Mon Jan 28 10:52:11 2013 +0000
@@ -8,7 +8,7 @@
 %    }
 % -> timed_action({A1,A2,...},{B1,B2,...}).
 function a0=timed_action(x,varargin)
-	opts=prefs('print',0,'errorfn',@(t)nows-t,varargin{:});
+	opts=options('print',0,'errorfn',@(t)nows-t,varargin{:});
 	if opts.print, a0=@aa_print; else a0=@aa; end
 	errfn=opts.errorfn;
 
--- a/sequences/+seq/windower.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sequences/+seq/windower.m	Mon Jan 28 10:52:11 2013 +0000
@@ -41,7 +41,7 @@
 				hop=span; 
 			end
 			sz=size(src); 
-			opts=prefs('wrap',1,'dim',length(sz),'strict',1,varargin{:});
+			opts=options('wrap',1,'dim',length(sz),'strict',1,varargin{:});
 
 			dim=opts.dim;  wrap=opts.wrap; 
 			a.hop=hop; a.span=span;
--- a/sequences/@seq/foldl.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sequences/@seq/foldl.m	Mon Jan 28 10:52:11 2013 +0000
@@ -18,7 +18,7 @@
 		y=next(y);
 	end
 else
-	opts=prefs('quiet',1,varargin{:});
+	opts=options('quiet',1,varargin{:});
 	x=e; 
 	while ~isempty(y)
 		x=fn(x,head(y));
--- a/sequences/@seq/gathern.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sequences/@seq/gathern.m	Mon Jan 28 10:52:11 2013 +0000
@@ -29,7 +29,7 @@
 		end
 	end
 else
-	opts=prefs('save',0,'recover',0,'draw',0,'plotfn',@nullplot,varargin{:});
+	opts=options('save',0,'recover',0,'draw',0,'plotfn',@nullplot,varargin{:});
 	draw=opts.draw;
 	savn=opts.save;
 	
--- a/sequences/@seq/limit.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sequences/@seq/limit.m	Mon Jan 28 10:52:11 2013 +0000
@@ -10,7 +10,7 @@
 % -> A, natural.
 
 function [y,its]=limit(d,X,varargin)
-	opts=prefs('maxit',10e6,'tol',1e-5,varargin{:});
+	opts=options('maxit',10e6,'tol',1e-5,varargin{:});
 
 	tol=opts.tol;
 	S.x=head(X);
--- a/sequences/@seq/meandata.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sequences/@seq/meandata.m	Mon Jan 28 10:52:11 2013 +0000
@@ -15,7 +15,7 @@
 %
 % Options: See ITERATE for applicable options
 
-	opts=prefs('check_nans',0,varargin{:});
+	opts=options('check_nans',0,varargin{:});
 
 	S.total=0;
 	S.count=0;
--- a/sequences/@seq/seq.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sequences/@seq/seq.m	Mon Jan 28 10:52:11 2013 +0000
@@ -31,7 +31,7 @@
 			else n=prod(size(a)); end
 		end
 
-		function n=seqlength(a), 
+		function n=count(a), 
 			n=0; while ~isempty(a), n=n+1; a=next(a); end
 		end
 
--- a/sequences/framedata.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sequences/framedata.m	Mon Jan 28 10:52:11 2013 +0000
@@ -20,7 +20,7 @@
 
 function a=framedata(signal,frame,hop,width,varargin)
 	if nargin<4, width = []; end
-	opts=prefs('wrap',0,'random',[],'dim',2,'filter',@id,varargin{:});
+	opts=options('wrap',0,'random',[],'dim',2,'filter',@id,varargin{:});
 	if isempty(width), opts.truncate=0; end 
 	
 	[span,jump]=windowparams(size(signal),frame,hop,width,opts);
--- a/sequences/rndwindow.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sequences/rndwindow.m	Mon Jan 28 10:52:11 2013 +0000
@@ -8,7 +8,7 @@
 %    randstate    ~'intial state of rngs'
 % -> seq [arrset(Size,D,L)] ~'seq of arrays of size L in Dth dimension'.
 
-	opts=prefs('state',rndstate,'circular',0,varargin{:});
+	opts=options('state',rndstate,'circular',0,varargin{:});
 
 	sz=size1(X);
 	if nargin<3, dim=length(sz); end
--- a/signals/resamplex.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/signals/resamplex.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,5 +1,5 @@
 function s=resamplex(fs,sigs,varargin)
-	opts=prefs(varargin{:});
+	opts=options(varargin{:});
 	[s1,sx]=feval(rsx1(sigs{1},sigs(2:end)));
 	s=siglzcat(s1,sx);
 
--- a/signals/transfer.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/signals/transfer.m	Mon Jan 28 10:52:11 2013 +0000
@@ -4,7 +4,7 @@
 % 
 % Returns the number of samples transfered.
 function n=transfer(sig,sink,varargin)
-	opts=prefs('chunk',512,varargin{:});
+	opts=options('chunk',512,varargin{:});
 	chunk=uint32(opts.chunk);
 
 	u=construct(sink);
--- a/sinks/@sink/supply.m	Thu Jan 24 14:51:23 2013 +0000
+++ b/sinks/@sink/supply.m	Mon Jan 28 10:52:11 2013 +0000
@@ -1,7 +1,7 @@
 % supply - squirt data from an array into a sink
 % supply   :: sink(C,R), [[C,L]], options -> [[C,N]].
 function varargout=supply(sink,x,varargin)
-	opts=prefs('chunk',256,varargin{:});
+	opts=options('chunk',256,varargin{:});
 
 	s=construct(sink);
 	try % to make sure we dispose of s once opened