Commit 97986fb7 authored by Franco Buffa's avatar Franco Buffa
Browse files

source and data

parent 8511da61
Loading
Loading
Loading
Loading

dev/act.m

0 → 100644
+54 −0
Original line number Diff line number Diff line
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
 

dev/app.m

0 → 100644
+73 −0
Original line number Diff line number Diff line
function app(fconf)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Function:  
% Package:   HoP
% Author:    Franco Buffa
% Purpose:   
% Date:      
%	
% GNU Octave Version: 4.0.2
%
% revised by 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% is a function that 
%
% Output:
% 
%
% Input:
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 if nargin>0
  run(fconf); 
 else
  run('conf.m');
 end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 load unwr.dat
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   u0=sfactor*u0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 dx=D/(mp-1)/k0;

 W=reshape(u0,mp*mp,1);
 X1=ones(mp,mp).*(1:mp); % colonna
 Y1=transpose(X1);       % riga
 
 x=dx*(X1-mp/2);
 y=dx*(Y1-mp/2);
 
 X=reshape(x,mp*mp,1);
 Y=reshape(y,mp*mp,1);
 
 X(blk)=[];
 Y(blk)=[];
 W(blk)=[];
%%%%%%%%%  
 a=[ones(length(X),1) X Y];
 c=a\W;
 u00=u0-(c(1)+x*c(2)+y*c(3));

 u00(blk)=0; 
 
 save unwr00.dat u00
 
 figure(1);
 imagesc(dx*(-mp/2:mp/2),dx*(-mp/2:mp/2),u00);
 caxis([-tol3 tol3]);
%grid minor on;
 axis('square');
 colormap(cmap);
 colorbar;
 title('AP phase distribution [rad]');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
end
 
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ function phase(fconf)
 end
%save T.dat T
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 T=fftshift(T);
 T=ifftshift(T);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 w=ifft2(T); 
 y=a.*w;
@@ -132,7 +132,8 @@ function phase(fconf)
 colorbar;
%  print -dpng figure1.png
%
 y=[y(m/2+1:m,m/2+1:m) y(m/2+1:m,1:m/2); y(1:m/2,m/2+1:m) y(1:m/2,1:m/2)];
%y=[y(m/2+1:m,m/2+1:m) y(m/2+1:m,1:m/2); y(1:m/2,m/2+1:m) y(1:m/2,1:m/2)];
 y=fftshift(y);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 e0=angle(y);
%e0=atan(imag(y)./real(y));