[x_u,y_v,z_w]=tms2uvw(x,y,z,H,d) Transform from the TMS conventional earth fixed XY in equatorial plane coord frame defined in Fig 4.1 to the uvw frame for a source at Hour Angle H and Declination d, and u parallel to the horizon. This is TMS eqn 4.1. Note that the wavelength scaling is not done here. Multiple hour angles are allowed. Output array columns are baselines with row for each requested H.
0001 function [x_u,y_v,z_w]=tms2uvw(x,y,z,H,d) 0002 % [x_u,y_v,z_w]=tms2uvw(x,y,z,H,d) 0003 % 0004 % Transform from the TMS conventional earth fixed 0005 % XY in equatorial plane coord frame defined in 0006 % Fig 4.1 to the uvw frame for a source 0007 % at Hour Angle H and Declination d, and u 0008 % parallel to the horizon. 0009 % This is TMS eqn 4.1. 0010 % Note that the wavelength scaling is not done here. 0011 % 0012 % Multiple hour angles are allowed. 0013 % Output array columns are baselines with row for 0014 % each requested H. 0015 0016 % Make sure x,y,z are row vectors if single value for them. 0017 if(min(size(x))==1) 0018 x=x(:)'; y=y(:)'; z=z(:)'; 0019 oldWay = 1; 0020 else 0021 oldWay = 0; 0022 end 0023 0024 % Make sure H,d are column vector 0025 H=H(:); d=d(:); 0026 0027 % Make baseline index number array 0028 n=1:length(x); 0029 0030 % Make x,y,z,n same each hour angle 0031 if(oldWay) 0032 n = 1:size(x,2); 0033 x=repmat(x,size(H,1),1); 0034 y=repmat(y,size(H,1),1); 0035 z=repmat(z,size(H,1),1); 0036 end 0037 n=repmat(n,size(H,1),1); 0038 0039 % Make H,d same for each x,y,z 0040 H=repmat(H,1,size(x,2)); 0041 d=repmat(d,1,size(x,2)); 0042 0043 % Do the transform 0044 sinH=sin(H); cosH=cos(H); 0045 sind=sin(d); cosd=cos(d); 0046 0047 x_u=+sinH.*x+cosH.*y; 0048 y_v=-sind.*cosH.*x+sind.*sinH.*y+cosd.*z; 0049 z_w=+cosd.*cosH.*x-cosd.*sinH.*y+sind.*z; 0050 0051 return