50 #include <lal/LALString.h>
51 #include <lal/AVFactories.h>
52 #include <lal/UserInput.h>
53 #include <lal/LALStdio.h>
54 #include <lal/LALBarycenter.h>
55 #include <lal/LALInitBarycenter.h>
56 #include <lal/LALComputeAM.h>
57 #include <lal/SFTfileIO.h>
58 #include <lal/LALPulsarVCSInfo.h>
61 #define SEMIANALYTIC_ENORM 0
62 #define SEMIANALYTIC_ESUB 1
63 #define SEMIANALYTIC_EINPUT 2
64 #define SEMIANALYTIC_EBAD 3
65 #define SEMIANALYTIC_EFILE 4
66 #define SEMIANALYTIC_ENOARG 5
67 #define SEMIANALYTIC_EMEM 6
68 #define SEMIANALYTIC_EREADFILE 8
70 #define SEMIANALYTIC_MSGENORM "Normal exit"
71 #define SEMIANALYTIC_MSGESUB "Subroutine failed"
72 #define SEMIANALYTIC_MSGEINPUT "Invalid input"
73 #define SEMIANALYTIC_MSGEBAD "Bad argument values"
74 #define SEMIANALYTIC_MSGEFILE "File IO error"
75 #define SEMIANALYTIC_MSGENOARG "Missing argument"
76 #define SEMIANALYTIC_MSGEMEM "Out of memory..."
77 #define SEMIANALYTIC_MSGEREADFILE "Error reading in file"
83 #define SQ(x) ((x)*(x))
127 int main(
int argc,
char *argv[] )
169 REAL8 A,
B,
C, A1, A2, A3, A4, To, Sh, F;
171 REAL8 twopsi, twophi;
180 twophi = 2.0 * CLA.
phi0;
181 twopsi = 2.0 * CLA.
psi;
186 A1 = aPlus * cos( twopsi ) * cos( twophi ) - aCross * sin( twopsi ) * sin( twophi );
187 A2 = aPlus * sin( twopsi ) * cos( twophi ) + aCross * cos( twopsi ) * sin( twophi );
188 A3 = -aPlus * cos( twopsi ) * sin( twophi ) - aCross * sin( twopsi ) * cos( twophi );
189 A4 = -aPlus * sin( twopsi ) * sin( twophi ) + aCross * cos( twopsi ) * cos( twophi );
193 Sh = pow( CLA.
sqrtSh, 2 );
195 F =
A * (
SQ( A1 ) +
SQ( A3 ) ) + 2.0 *
C * ( A1 * A2 + A3 * A4 ) +
B * (
SQ( A2 ) +
SQ( A4 ) );
196 F *= To / ( 4.0 * Sh );
255 XLAL_CHECK_LAL(
status,
XLALRegisterNamedUvar( &( CLA->
IFO ),
"IFO",
STRING,
'D', OPTIONAL,
"Detector: H1, H2, L1, G1, ... " ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
320 if ( !have_IFO && !have_detector ) {
321 fprintf( stderr,
"\nNeed to specify the detector (--IFO) !\n\n" );
353 baryinput.
dInv = 0.e0;
364 amParams->
earth = &earth;
381 for (
k = 0;
k < CLA->
nTsft;
k++ ) {
388 teemp += 0.5 * CLA->
Tsft;
426 if ( have_timestamps && ( have_gpsStart || have_duration ) ) {
427 fprintf( stderr,
"\nBoth start time/duration and timestamps file specified - just need one !!\n" );
431 if ( !have_timestamps && !have_gpsStart ) {
432 fprintf( stderr,
"\nNeed to specify gpsStart time or a timestamps file !!\n" );
436 if ( have_duration && have_nTsft ) {
437 fprintf( stderr,
"\nSpecify only one of {duration, nTsft}!\n\n" );
440 if ( !have_duration && !have_nTsft && !have_timestamps ) {
441 fprintf( stderr,
"\nDuration has not been specified! Use one of {duration, nTsft, timestamps}!\n\n" );
452 if ( ( have_h0 || have_cosi ) && ( have_aPlus || have_aCross ) ) {
453 fprintf( stderr,
"\nSpecify EITHER {h0/cosiota} OR {aPlus/aCross}\n\n" );
457 if ( ( have_h0 && !have_cosi ) || ( !have_h0 && have_cosi ) ) {
458 fprintf( stderr,
"\nYou need to specify both --h0 and --cosi\n\n" );
461 if ( ( have_aPlus && !have_aCross ) || ( !have_aPlus && have_aCross ) ) {
462 fprintf( stderr,
"\nYou need to specify both --aPlus and --aCross\n\n" );
465 if ( ( CLA->
cosi < -1.0 ) || ( CLA->
cosi > 1.0 ) ) {
466 fprintf( stderr,
"\nIncorrect value for cos(iota)\n\n" );
517 cos2psi = cos( 2.0 *
params->polAngle );
518 sin2psi = sin( 2.0 *
params->polAngle );
521 for (
i = 0;
i < length; ++
i ) {
533 b[
i] =
zeta * ( response.
cross * cos2psi + response.
plus * sin2psi );
538 sumAB += (
a[
i] ) * ( b[
i] );
549 coe->
D = ( coe->
A * coe->
B -
SQ( coe->
C ) );
lal_errhandler_t lal_errhandler
int LAL_ERR_EXIT(LALStatus *stat, const char *func, const char *file, const int line, volatile const char *id)
#define LAL_CALL(function, statusptr)
void LALCheckMemoryLeaks(void)
const LALVCSInfoList lalPulsarVCSInfoList
NULL-terminated list of VCS and build information for LALPulsar and its dependencies
#define ABORT(statusptr, code, mesg)
#define XLAL_CHECK_LAL(sp, assertion,...)
#define TRY(func, statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
LIGOTimeGPSVector * timestamps
static void LALComputeAM(LALStatus *, AMCoeffs *coe, LIGOTimeGPS *ts, AMCoeffsParams *params)
Original antenna-pattern function by S Berukoff.
void ReadUserInput(LALStatus *, struct CommandLineArgsTag *CLA, int argc, char *argv[])
int main(int argc, char *argv[])
struct CommandLineArgsTag CommandLineArgs
void ComputeF(LALStatus *, struct CommandLineArgsTag CLA)
void Freemem(LALStatus *)
#define SEMIANALYTIC_EINPUT
void CheckUserInput(LALStatus *, struct CommandLineArgsTag *CLA)
Check validity of user-input.
void Initialize(LALStatus *status, struct CommandLineArgsTag *CLA)
Handle user-input and check its validity.
int vrbflg
defined in lal/lib/std/LALError.c
void InitUserVars(LALStatus *status, struct CommandLineArgsTag *CLA)
register all our "user-variables"
#define SEMIANALYTIC_MSGEINPUT
void LALComputeDetAMResponse(LALStatus *status, LALDetAMResponse *pResponse, const LALDetAndSource *pDetAndSrc, const LIGOTimeGPS *gps)
void XLALDestroyEphemerisData(EphemerisData *edat)
Destructor for EphemerisData struct, NULL robust.
EphemerisData * XLALInitBarycenter(const CHAR *earthEphemerisFile, const CHAR *sunEphemerisFile)
XLAL interface to reading ephemeris files 'earth' and 'sun', and return ephemeris-data in old backwar...
#define XLAL_INIT_DECL(var,...)
char char * XLALStringDuplicate(const char *s)
const LALDetector * XLALGetSiteInfo(const CHAR *name)
Find the site geometry-information 'LALDetector' for given a detector name (or prefix).
LIGOTimeGPSVector * XLALMakeTimestamps(LIGOTimeGPS tStart, REAL8 Tspan, REAL8 Tsft, REAL8 Toverlap)
Given a start-time, Tspan, Tsft and Toverlap, returns a list of timestamps covering this time-stretch...
LIGOTimeGPSVector * XLALReadTimestampsFile(const CHAR *fname)
backwards compatible wrapper to XLALReadTimestampsFileConstrained() without GPS-time constraints
void XLALDestroyTimestampVector(LIGOTimeGPSVector *vect)
De-allocate a LIGOTimeGPSVector.
COORDINATESYSTEM_EQUATORIAL
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALSCreateVector(LALStatus *, REAL4Vector **, UINT4)
#define XLAL_CHECK_MAIN(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
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
This structure contains the parameters for the routine.
LALDetAndSource * das
det and source information
REAL4 polAngle
polarization angle
EarthState * earth
from XLALBarycenter()
EphemerisData * edat
the ephemerides
BarycenterInput * baryinput
data from Barycentring routine
Basic output structure of LALBarycenterEarth.c.
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
const LALDetector * pDetector
SkyPosition equatorialCoords
A vector of 'timestamps' of type LIGOTimeGPS.
LIGOTimeGPS * data
array of timestamps
UINT4 length
number of timestamps