Home > . > detproj.m

detproj

PURPOSE ^

DETPROJ - projects waveform onto antenna patern of detector

SYNOPSIS ^

function [h, fPlus, fCross] = detproj(htt, detId, External)

DESCRIPTION ^

 DETPROJ - projects waveform onto antenna patern of detector

 [h, fPlus, fCross] = detproj(htt, detId, External);

 htt        TT gauge metric perturbation
            Source is assumed to be in the direction of the North Pole 
 detId      detector identifier string
 External   struct describing position and orientation of source wrt Earth
            in the direction pointing from the Earth to the source
   .x       cos source co-declination
   .phi     source longitude
   .psi     source's polarization angle (angle between the projection the
            the Earth's Z axis and the source's Z axis on the transverse 
            plane)

 h          signal vector in strain
 fPlus      (optional) + polarization beam pattern function
 fCross     (optional) x polarization beam pattern function

 SEE ALSO: GRAVEN, GETIFO

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [h, fPlus, fCross] = detproj(htt, detId, External)
0002 
0003 % DETPROJ - projects waveform onto antenna patern of detector
0004 %
0005 % [h, fPlus, fCross] = detproj(htt, detId, External);
0006 %
0007 % htt        TT gauge metric perturbation
0008 %            Source is assumed to be in the direction of the North Pole
0009 % detId      detector identifier string
0010 % External   struct describing position and orientation of source wrt Earth
0011 %            in the direction pointing from the Earth to the source
0012 %   .x       cos source co-declination
0013 %   .phi     source longitude
0014 %   .psi     source's polarization angle (angle between the projection the
0015 %            the Earth's Z axis and the source's Z axis on the transverse
0016 %            plane)
0017 %
0018 % h          signal vector in strain
0019 % fPlus      (optional) + polarization beam pattern function
0020 % fCross     (optional) x polarization beam pattern function
0021 %
0022 % SEE ALSO: GRAVEN, GETIFO
0023 
0024 % $Id: detproj.m,v 1.15 2004/05/17 19:04:04 stuver Exp $
0025 
0026 % INITIALIZE output variable
0027 % CHECK inputs for errors
0028 % DEFINE external angles from struct
0029 % DEFINE X and Y unit vectors in souce frame from sky location
0030 % DEFINE e+ and ex in source frame
0031 % DEFINE e+ and ex in detector frame
0032 % DEFINE F+ and Fx
0033 % DETERMNINE strain at the detector
0034 
0035 % Initialize output variable
0036 h = [];
0037 
0038 % Check htt and External for errors
0039 errorcheck(htt, External);
0040 
0041 % From the given cosine of the source's co-dec sky location, define the sine
0042 cosTheta = External.x; 
0043 sinTheta = sqrt(1-External.x^2);
0044 % Define other external angles
0045 phi = External.phi; 
0046 psi = External.psi; 
0047 
0048 % Define X and Y unit vectors in source frame from sky location
0049 % (This is found from rotating about z counterclockwise angle phi and then
0050 % rotating counterclockwise about y angle theta)
0051 exEarth = [cos(phi)*cosTheta, sin(phi)*cosTheta, -sinTheta];
0052 eyEarth = [-sin(phi), cos(phi), 0];
0053 % The Z unit vector now points from the Earth to the source on the
0054 % line-of-sight
0055 
0056 % Define e+ and ex in source frame
0057 % e+ = ex'*ex - ey'*ey
0058 ePlusEarth = (exEarth'*exEarth)-(eyEarth'*eyEarth);
0059 % ex = ex'*ey + ey'*ex
0060 eCrossEarth = (exEarth'*eyEarth)+(eyEarth'*exEarth);
0061 
0062 % Define e+ and ex in detector frame
0063 % e+@IFO = cos(2*psi)*e+ + sin(2*psi)*ex
0064 ePlus = (cos(2*psi)*ePlusEarth)+(sin(2*psi)*eCrossEarth);
0065 % ex@IFO = cos(2*psi)*ex - sin(2*psi)*ep
0066 eCross = (cos(2*psi)*eCrossEarth)-(sin(2*psi)*ePlusEarth);
0067 
0068 % Define detector projection matrix from unit vectors for the detectors arms
0069 Cordnt = getifo(detId); % Function that returns the IFO unit vectors
0070 
0071 % Make sure that the unit vectors are in 1x3 form
0072 Cordnt.V = Cordnt.V(:)'; 
0073 Cordnt.W = Cordnt.W(:)';
0074 
0075 % D = 0.5*(Xhat'*Xhat - Yhat'*Yhat)
0076 % where Xhat is the unit vector for the 'X' arm and Yhat is the unit vector
0077 % for the 'Y' arm
0078 D = 0.5*((Cordnt.V'*Cordnt.V)-(Cordnt.W'*Cordnt.W)); 
0079 
0080 % Define F+ and Fx
0081 % F+ = D^ij e+_ij
0082 fPlus = trace(D*ePlus);
0083 % Fx = D^ij ex_ij
0084 fCross = trace(D*eCross);
0085 
0086 % Determine strain at the detector
0087 % h = F+*h+ + Fx*hx
0088 h = (fPlus*htt(1,:))+(fCross*htt(2,:));
0089 
0090 return
0091 
0092 % ~~~ END MAIN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0093 
0094 function errorcheck(htt, External)
0095 
0096 % ERRORCHECK - checks detproj's input data for errors and stops the code if
0097 %              an error is found
0098 %
0099 % errorcheck(hij, External)
0100 %
0101 % htt        TT gauge metric perturbation
0102 %            Source is assumed to be in the direction of the North Pole
0103 % detId      detector identifier string
0104 % External   struct describing position and orientation of source wrt Earth
0105 %            in the direction pointing from the Earth to the source
0106 %   .x       cos source co-declination
0107 %   .phi     source longitude
0108 %   .psi     source's polarization angle measured clockwise along Earth's
0109 %            longitide from the Prime Meridian
0110 
0111 if size(htt,1) ~= 2
0112     % htt must be in 2xtime format
0113     sizeHtt = size(htt)
0114     error('detproj: htt must be in 2xtime format')
0115 end
0116  
0117 % External must be a structure
0118 if ~strcmp(class(External), 'struct')
0119     External
0120     error('detproj: External must be a structure')
0121 end
0122 
0123 % External must contain fields x, phi and psi
0124 if ~isfield(External, 'x')
0125     External
0126     error('detproj: The External struct must contain the field x')
0127 elseif abs(External.x) > 1 | ~isreal(External.x)
0128     % If External.x exists, it must be real and have a value between
0129     % -1 and 1
0130     External.x
0131     error('detproj: External.x must be real and between -1 and 1')
0132 end
0133 if ~isfield(External, 'phi')
0134     External
0135     error('detproj: The External struct must contain the field phi')
0136 elseif External.phi < -pi | External.phi > pi | ~isreal(External.phi)
0137     % If External.phi exits, it must be real and have a value between
0138     % -pi and pi
0139     External.phi
0140     error(['detproj: External.phi must be real and betweeen -pi '...
0141             'and pi'])
0142 end
0143 if ~isfield(External, 'psi')
0144     External
0145     error('detproj: The External struct must contain field psi')
0146 elseif External.psi < 0 | External.psi > (2*pi) | ...
0147         ~isreal(External.psi)
0148     % If External.psi exists, it must be real and have a value
0149     % between 0 and 2*pi
0150     External.psi
0151     error('detproj: External.psi must be real and between 0 and 2*pi')
0152 end

Generated on Tue 05-Oct-2004 10:40:50 by m2html © 2003