function act(srtlut,c0,a,b,clip)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Function:  act.m
% Package:   HoP
% Author:    Franco Buffa
% Purpose:   
% Date:      
%	
% GNU Octave Version: 4.0.2
%
% revised by 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% act.m  is a function that 
% example: act('../20180115_2/act_holo_2.txt',3,1,-1,true);
%
% Output:
% 
%
% Input:
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 stroke=14.990;
 
 lut=load(srtlut);

 [cod1 cod2 p1 p2 p3 p4 pm dv p0]=textread('lut.txt','%s %s %f %f %f %f %f %f %f');
  lutc0=lut(:,c0);
 lut(:,c0)=a*lut(:,c0)+b*pm;

 i0=find(abs(lut(:,c0)+lut(:,7))>stroke);
 printf('There are %d out of range data...\n',length(i0));

 if(clip)
  lut(i0,c0)=sign(lut(i0,7))*stroke-lut(i0,7);
  printf('Out of range data have been corrected...\n',length(i0));
 end
  
 printf('RMS new vs old LUT: %6.3f [mm]\n',std(lutc0-lut(:,c0)));
 
 fid=fopen('srtlut.txt','w');
 n0=length(lut);
 for k=1:n0
  fprintf(fid,"%6.3f\t%6.3f\t%6.3f\t%6.3f\t%6.3f\t%6.3f\t%6.3f\n",lut(k,:));
 end
 fclose(fid);
 
end
 
