%do_velocityrepair
%Filtering of position data. Repair of outliers also possible

clear variables

nsensor=12;			%do not change

%change subdirectory names as required
inpath=['ampsfiltadj1' pathchar 'recurseadj1kkalmanus' pathchar 'rawpos' pathchar ];
amppath=['ampsfiltadj1' pathchar 'amps' pathchar];

outpath=['ampsfiltadj1' pathchar 'velrep' pathchar 'rawpos' pathchar];
mkdir([outpath 'posamps']);

%copy in here the filter specification exactly as used by do_filteramps (or
%the equivalent script used when running the experiment


triallist=1:??;

chanlist=[??];

%data is repaired if difference between measured and predicted velocity
%exceeds threshold specified here (in mm/s). If threshold is left as NaN then the
%data is filtered but no repairs are made
veldifflim=ones(nsensor,1)*NaN;
%add lines like the following to activate repairs for specific sensors (e.g
%for sensor 3)
%veldifflim(3)=300;		%threshold for measure minus predicted = 300mm/s

velocityrepair(inpath,amppath,outpath,triallist,chanlist,filterspecs,veldifflim);
