Home > . > detproj.m

detproj

PURPOSE ^

DETPROJ - projects waveform onto antenna patern of detector

SYNOPSIS ^

function varargout = detproj(htt, detId, nSrc)

DESCRIPTION ^

 DETPROJ - projects waveform onto antenna patern of detector

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

 htt        TT gauge metric perturbation
 detId      detector identifier string
 nSrc       Position and orientation of source wrt Earth
            Position is unit vector pointing from the Earth to the source
            Orientation angle describes rotation between Earth-based e+,
            ex and source-based e+ and ex (rotation angle from Earth to
            source)
   .x       cos source co-declination
   .phi     source longitude
   .psi     orientation angle

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

 $Id: detproj.m,v 1.18 2004/06/15 22:54:24 lsf Exp $

 SEE ALSO: GRAVEN, GETIFO

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = detproj(htt, detId, nSrc)
0002 % DETPROJ - projects waveform onto antenna patern of detector
0003 %
0004 % [h, fPlus, fCross] = detproj(htt, detId, nSrc);
0005 %
0006 % htt        TT gauge metric perturbation
0007 % detId      detector identifier string
0008 % nSrc       Position and orientation of source wrt Earth
0009 %            Position is unit vector pointing from the Earth to the source
0010 %            Orientation angle describes rotation between Earth-based e+,
0011 %            ex and source-based e+ and ex (rotation angle from Earth to
0012 %            source)
0013 %   .x       cos source co-declination
0014 %   .phi     source longitude
0015 %   .psi     orientation angle
0016 %
0017 % h          signal vector in strain
0018 % fPlus      (optional) + polarization beam pattern function
0019 % fCross     (optional) x polarization beam pattern function
0020 %
0021 % $Id: detproj.m,v 1.18 2004/06/15 22:54:24 lsf Exp $
0022 %
0023 % SEE ALSO: GRAVEN, GETIFO
0024 
0025 % $Id: detproj.m,v 1.18 2004/06/15 22:54:24 lsf Exp $
0026 
0027 % INITIALIZE output variable
0028 % CHECK inputs for errors
0029 % DEFINE nSrc angles from struct
0030 % DEFINE X and Y unit vectors in souce frame from sky location
0031 % DEFINE e+ and ex in source frame
0032 % DEFINE e+ and ex in detector frame
0033 % DEFINE F+ and Fx
0034 % DETERMNINE strain at the detector
0035 
0036 if (nargout < 1 || nargout > 3)
0037   error('usage: [h, fPlus, fCross] = detproj(htt, detId, nSrc)');
0038 end
0039 
0040 % Check htt and nSrc for errors
0041 errorcheck(htt, nSrc);
0042 
0043 % From the given cosine of the source's
0044 % co-dec sky location, define the sine
0045 cosTheta = nSrc.x; 
0046 sinTheta = sqrt(1-cosTheta^2);
0047 % Define other nSrc angles
0048 phi = nSrc.phi; 
0049 psi = nSrc.psi; 
0050 
0051 % Define X and Y unit vectors such that [X, Y, nSrc] is a right-handed
0052 % coordinate system
0053 % GOTCHA: the orientation of exEarth and eyEarth that span the polarization
0054 % plane must correspond to choices made in makett.
0055 exEarth = [cos(phi)*cosTheta, sin(phi)*cosTheta, -sinTheta];
0056 eyEarth = [-sin(phi), cos(phi), 0];
0057 
0058 % Earth e+ and ex
0059 % e+ = ex'*ex - ey'*ey
0060 % ex = ex'*ey + ey'*ex
0061 ePlusEarth = (exEarth'*exEarth)-(eyEarth'*eyEarth);
0062 eCrossEarth = (exEarth'*eyEarth)+(eyEarth'*exEarth);
0063 
0064 % Source e+ and ex: i.e., h = h+ e+Src + hx exSrc
0065 % e+Src = cos(2*psi)*e+ + sin(2*psi)*ex
0066 % exSrc = cos(2*psi)*ex - sin(2*psi)*ep
0067 ePlus =  (cos(2*psi)*ePlusEarth) + (sin(2*psi)*eCrossEarth);
0068 eCross = (cos(2*psi)*eCrossEarth)- (sin(2*psi)*ePlusEarth);
0069 
0070 % Define detector projection matrix
0071 % from unit vectors for the detectors arms
0072 Cordnt = getifo(detId); % Function that returns the IFO unit vectors
0073 
0074 % Make sure that the unit vectors are in 1x3 form
0075 Cordnt.V = Cordnt.V(:)'; 
0076 Cordnt.W = Cordnt.W(:)';
0077 
0078 % D = 0.5*(Xhat'*Xhat - Yhat'*Yhat)
0079 % where Xhat is the unit vector for the 'X' arm and Yhat is the unit vector
0080 % for the 'Y' arm
0081 D = 0.5*((Cordnt.V'*Cordnt.V)-(Cordnt.W'*Cordnt.W)); 
0082 
0083 % Define F+ and Fx
0084 % F+ = D^ij e+_ij
0085 fPlus = trace(D*ePlus);
0086 % Fx = D^ij ex_ij
0087 fCross = trace(D*eCross);
0088 
0089 % Determine strain at the detector
0090 % h = F+*h+ + Fx*hx
0091 varargout{1} = (fPlus*htt(1,:))+(fCross*htt(2,:));
0092 
0093 if (nargout > 1)
0094   varargout{2} = fPlus;
0095 end
0096 if (nargout > 2)
0097   varargout{3} = fCross;
0098 end
0099 
0100 return
0101 
0102 % ~~~ END MAIN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0103 
0104 function errorcheck(htt, nSrc)
0105 
0106 % ERRORCHECK - checks detproj's input data for errors and stops the code if
0107 %              an error is found
0108 %
0109 % errorcheck(hij, nSrc)
0110 %
0111 % htt        TT gauge metric perturbation
0112 %            Source is assumed to be in the direction of the North Pole
0113 % detId      detector identifier string
0114 % nSrc       Position and orientation of source wrt Earth
0115 %            Position is unit vector pointing from the Earth to the source
0116 %            Orientation is angle of rotation about this axis from Earth
0117 %            polarization angle to source polarization angle
0118 %   .x       cos source co-declination
0119 %   .phi     source longitude
0120 %   .psi     orientation angle
0121 
0122 if (size(htt,1) ~= 2)
0123     % htt must be in 2 x nSamp format
0124     if (isempty(htt))
0125       error('detproj: htt empty');
0126     else
0127       dims = size(htt);
0128       errstr = sprintf('%d',dims(1));
0129       if (length(dims) > 1)
0130         errstr = [errstr, sprintf(', %d',dims(2:end))];
0131       end
0132       error('detproj: size(htt) = [%s] should be [2 nSamp]',errstr);
0133     end
0134 end
0135  
0136 % nSrc must contain fields x, phi and psi; these must be in limits
0137 if ~(isfield(nSrc, 'x') && -1 <= nSrc.x && nSrc.x <= 1)
0138     error('detproj: scalar nSrc.x must satisfy -1 <= nSrc.x <= 1')
0139 end
0140 if ~(isfield(nSrc, 'phi') && -pi <= nSrc.phi && nSrc.phi <= pi)
0141     error('detproj: scalar nSrc.phi must satisfy -pi <= nSrc.phi <= pi');
0142 end
0143 if ~(isfield(nSrc, 'psi') && 0 <= nSrc.psi && nSrc.psi < 2*pi)
0144     error('detproj: nSrc.psi must satisfy 0 <= nSrc.psi < 2*pi')
0145 end
0146 return

Generated on Thu 12-May-2005 11:48:48 by m2html © 2003