Home > matutils > interf > calc_ad.m

calc_ad

PURPOSE ^

ad=calc_ad(Field_size_deg,N_pix, Xoffset_deg);

SYNOPSIS ^

function ad=calc_ad(Field_size_deg,N_pix, Xoffset_deg);

DESCRIPTION ^

 ad=calc_ad(Field_size_deg,N_pix, Xoffset_deg);

 Make a structure containing all the axis data for an image
 in both image and fourier planes

 NB: Input Field_size in DEGREES

 Ouput structure has the following elements:

 Field_size_deg  (input)
 N_pix           (input)
 Field_size      (radians)
 t_del u_del     (spacings)
 t_val u_val     (axis values in radians)
 t_r u_r         (grids of radial values)
 t_val_deg       (useful for plots)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ad=calc_ad(Field_size_deg,N_pix, Xoffset_deg);
0002 % ad=calc_ad(Field_size_deg,N_pix, Xoffset_deg);
0003 %
0004 % Make a structure containing all the axis data for an image
0005 % in both image and fourier planes
0006 %
0007 % NB: Input Field_size in DEGREES
0008 %
0009 % Ouput structure has the following elements:
0010 %
0011 % Field_size_deg  (input)
0012 % N_pix           (input)
0013 % Field_size      (radians)
0014 % t_del u_del     (spacings)
0015 % t_val u_val     (axis values in radians)
0016 % t_r u_r         (grids of radial values)
0017 % t_val_deg       (useful for plots)
0018 
0019 % Keep inputs in output structure too
0020 xoff = logical(0);
0021 ad.Field_size_deg=Field_size_deg;
0022 ad.N_pix=N_pix;
0023 if(nargin==3)
0024     ad.Xoffset_deg = Xoffset_deg;
0025     xoff = logical(1);
0026 end
0027 even = ~(mod(N_pix,2));
0028 
0029 % Most things in radians
0030 ad.Field_size=Field_size_deg*(pi/180);
0031 
0032 % Calc the spacing in t
0033 ad.del_t=ad.Field_size/N_pix;
0034 
0035 % Calc the spacing in u
0036 ad.del_u=1/(ad.del_t*N_pix);
0037 
0038 % The u values at pixel centers along the u axis
0039 if(even)
0040     % NB: The zero value is in the N_pix/2+1 element of this even length array
0041     ad.u_val=-ad.del_u*N_pix/2:ad.del_u:ad.del_u*(N_pix/2-1);
0042 else
0043     ad.u_val=-ad.del_u*floor(N_pix/2):ad.del_u:ad.del_u*floor(N_pix/2);
0044 end
0045 
0046 % The x/y positions at pixel centers
0047 if(even)    
0048     ad.t_val=-(N_pix/2)*ad.del_t:ad.del_t:(N_pix/2-1)*ad.del_t;
0049 else
0050     ad.t_val=-floor(N_pix/2)*ad.del_t:ad.del_t:floor(N_pix/2)* ...
0051              ad.del_t;
0052 end
0053 
0054 if(xoff)
0055     ad.t_val_x = ad.t_val - Xoffset_deg*pi/180;
0056 end
0057 
0058     
0059 % Make grids of radial values in image and fourier planes
0060 [x,y]=meshgrid(ad.t_val,ad.t_val); ad.t_r=sqrt(x.^2+y.^2);
0061 [x,y]=meshgrid(ad.u_val,ad.u_val); ad.u_r=sqrt(x.^2+y.^2);
0062 
0063 % x/y positions in degrees and minutes are useful for plots
0064 ad.t_val_deg=ad.t_val*(180/pi);
0065 ad.t_val_min=ad.t_val_deg*60;
0066 
0067 if(xoff)
0068     ad.t_val_x_deg = ad.t_val_x*180/pi;
0069     ad.t_val_x_min=ad.t_val_x_deg*60;
0070 end
0071 
0072 return

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005