MAKETT - projects metric perturbation into TT gauge htt = makett(hij, nDet); hij metric perturbation for gravitational wave source in 3x3xtime format Internal struct describing unit vector in direction of wave propagation (i.e., from source to detector) .x cos angle with respect to source Z-axis .phi azimuth angle from source x axis htt metric perturbation projected into TT gauge in 2 x time format htt(1,:) - plus polarization htt(2,:) - cross polarization q.v. LIGO-T040020-Z for + and x conventions $Id: makett.m,v 1.17 2005/04/12 21:23:48 stuver Exp $ SEE ALSO: GRAVEN
0001 function htt = makett(hij, Internal) 0002 0003 % MAKETT - projects metric perturbation into TT gauge 0004 % 0005 % htt = makett(hij, nDet); 0006 % 0007 % hij metric perturbation for gravitational wave source in 3x3xtime 0008 % format 0009 % Internal struct describing unit vector in direction of wave propagation 0010 % (i.e., from source to detector) 0011 % .x cos angle with respect to source Z-axis 0012 % .phi azimuth angle from source x axis 0013 % 0014 % htt metric perturbation projected into TT gauge in 2 x time format 0015 % htt(1,:) - plus polarization 0016 % htt(2,:) - cross polarization 0017 % q.v. LIGO-T040020-Z for + and x conventions 0018 % 0019 % $Id: makett.m,v 1.17 2005/04/12 21:23:48 stuver Exp $ 0020 % 0021 % SEE ALSO: GRAVEN 0022 0023 % INITIALIZE output variable 0024 % CHECK inputs for errors 0025 % DEFINE angles 0026 % DEFINE rotation matrix 0027 % DEFINE plus and cross bases 0028 % PROJECT metric pertubation onto bases 0029 % RETURN pluss and cross polarization timeseries 0030 0031 % Check for errors 0032 errorcheck(hij, Internal); 0033 0034 % Direction *from* source: i.e., -Internal 0035 cosTheta = -Internal.x; 0036 sinTheta = sqrt(1-cosTheta^2); 0037 phi = Internal.phi + pi; 0038 0039 % Form X, Y coordinate axes so that [X, Y, -Internal] is right-handed 0040 % coordinate system. 0041 % 0042 % GOTCHA: Note the -Internal above! The orientation of the X, Y that span the 0043 % polarization plane must be the same here as in detproj. 0044 0045 X = [cos(phi)*cosTheta, sin(phi)*cosTheta, -sinTheta]; 0046 Y = [-sin(phi), cos(phi), 0]; 0047 0048 % Form the plus and cross bases 0049 % eplus = X'*X - Y'*Y; 0050 % ecross = X'*Y + Y'*X; 0051 0052 % For each timestep, project the metric perturbation onto the plus and 0053 % cross basis 0054 % h+ = 0.5*(h^{ij}eplus_{ij}) 0055 % hx = 0.5*(h^{ij}ecross_{ij}) 0056 % * N.B. Multiply h^{ij}e_{ij} by 0.5 since dot(e_{ij},e_{ij}) = 2 0057 0058 % htt = zeros([2,size(hij,3)]); 0059 % for k = 1:size(hij,3) 0060 % htt(1,k) = 0.5*sum(sum(hij(:,:,k).*eplus)); 0061 % htt(2,k) = 0.5*sum(sum(hij(:,:,k).*ecross)); 0062 % end 0063 0064 % Let's be clever and use reshape and permute 0065 0066 nSamp = size(hij,3); 0067 htt = zeros([2,nSamp]); 0068 hij = reshape(hij,[3,3*nSamp]); 0069 xh = permute(reshape(X*hij,[3,nSamp]),[2,1]); 0070 yh = permute(reshape(Y*hij,[3,nSamp]),[2,1]); 0071 htt(1,:) = (xh*X'-yh*Y')'/2; 0072 htt(2,:) = (xh*Y'+yh*X')'/2; 0073 0074 0075 return 0076 0077 % ~~~ END MAIN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0078 0079 function errorcheck(hij, Internal) 0080 0081 % ERRORCHECK - checks makeh's input data for errors and stops the code if 0082 % an error is found 0083 % 0084 % errorcheck(hij, Internal) 0085 % 0086 % hij metric perturbation for gravitational wave source 0087 % Interanl Direction of wave propagation 0088 % .x cos co-declination 0089 % .phi source longitude 0090 0091 0092 % DETERMINE size of hij 0093 % CHECK all inputs for errors 0094 0095 dims = size(hij); 0096 if (dims(1) ~= 3 || dims(2) ~= 3) 0097 % size(hij) must be in [3, 3, nSamp] 0098 if (isempty(hij)) 0099 error('makett: hij empty'); 0100 else 0101 errstr = sprintf('%d',dims(1)); 0102 if (length(dims) > 1) 0103 errstr = [errstr, sprintf(', %d',dims(2:end))]; 0104 end 0105 error('makett: size(hij) = [%s] should be [3, 3, nSamp]',errstr); 0106 end 0107 end 0108 0109 % nDet must contain fields x, phi and psi; these must be in limits 0110 if ~(isfield(Internal, 'x') && -1 <= Internal.x && Internal.x <= 1) 0111 error('detproj: scalar nSrc.x must satisfy -1 <= nSrc.x <= 1') 0112 end 0113 if ~(isfield(Internal, 'phi') && -pi <= Internal.phi && Internal.phi <= pi) 0114 error('detproj: scalar nSrc.phi must satisfy -pi <= nSrc.phi <= pi'); 0115 end 0116 return