%do_adjamps
%kalman version

clear variables


%myinfix='ds';		%apply to downsampled version (probably irrelevant for kalman)
myinfix='';			%apply to full version

adjnum=1;			%allow for more than one adjustment


sensorsused=[??];	%same setting as in do_ampvsposamp

%copy these settings from do_ampvsposamp
nsub=1;
trialbuf=cell(nsub,1);
sufbuf=int2str((1:nsub)');

%repeat as necessary for more than one sub-part
%note: although do_ampvsposamp may exclude unusual trials from the
%regression calculations, normally the actual adjustment of the amplitudes
%will be applied to all trial. So usually no restlist here.
triallist=[??];
trialbuf{1}=triallist;


inpath=['ampsfilt' myinfix];
if adjnum>1 inpath=[inpath 'adj' int2str(adjnum-1) 'k']; end;
inpath=[inpath pathchar 'amps'];
outpath=['ampsfilt' myinfix 'adj' int2str(adjnum) 'k' pathchar 'amps'];
coffile=['ampvsposampstats_'];
if adjnum>1 coffile=[coffile 'adj' int2str(adjnum-1) 'k']; end;
coffile=[coffile 'kalmanusm'];		%usual case if data taken from kalmanus/rawposm


mkdir(outpath);
 
%loop through the sub-parts
for ipass=1:nsub

disp([ipass nsub]);
mysuff=deblank(sufbuf(ipass,:));
coffuse=[coffile mysuff];

triallist=trialbuf{ipass};


adjampsapc(inpath,outpath,triallist,sensorsused,coffuse)


end;
