Home > matutils > interf > projbase.m

projbase

PURPOSE ^

[u,v,w,za,b,t]=projbase(x,y,z,lat,dec,ha,antdia)

SYNOPSIS ^

function [u,v,w,za,b,t]=projbase(x,y,z,lat,dec,ha,antdia)

DESCRIPTION ^

 [u,v,w,za,b,t]=projbase(x,y,z,lat,dec,ha,antdia)

 For given array at given lat observing source at given declination
 and hour angle calculate projected baselines
 
 Input:
 x,y,z = antenna locations in local x-east, y-north, z-up
 coordinate frame.
 lat = latitude of site in degrees (+37 for OVRO)
 dec = declination of source in degrees
 ha = hour angle of source in hours - multiple ha's allowed
 antdia = optional antenna diameter to allow check for shadowing

 Output:
 Output arrays column are baselines with row for each hour angle.
 u,v,w = baselines in units of distance - not scaled for freq.
 za = zenith angle of obs (may be useful for calc vis noise)
 b,t = baseline and timestep numbers (may be useful when vectorizing u,v,w)

 e.g.  [x,y,z]=sza_antcoords
       [u,v]=projbase(x,y,z,37,34,[-3:0.5:+3])
       plot(u,v,'+')

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [u,v,w,za,b,t]=projbase(x,y,z,lat,dec,ha,antdia)
0002 % [u,v,w,za,b,t]=projbase(x,y,z,lat,dec,ha,antdia)
0003 %
0004 % For given array at given lat observing source at given declination
0005 % and hour angle calculate projected baselines
0006 %
0007 % Input:
0008 % x,y,z = antenna locations in local x-east, y-north, z-up
0009 % coordinate frame.
0010 % lat = latitude of site in degrees (+37 for OVRO)
0011 % dec = declination of source in degrees
0012 % ha = hour angle of source in hours - multiple ha's allowed
0013 % antdia = optional antenna diameter to allow check for shadowing
0014 %
0015 % Output:
0016 % Output arrays column are baselines with row for each hour angle.
0017 % u,v,w = baselines in units of distance - not scaled for freq.
0018 % za = zenith angle of obs (may be useful for calc vis noise)
0019 % b,t = baseline and timestep numbers (may be useful when vectorizing u,v,w)
0020 %
0021 % e.g.  [x,y,z]=sza_antcoords
0022 %       [u,v]=projbase(x,y,z,37,34,[-3:0.5:+3])
0023 %       plot(u,v,'+')
0024 
0025 % Convert input params in degrees and hours to radians
0026 lat=lat*pi/180;
0027 dec=dec*pi/180;
0028 ha=ha*pi/12;
0029 
0030 % ha must be vector
0031 if(prod(size(ha))~=length(ha))
0032   error('ha must be vector');
0033 end
0034 
0035 % If ha has multiple lines but dec does not expand dec
0036 if(length(dec)==1)
0037   dec=dec*ones(size(ha));
0038 end
0039 
0040 % If lat is an array, match its size to x,y,z
0041 if(prod(size(lat))>1)
0042   if(size(lat,1)~=size(x,1))
0043     error('lat array must have same number of elements as x,y,z')
0044   end
0045   if(size(lat,2)~=size(x,2))
0046     lat=repmat(lat,[1,size(x,2)]);
0047   end
0048 end
0049 
0050 % Convert to TMS frame
0051 [xt,yt,zt]=xyz2tms(x,y,z,lat);
0052 
0053 % Get baselines
0054 [xb,yb,zb]=tel2base(xt,yt,zt);
0055 
0056 % Project baselines
0057 [u,v,w]=tms2uvw(xb,yb,zb,ha,dec);
0058 
0059 % Calc baseline lengths and check for shadowing
0060 if(exist('antdia'))
0061   r=pyth(u,v);
0062   if(any(r(:)<antdia))
0063     disp('Warning - telescope shadowing');
0064   end
0065 end
0066 
0067 % Calc zenith angle (assume all tels are at same lat)
0068 [A,E]=hdl2ae(ha,dec,lat(:,1));
0069 za=pi/2-E;
0070 za=za*180/pi;
0071 za=repmat(za,[1,size(u,2)]);
0072 
0073 % Make arrays of baseline and timestep number
0074 b=1:size(u,2);        b=repmat(b,[length(ha),1]);
0075 t=cvec(1:length(ha)); t=repmat(t,[1,size(u,2)]);
0076 
0077 return

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