22 #include <gsl/gsl_sf_trig.h>
23 #include <lal/LALStdlib.h>
24 #include <lal/LALStdio.h>
25 #include <lal/LALError.h>
26 #include <lal/Units.h>
27 #include <lal/SeqFactories.h>
29 #include <lal/SkyCoordinates.h>
30 #include <lal/DetResponse.h>
31 #include <lal/TimeSeries.h>
32 #include <lal/XLALError.h>
59 const double gha = gmst - ra;
62 const double cosgha = cos(gha);
63 const double singha = sin(gha);
64 const double cosdec = cos(dec);
65 const double sindec = sin(dec);
66 const double cospsi = cos(
psi);
67 const double sinpsi = sin(
psi);
72 X[0] = -cospsi * singha - sinpsi * cosgha * sindec;
73 X[1] = -cospsi * cosgha + sinpsi * singha * sindec;
74 X[2] = sinpsi * cosdec;
79 Y[0] = sinpsi * singha - cospsi * cosgha * sindec;
80 Y[1] = sinpsi * cosgha + cospsi * singha * sindec;
81 Y[2] = cospsi * cosdec;
85 *fplus = *fcross = 0.0;
86 for(i = 0; i < 3; i++) {
87 const double DX = D[i][0] * X[0] + D[i][1] * X[1] + D[i][2] * X[2];
88 const double DY = D[i][0] *
Y[0] + D[i][1] *
Y[1] + D[i][2] *
Y[2];
89 *fplus += X[i] * DX -
Y[i] * DY;
90 *fcross += X[i] * DY +
Y[i] * DX;
132 const double gha = gmst - ra;
135 const double cosgha = cos(gha);
136 const double singha = sin(gha);
137 const double cosdec = cos(dec);
138 const double sindec = sin(dec);
139 const double cospsi = cos(
psi);
140 const double sinpsi = sin(
psi);
145 X[0] = -cospsi * singha - sinpsi * cosgha * sindec;
146 X[1] = -cospsi * cosgha + sinpsi * singha * sindec;
147 X[2] = sinpsi * cosdec;
152 Y[0] = sinpsi * singha - cospsi * cosgha * sindec;
153 Y[1] = sinpsi * cosgha + cospsi * singha * sindec;
154 Y[2] = cospsi * cosdec;
161 Z[0] = -cosdec * cosgha;
162 Z[1] = cosdec * singha;
167 *fplus = *fcross = *fb = *fl = *fx = *fy = 0.0;
168 for(i = 0; i < 3; i++) {
169 const double DX = D[i][0] * X[0] + D[i][1] * X[1] + D[i][2] * X[2];
170 const double DY = D[i][0] *
Y[0] + D[i][1] *
Y[1] + D[i][2] *
Y[2];
171 const double DZ = D[i][0] * Z[0] + D[i][1] * Z[1] + D[i][2] * Z[2];
173 *fplus += X[i] * DX -
Y[i] * DY;
174 *fcross += X[i] * DY +
Y[i] * DX;
178 *fb += X[i] * DX +
Y[i] * DY;
180 *fx += X[i] * DZ + Z[i] * DX;
181 *fy +=
Y[i] * DZ + Z[i] * DY;
205 double Pibeta =
LAL_PI * beta;
206 ans = cexp(I * Pibeta * (1.0 -
mu)) * gsl_sf_sinc(beta * (1.0 +
mu));
207 ans += cexp(-I * Pibeta * (1.0 +
mu)) * gsl_sf_sinc(beta * (1.0 -
mu));
213 static void getarm(
double u[3],
double alt,
double azi,
double lat,
double lon)
215 double cosalt = cos(alt);
216 double sinalt = sin(alt);
217 double cosazi = cos(azi);
218 double sinazi = sin(azi);
219 double coslat = cos(lat);
220 double sinlat = sin(lat);
221 double coslon = cos(lon);
222 double sinlon = sin(lon);
223 double uNorth = cosalt * cosazi;
224 double uEast = cosalt * sinazi;
226 double uRho = - sinlat * uNorth + coslat * uUp;
227 u[0] = coslon * uRho - sinlon * uEast;
228 u[1] = sinlon * uRho + coslon * uEast;
229 u[2] = coslat * uNorth + sinlat * uUp;
234 void XLALComputeDetAMResponseParts(
double *armlen,
double *xcos,
double *ycos,
double *fxplus,
double *fyplus,
double *fxcross,
double *fycross,
const LALDetector *detector,
double ra,
double dec,
double psi,
double gmst)
243 double gha = gmst - ra;
244 double cosgha = cos(gha);
245 double singha = sin(gha);
246 double cosdec = cos(dec);
247 double sindec = sin(dec);
248 double cospsi = cos(
psi);
249 double sinpsi = sin(
psi);
254 X[0] = -cospsi * singha - sinpsi * cosgha * sindec;
255 X[1] = -cospsi * cosgha + sinpsi * singha * sindec;
256 X[2] = sinpsi * cosdec;
257 Y[0] = sinpsi * singha - cospsi * cosgha * sindec;
258 Y[1] = sinpsi * cosgha + cospsi * singha * sindec;
259 Y[2] = cospsi * cosdec;
260 Z[0] = -cosgha * cosdec;
261 Z[1] = singha * cosdec;
264 switch (detector->
type) {
291 for (i = 0; i < 3; ++i) {
292 *xcos += U[i] * Z[i];
293 *ycos += V[i] * Z[i];
299 for (i = 0; i < 3; ++i) {
300 DU[i][i] = 0.5 * U[i] * U[i];
301 DV[i][i] = 0.5 * V[i] * V[i];
302 for (j = i + 1; j < 3; ++j) {
303 DU[i][j] = DU[j][i] = 0.5 * U[i] * U[j];
304 DV[i][j] = DV[j][i] = 0.5 * V[i] * V[j];
311 *fxplus = *fxcross = 0.0;
312 *fyplus = *fycross = 0.0;
313 for (i = 0; i < 3; ++i) {
314 double DUX = DU[i][0]*X[0]+DU[i][1]*X[1]+DU[i][2]*X[2];
315 double DUY = DU[i][0]*
Y[0]+DU[i][1]*
Y[1]+DU[i][2]*
Y[2];
316 double DVX = DV[i][0]*X[0]+DV[i][1]*X[1]+DV[i][2]*X[2];
317 double DVY = DV[i][0]*
Y[0]+DV[i][1]*
Y[1]+DV[i][2]*
Y[2];
318 *fxplus += X[i] * DUX -
Y[i] * DUY;
319 *fxcross += X[i] * DUY +
Y[i] * DUX;
320 *fyplus += X[i] * DVX -
Y[i] * DVY;
321 *fycross += X[i] * DVY +
Y[i] * DVX;
345 for (i = 0; i < 3; ++i)
346 *xcos += U[i] * Z[i];
348 *fyplus = *fycross = 0.0;
367 for (i = 0; i < 3; ++i)
368 *ycos += V[i] * Z[i];
370 *fxplus = *fxcross = 0.0;
384 *armlen = *xcos = *ycos = 0.0;
385 *fyplus = *fycross = 0.0;
403 double fplus, fcross;
419 pResponse->
plus = fplus;
420 pResponse->
cross = fcross;
441 if(!*fplus || !*fcross) {
444 *fplus = *fcross = NULL;
448 for(i = 0; i < n; i++) {
454 *fplus = *fcross = NULL;
458 (*fplus)->data->data[i] =
p;
459 (*fcross)->data->data[i] = c;
470 int XLALComputeDetAMResponseExtraModesSeries(
REAL4TimeSeries ** fplus,
REAL4TimeSeries ** fcross,
REAL4TimeSeries ** fb,
REAL4TimeSeries ** fl,
REAL4TimeSeries ** fx,
REAL4TimeSeries ** fy,
const REAL4 D[3][3],
const double ra,
const double dec,
const double psi,
const LIGOTimeGPS * start,
const double deltaT,
const int n)
475 double p, c, b, l,
x,
y;
484 if(!*fplus || !*fcross || !*fb || !*fl || !*fx || !*fy) {
492 *fplus = *fcross = *fb = *fl = *fx = *fy = NULL;
496 for(i = 0; i < n; i++) {
507 *fplus = *fcross = *fb = *fl = *fx = *fy = NULL;
510 XLALComputeDetAMResponseExtraModes(&
p, &c, &b, &l, &
x, &
y, D, ra, dec,
psi, gmst);
511 (*fplus)->data->data[i] =
p;
512 (*fcross)->data->data[i] = c;
513 (*fb)->data->data[i] = b;
514 (*fl)->data->data[i] = l;
515 (*fx)->data->data[i] =
x;
516 (*fy)->data->data[i] =
y;
560 pResponseSeries->
pPlus->
f0 = 0.;
585 printf(
"pResponseSeries->pPlus->data->length = %d\n", pResponseSeries->
pPlus->
data->
length);
601 LALInfo(
status,
"scalar sequence too short -- reallocating");
613 for(i = 0; i < pTimeInfo->
nSample; ++i) {
static void getarm(double u[3], double alt, double azi, double lat, double lon)
#define LALInfo(statusptr, info)
#define TRY(func, statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
static double Y(int length, int i)
Maps the length of a window and the offset within the window to the "y" co-ordinate of the LAL docume...
static double psi(double theta, double xi)
void LALComputeDetAMResponse(LALStatus *status, LALDetAMResponse *pResponse, const LALDetAndSource *pDetAndSrc, const LIGOTimeGPS *gps)
int XLALComputeDetAMResponseExtraModesSeries(REAL4TimeSeries **fplus, REAL4TimeSeries **fcross, REAL4TimeSeries **fb, REAL4TimeSeries **fl, REAL4TimeSeries **fx, REAL4TimeSeries **fy, const REAL4 D[3][3], const double ra, const double dec, const double psi, const LIGOTimeGPS *start, const double deltaT, const int n)
Computes REAL4TimeSeries containing time series of the full general metric theory of gravity response...
void XLALComputeDetAMResponseParts(double *armlen, double *xcos, double *ycos, double *fxplus, double *fyplus, double *fxcross, double *fycross, const LALDetector *detector, double ra, double dec, double psi, double gmst)
#define DETRESPONSEH_ESRCNOTEQUATORIAL
Source coordinates not in Equatorial system.
void XLALComputeDetAMResponse(double *fplus, double *fcross, const REAL4 D[3][3], const double ra, const double dec, const double psi, const double gmst)
An implementation of the detector response formulae in Anderson et al PRD 63 042003 (2001) .
void XLALComputeDetAMResponseExtraModes(double *fplus, double *fcross, double *fb, double *fl, double *fx, double *fy, const REAL4 D[3][3], const double ra, const double dec, const double psi, const double gmst)
An implementation of the detector response for all six tensor, vector and scalar polarisation modes o...
COMPLEX16 XLALComputeDetArmTransferFunction(double beta, double mu)
int XLALComputeDetAMResponseSeries(REAL4TimeSeries **fplus, REAL4TimeSeries **fcross, const REAL4 D[3][3], const double ra, const double dec, const double psi, const LIGOTimeGPS *start, const double deltaT, const int n)
Computes REAL4TimeSeries containing time series of response amplitudes.
#define DETRESPONSEH_ENULLOUTPUT
Output is NULL.
void LALComputeDetAMResponseSeries(LALStatus *status, LALDetAMResponseSeries *pResponseSeries, const LALDetAndSource *pDetAndSource, const LALTimeIntervalAndNSample *pTimeInfo)
Computes REAL4TimeSeries containing time series of response amplitudes.
#define DETRESPONSEH_ENULLINPUT
Input is NULL.
#define LAL_PI
Archimedes's constant, pi.
double complex COMPLEX16
Double-precision floating-point complex number (16 bytes total)
float REAL4
Single precision real floating-point number (4 bytes).
@ LALDETECTORTYPE_IFOCOMM
IFO in common mode.
@ LALDETECTORTYPE_IFOYARM
IFO in one-armed mode (Y arm)
@ LALDETECTORTYPE_IFOXARM
IFO in one-armed mode (X arm)
@ LALDETECTORTYPE_IFODIFF
IFO in differential mode.
@ COORDINATESYSTEM_EQUATORIAL
The sky-fixed equatorial coordinate system.
void XLALDestroyREAL4TimeSeries(REAL4TimeSeries *series)
REAL4TimeSeries * XLALCreateREAL4TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalDimensionlessUnit
dimensionless units
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALSCreateVector(LALStatus *, REAL4Vector **, UINT4)
#define XLAL_ERROR(...)
Macro to invoke a failure from a XLAL routine returning an integer.
#define XLAL_IS_REAL8_FAIL_NAN(val)
Tests if val is a XLAL REAL8 failure NaN.
@ XLAL_EFUNC
Internal function call failed bit: "or" this with existing error number.
REAL8 XLALGreenwichMeanSiderealTime(const LIGOTimeGPS *gpstime)
Convenience wrapper, calling XLALGreenwichSiderealTime() with the equation of equinoxes set to 0.
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
Adds a double to a GPS time.
This structure encapsulates the detector AM (beam pattern) coefficients for one source at one instanc...
REAL4 plus
Detector response to -polarized gravitational radiation
REAL4 scalar
Detector response to scalar gravitational radiation (NB: ignored at present – scalar response computa...
REAL4 cross
Detector response to -polarized gravitational radiation.
This structure aggregates together three REAL4TimeSeries objects containing time series of detector A...
REAL4TimeSeries * pCross
timeseries of detector response to -polarized gravitational radiation
REAL4TimeSeries * pPlus
timeseries of detector response to -polarized gravitational radiation
REAL4TimeSeries * pScalar
timeseries of detector response to scalar gravitational radiation (NB: not yet implemented....
This structure aggregates a pointer to a LALDetector and a LALSource.
LALSource * pSource
Pointer to LALSource object containing information about the source.
const LALDetector * pDetector
Pointer to LALDetector object containing information about the detector.
REAL4 response[3][3]
The Earth-fixed Cartesian components of the detector's response tensor .
LALDetectorType type
The type of the detector (e.g., IFO in differential mode, cylindrical bar, etc.)
LALFrDetector frDetector
The original LALFrDetector structure from which this was created.
REAL8 vertexLongitudeRadians
The geodetic longitude of the vertex in radians.
REAL8 vertexLatitudeRadians
The geodetic latitude of the vertex in radians.
REAL4 xArmMidpoint
The distance to the midpoint of the X arm in meters (unused for bars: set it to zero)
REAL4 xArmAzimuthRadians
The angle clockwise from North to the projection of the X arm (or bar's cylidrical axis) into the lo...
REAL4 yArmMidpoint
The distance to the midpoint of the Y arm in meters (unused for bars: set it to zero)
REAL4 yArmAltitudeRadians
The angle up from the local tangent plane of the reference ellipsoid to the Y arm in radians (unused...
REAL4 yArmAzimuthRadians
The angle clockwise from North to the projection of the Y arm into the local tangent plane of the re...
REAL4 xArmAltitudeRadians
The angle up from the local tangent plane of the reference ellipsoid to the X arm (or bar's cylidric...
SkyPosition equatorialCoords
equatorial coordinates of source, in decimal RADIANS
REAL8 orientation
Orientation angle ( ) of source: counter-clockwise angle -axis makes with a line perpendicular to mer...
LAL status structure, see The LALStatus structure for more details.
This structure encapsulates time and sampling information for computing a LALDetAMResponseSeries.
LIGOTimeGPS epoch
The start time of the time series.
UINT4 nSample
The total number of samples to be computed.
REAL8 deltaT
The sampling interval , in seconds.
Epoch relative to GPS epoch, see LIGOTimeGPS type for more details.
Time series of REAL4 data, see DATATYPE-TimeSeries types for more details.
CHAR name[LALNameLength]
The name of the time series.
REAL4Sequence * data
The sequence of sampled data.
LALUnit sampleUnits
The physical units of the quantity being sampled.
REAL8 deltaT
The time step between samples of the time series in seconds.
LIGOTimeGPS epoch
The start time of the time series.
REAL8 f0
The heterodyning frequency, in Hertz (zero if not heterodyned).
REAL4 * data
Pointer to the data array.
UINT4 length
Number of elements in array.
REAL8 longitude
The longitudinal coordinate (in radians), as defined above.
REAL8 latitude
The latitudinal coordinate (in radians), as defined above.
CoordinateSystem system
The coordinate system in which latitude/longitude are expressed.