55 #include <lal/LALComputeAM.h>
56 #include <lal/SinCosLUT.h>
60 #define SQ(x) (x) * (x)
90 if ( !ai || !bi || !skypos || !tGPS || !
site || !
edat ) {
97 REAL8 sinG, cosG, sinGcosG, sinGsinG, cosGcosG;
100 sinG = sin( earth.gmstRad );
101 cosG = cos( earth.gmstRad );
103 sinGsinG = sinG * sinG;
104 sinGcosG = sinG * cosG;
105 cosGcosG = cosG * cosG;
107 detT.
d11 =
site->response[0][0] * cosGcosG
108 - 2 *
site->response[0][1] * sinGcosG
109 +
site->response[1][1] * sinGsinG;
110 detT.
d22 =
site->response[0][0] * sinGsinG
111 + 2 *
site->response[0][1] * sinGcosG
112 +
site->response[1][1] * cosGcosG;
113 detT.
d12 = (
site->response[0][0] -
site->response[1][1] ) * sinGcosG
114 +
site->response[0][1] * ( cosGcosG - sinGsinG );
115 detT.
d13 =
site->response[0][2] * cosG
116 -
site->response[1][2] * sinG;
117 detT.
d23 =
site->response[0][2] * sinG
118 +
site->response[1][2] * cosG;
119 detT.
d33 =
site->response[2][2];
124 REAL8 sin1delta, cos1delta;
125 REAL8 sin1alpha, cos1alpha;
128 REAL8 eta1, eta2, eta3;
134 sin1delta = sin(
delta );
135 cos1delta = cos(
delta );
137 sin1alpha = sin(
alpha );
138 cos1alpha = cos(
alpha );
142 eta1 = sin1delta * cos1alpha;
143 eta2 = sin1delta * sin1alpha;
147 ( *ai ) = detT.
d11 * ( xi1 * xi1 - eta1 * eta1 )
148 + 2 * detT.
d12 * ( xi1 *
xi2 - eta1 * eta2 )
149 - 2 * detT.
d13 * eta1 * eta3
151 - 2 * detT.
d23 * eta2 * eta3
152 - detT.
d33 * eta3 * eta3;
154 ( *bi ) = detT.
d11 * 2 * xi1 * eta1
155 + 2 * detT.
d12 * ( xi1 * eta2 +
xi2 * eta1 )
156 + 2 * detT.
d13 * xi1 * eta3
157 + detT.
d22 * 2 *
xi2 * eta2
158 + 2 * detT.
d23 *
xi2 * eta3;
192 if ( !multiAMcoef ) {
206 if ( numStepsX != multiAMcoef->
data[X]->
b->
length ) {
207 XLALPrintError(
"%s: per-SFT antenna-pattern series have different length: a_alpha (len=%d), b_alpha (len=%d)\n",
__func__, numStepsX, multiAMcoef->
data[X]->
b->
length );
210 if ( multiWeights && ( multiWeights->
data[X]->
length != numStepsX ) ) {
211 XLALPrintError(
"%s: multiWeights[X=%d] must be NULL or have the same length (len=%d) as mulitAMcoef[X] (len=%d)!\n",
__func__, X, multiWeights->
data[X]->
length, numStepsX );
216 REAL4 Ad = 0, Bd = 0, Cd = 0, Ed = 0;
223 if ( multiWeights ) {
229 REAL8 Sqwi = sqrt( weight );
237 REAL4 AdX = 0, BdX = 0, CdX = 0, EdX = 0;
267 if ( multiWeights ) {
302 if ( !DetectorStates ) {
317 REAL4 sin1delta, cos1delta;
318 REAL4 sin1alpha, cos1alpha;
322 REAL4 xi1 = - sin1alpha;
324 REAL4 eta1 = sin1delta * cos1alpha;
325 REAL4 eta2 = sin1delta * sin1alpha;
326 REAL4 eta3 = - cos1delta;
338 for (
i = 0;
i < numSteps;
i++ ) {
343 ai =
d->d11 * ( xi1 * xi1 - eta1 * eta1 )
344 + 2 *
d->d12 * ( xi1 *
xi2 - eta1 * eta2 )
345 - 2 *
d->d13 * eta1 * eta3
346 +
d->d22 * (
xi2 *
xi2 - eta2 * eta2 )
347 - 2 *
d->d23 * eta2 * eta3
348 -
d->d33 * eta3 * eta3;
350 bi =
d->d11 * 2 * xi1 * eta1
351 + 2 *
d->d12 * ( xi1 * eta2 +
xi2 * eta1 )
352 + 2 *
d->d13 * xi1 * eta3
353 +
d->d22 * 2 *
xi2 * eta2
354 + 2 *
d->d23 *
xi2 * eta3;
385 if ( !multiDetStates ) {
394 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
439 if ( ( ret =
XLALCalloc( 1,
sizeof( *ret ) ) ) == NULL ) {
473 if ( ! multiAMcoef ) {
477 if ( multiAMcoef->
data ) {
478 for ( X = 0; X < multiAMcoef->
length; X ++ ) {
522 REAL4 disc = sqrt(
SQ( diffAB ) + 4.0 * (
SQ(
C ) +
SQ( E ) ) );
551 XLALPrintWarning(
"WARNING: Antenna-pattern matrix condition number exceeds maximum allowed value:\n" );
552 XLALPrintWarning(
"cond{A=%.16g, B=%.16g, C=%.16g, E=%.16g} = %.2e > %.2e ==> setting derminant = %.16g\n",
556 det =
A *
B -
SQ(
C ) -
SQ( E );
#define __func__
log an I/O error, i.e.
static REAL4 AntennaPatternMaxCond
static REAL4 estimateAntennaPatternConditionNumber(REAL4 A, REAL4 B, REAL4 C, REAL4 E)
estimate condition number for given antenna-pattern matrix
static REAL4 AntennaPatternIllCondDeterminant
static double double delta
const WeaveSearchTimingDenominator denom
int XLALBarycenterEarth(EarthState *earth, const LIGOTimeGPS *tGPS, const EphemerisData *edat)
Computes the position and orientation of the Earth, at some arrival time , specified LIGOTimeGPS inp...
AMCoeffs * XLALComputeAMCoeffs(const DetectorStateSeries *DetectorStates, SkyPosition skypos)
Compute the 'amplitude coefficients' , as defined in for a series of timestamps.
void XLALDestroyMultiAMCoeffs(MultiAMCoeffs *multiAMcoef)
Destroy a MultiAMCoeffs structure.
int XLALComputeAntennaPatternCoeffs(REAL8 *ai, REAL8 *bi, const SkyPosition *skypos, const LIGOTimeGPS *tGPS, const LALDetector *site, const EphemerisData *edat)
Compute single time-stamp antenna-pattern coefficients a(t), b(t) Note: this function uses REAL8 prec...
AMCoeffs * XLALCreateAMCoeffs(UINT4 numSteps)
Create an AMCeoffs vector for given number of timesteps.
int XLALWeightMultiAMCoeffs(MultiAMCoeffs *multiAMcoef, const MultiNoiseWeights *multiWeights)
Replace AM-coeffs by weighted AM-coeffs, i.e.
void XLALSetAntennaPatternMaxCond(REAL4 max_cond)
Set a new module-local maximal acceptable condition number of computing antenna-pattern matrix determ...
void XLALDestroyAMCoeffs(AMCoeffs *amcoef)
Destroy a AMCoeffs structure.
void XLALSetAntennaPatternIllCondDeterminant(REAL4 illCondDeterminant)
Set the 'fallback' determinant to use for ill-conditioned antenna-pattern matrix.
REAL4 XLALComputeAntennaPatternSqrtDeterminant(REAL4 A, REAL4 B, REAL4 C, REAL4 E)
Compute (sqrt of) determinant of the antenna-pattern matrix Mmunu = [ A, C, 0, -E; C B E,...
MultiAMCoeffs * XLALComputeMultiAMCoeffs(const MultiDetectorStateSeries *multiDetStates, const MultiNoiseWeights *multiWeights, SkyPosition skypos)
Multi-IFO version of XLALComputeAMCoeffs().
#define XLAL_INIT_DECL(var,...)
void * XLALCalloc(size_t m, size_t n)
int XLALSinCosLUT(REAL4 *sinx, REAL4 *cosx, REAL8 x)
Calculate sin(x) and cos(x) to roughly 1e-7 precision using a lookup-table and Taylor-expansion.
COORDINATESYSTEM_EQUATORIAL
void XLALDestroyREAL4Vector(REAL4Vector *vector)
REAL4Vector * XLALCreateREAL4Vector(UINT4 length)
#define XLAL_ERROR_NULL(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_REAL4(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK_NULL(assertion,...)
This structure contains the per-SFT (weighted) antenna-pattern functions , with the SFT-index,...
REAL4 B
summed antenna-pattern matrix coefficient:
REAL4Vector * b
(weighted) per-SFT antenna-pattern function
REAL4 A
summed antenna-pattern matrix coefficient:
REAL4 C
summed antenna-pattern matrix coefficient:
REAL4Vector * a
(weighted) per-SFT antenna-pattern function
REAL8 Sinv_Tsft
normalization-factor (using single-sided PSD!)
REAL4 Dd
determinant factor , such that
SymmTensor3 detT
Detector-tensor components in SSB-fixed, Cartesian coordinates.
Timeseries of DetectorState's, representing the detector-info at different timestamps.
DetectorState * data
array of DetectorState entries
UINT4 length
total number of entries
Basic output structure of LALBarycenterEarth.c.
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
Multi-IFO container for antenna-pattern coefficients and atenna-pattern matrix .
UINT4 length
number of IFOs
AMCoeffs ** data
noise-weighted AM-coeffs , and
AntennaPatternMatrix Mmunu
antenna-pattern matrix
Multi-IFO time-series of DetectorStates.
UINT4 length
number of detectors
DetectorStateSeries ** data
vector of pointers to DetectorStateSeries
One noise-weight (number) per SFT (therefore indexed over IFOs and SFTs.
REAL8 Sinv_Tsft
normalization factor used: (using single-sided PSD!)
UINT4 length
number of detectors
REAL8Vector ** data
weights-vector for each detector
BOOLEAN isNotNormalized
if true: weights are saved unnormalized (divide by Sinv_Tsft to get normalized version).
A symmetric 3x3 tensor (such as detector-tensors), storing only the upper triangle.
A symmetric 3x3 tensor (such as detector-tensors), storing only the upper triangle,...