38#include <lal/UserInput.h>
39#include <lal/LALInitBarycenter.h>
40#include <lal/ComputeFstat.h>
41#include <lal/LALString.h>
42#include <lal/StringVector.h>
43#include <lal/LALPulsarVCSInfo.h>
50#define SQ(x) ( (x) * (x) )
124 FILE *fpOutab = NULL;
127 XLAL_CHECK( ( fpOutab = fopen( uvar.outab,
"wb" ) ) != NULL,
XLAL_EIO,
"Error opening file '%s' for writing...", uvar.outab );
133 for (
int a = 0;
a < argc;
a++ ) {
134 fprintf( fpOutab,
"%%%% argv[%d]: '%s'\n",
a, argv[
a] );
138 fprintf( fpOutab,
"%%%% columns:\n%%%% Alpha Delta tGPS " );
139 if ( config.numDetectors == 1 ) {
140 fprintf( fpOutab,
" a(t) b(t)" );
142 for (
UINT4 X = 0; X < config.numDetectors; X++ ) {
144 detectorID = config.multiDetStates->data[X]->detector.frDetector.prefix;
145 fprintf( fpOutab,
" a_%s(t) b_%s(t)", detectorID, detectorID );
152 FILE *fpOutABCD = NULL;
153 if ( uvar.outABCD ) {
155 XLAL_CHECK( ( fpOutABCD = fopen( uvar.outABCD,
"wb" ) ) != NULL,
XLAL_EIO,
"Error opening file '%s' for writing...", uvar.outABCD );
161 for (
int a = 0;
a < argc;
a++ ) {
162 fprintf( fpOutABCD,
"%%%% argv[%d]: '%s'\n",
a, argv[
a] );
166 fprintf( fpOutABCD,
"%%%% columns:\n%%%% Alpha Delta" );
167 if ( config.numDetectors == 1 ) {
169 detectorID = config.multiDetStates->data[0]->detector.frDetector.prefix;
170 fprintf( fpOutABCD,
" A_%s B_%s C_%s D_%s", detectorID, detectorID, detectorID, detectorID );
172 fprintf( fpOutABCD,
" A B C D" );
174 if ( config.numDetectors > 1 ) {
176 for (
UINT4 X = 0; X < config.numDetectors; X++ ) {
178 detectorID = config.multiDetStates->data[X]->detector.frDetector.prefix;
179 fprintf( fpOutABCD,
" A_%s B_%s C_%s D_%s", detectorID, detectorID, detectorID, detectorID );
187 for (
UINT4 n = 0;
n < config.numSkyPoints;
n++ ) {
202 if ( uvar.singleIFOweighting && ( config.numDetectors > 1 ) && ( config.multiNoiseWeights != NULL ) ) {
204 multiAMforSingle = multiAMunweighted;
206 multiAMforSingle = multiAM;
211 for (
UINT4 t = 0;
t < config.numTimeStampsX->data[0];
t++ ) {
212 fprintf( fpOutab,
"%.7f %.7f %d", config.Alpha->data[
n], config.Delta->data[
n], config.multiTimestamps->data[0]->data[
t].gpsSeconds );
213 for (
UINT4 X = 0; X < config.numDetectors; X++ ) {
220 if ( uvar.outABCD ) {
226 fprintf( fpOutABCD,
"%.7f %.7f %12.8f %12.8f %12.8f %12.8f", config.Alpha->data[
n], config.Delta->data[
n],
A,
B,
C,
D );
227 if ( config.numDetectors > 1 ) {
228 for (
UINT4 X = 0; X < config.numDetectors; X++ ) {
229 REAL4 AX = multiAMforSingle->
data[X]->
A / config.numTimeStampsX->data[X];
230 REAL4 BX = multiAMforSingle->
data[X]->
B / config.numTimeStampsX->data[X];
231 REAL4 CX = multiAMforSingle->
data[X]->
C / config.numTimeStampsX->data[X];
233 fprintf( fpOutABCD,
" %12.8f %12.8f %12.8f %12.8f", AX, BX, CX, DX );
240 if ( multiAMunweighted ) {
290 XLALRegisterUvarMember(
IFOs, STRINGVector,
'I', OPTIONAL,
"Comma-separated list of detectors, eg. \"H1,H2,L1,G1, ...\" [only 1 detector supported at the moment] " );
297 XLALRegisterUvarMember( timeGPS, STRINGVector,
't', OPTIONAL,
"GPS time at which to compute detector states (separate multiple timestamps by commata)" );
298 XLALRegisterUvarMember( timeStampsFiles, STRINGVector,
'T', OPTIONAL,
"Alternative: time-stamps file(s) (comma-separated list per IFO, or one for all)" );
299 XLALRegisterUvarMember(
Tsft,
INT4, 0, OPTIONAL,
"Assumed length of one SFT in seconds; needed for timestamps offset consistency with F-stat based codes" );
301 XLALRegisterUvarMember( noiseSqrtShX, STRINGVector, 0, OPTIONAL,
"Per-detector noise PSD sqrt(SX). Only ratios relevant to compute noise weights. Defaults to 1,1,..." );
308 XLALRegisterUvarMember( outABCD,
STRING,
'O', OPTIONAL,
"output file for antenna pattern matrix elements A, B, C, D averaged over timestamps" );
334 XLAL_CHECK( !( haveTimeGPS && haveTimeStampsFiles ),
XLAL_EINVAL,
"Can't handle both timeStampsFiles and timeGPS input options." );
335 XLAL_CHECK( haveTimeGPS || haveTimeStampsFiles,
XLAL_EINVAL,
"Need either timeStampsFiles or timeGPS input option." );
336 if ( haveTimeStampsFiles ) {
364 REAL8 temp_real8_timestamp = 0;
373 CHAR *singleTimeStampsFile = NULL;
374 if ( haveTimeStampsFiles ) {
411 XLAL_CHECK( !( haveAlphaDelta && haveSkyGrid ),
XLAL_EINVAL,
"Can't handle both Alpha/Delta and skyGridFile input options." );
412 XLAL_CHECK( haveAlphaDelta || haveSkyGrid,
XLAL_EINVAL,
"Need either Alpha/Delta or skyGridFile input option." );
414 if ( haveAlphaDelta ) {
422 else if ( haveSkyGrid ) {
446 REAL8 psd_normalization = 0;
451 fprintf( stderr,
"Illegal REAL8 commandline argument to --noiseSqrtShX[%d]: '%s'\n", X, uvar->
noiseSqrtShX->
data[X] );
455 if ( noiseSqrtShX->
data[X] <= 0.0 ) {
456 fprintf( stderr,
"Non-positive input PSD ratio for detector X=%d: noiseSqrtShX[X]=%f\n", X, noiseSqrtShX->
data[X] );
460 psd_normalization += 1.0 /
SQ( noiseSqrtShX->
data[X] );
479 REAL8 noise_weight_X = psd_normalization /
SQ( noiseSqrtShX->
data[X] );
int main(int argc, char *argv[])
int XLALDestroyConfig(ConfigVariables *cfg)
Destructor for internal configuration struct.
int vrbflg
defined in lal/lib/std/LALError.c
int XLALInitCode(ConfigVariables *cfg, const UserVariables_t *uvar, const char *app_name)
basic initializations: deal with user input and return standardized 'ConfigVariables'
int XLALInitUserVars(UserVariables_t *uvar)
register all "user-variables"
#define __func__
log an I/O error, i.e.
void LALCheckMemoryLeaks(void)
const LALVCSInfoList lalPulsarVCSInfoList
NULL-terminated list of VCS and build information for LALPulsar and its dependencies
int XLALParseDataFile(LALParsedDataFile **cfgdata, const CHAR *fname)
void XLALDestroyParsedDataFile(LALParsedDataFile *cfgdata)
int XLALParseMultiLALDetector(MultiLALDetector *detInfo, const LALStringVector *detNames)
Parse string-vectors (typically input by user) of N detector-names for detectors ,...
void XLALDestroyMultiDetectorStateSeries(MultiDetectorStateSeries *mdetStates)
Helper function to get rid of a multi-IFO DetectorStateSeries Note, this is "NULL-robust" in the sens...
MultiDetectorStateSeries * XLALGetMultiDetectorStates(const MultiLIGOTimeGPSVector *multiTS, const MultiLALDetector *multiIFO, const EphemerisData *edat, REAL8 tOffset)
Get the detector-time series for the given MultiLIGOTimeGPSVector.
EphemerisData * XLALInitBarycenter(const CHAR *earthEphemerisFile, const CHAR *sunEphemerisFile)
XLAL interface to reading ephemeris files 'earth' and 'sun', and return ephemeris-data in old backwar...
void XLALDestroyEphemerisData(EphemerisData *edat)
Destructor for EphemerisData struct, NULL robust.
void XLALDestroyMultiAMCoeffs(MultiAMCoeffs *multiAMcoef)
Destroy a MultiAMCoeffs structure.
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)
char char * XLALStringDuplicate(const char *s)
int XLALOutputVCSInfo(FILE *fp, const LALVCSInfoList vcs_list, const int verbose, const char *prefix)
void XLALDestroyMultiNoiseWeights(MultiNoiseWeights *weights)
Destroy a MultiNoiseWeights object.
LIGOTimeGPSVector * XLALCreateTimestampVector(UINT4 len)
Allocate a LIGOTimeGPSVector.
LIGOTimeGPSVector * XLALReadTimestampsFile(const CHAR *fname)
backwards compatible wrapper to XLALReadTimestampsFileConstrained() without GPS-time constraints
void XLALDestroyMultiTimestamps(MultiLIGOTimeGPSVector *multiTS)
Destroy a MultiLIGOTimeGPSVector timestamps vector.
MultiLIGOTimeGPSVector * XLALReadMultiTimestampsFiles(const LALStringVector *fnames)
backwards compatible wrapper to XLALReadMultiTimestampsFilesConstrained() without GPS-time constraint...
COORDINATESYSTEM_EQUATORIAL
LALStringVector * XLALCreateStringVector(const CHAR *str1,...)
void XLALDestroyUINT4Vector(UINT4Vector *vector)
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
UINT4Vector * XLALCreateUINT4Vector(UINT4 length)
#define XLAL_CHECK(assertion,...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
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
Configuration settings required for and defining a coherent pulsar search.
UINT4 numTimeStamps
number of timestamps (SFTs) for all detectors
REAL8 Alpha
sky position alpha in radians
MultiDetectorStateSeries * multiDetStates
multi-detector state series covering observation time
UINT4 numDetectors
number of detectors
REAL8Vector * Alpha
skyposition Alpha: radians, equatorial coords
UINT4 numSkyPoints
common length of Alpha and Delta vectors
MultiLIGOTimeGPSVector * multiTimestamps
a vector of timestamps (only set if provided from dedicated time stamp files)
UINT4Vector * numTimeStampsX
number of timestamps (SFTs) per detector
MultiNoiseWeights * multiNoiseWeights
per-detector noise weights SX^-1/S^-1, no per-SFT variation (can be NULL for unit weights)
REAL8 Delta
sky position delta in radians
REAL8Vector * Delta
skyposition Delta: radians, equatorial coords
EphemerisData * edat
ephemeris data
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
LIGOTimeGPS * data
array of timestamps
UINT4 length
number of timestamps
Multi-IFO container for antenna-pattern coefficients and atenna-pattern matrix .
AMCoeffs ** data
noise-weighted AM-coeffs , and
AntennaPatternMatrix Mmunu
antenna-pattern matrix
Multi-IFO time-series of DetectorStates.
array of detectors definitions 'LALDetector'
A collection of (multi-IFO) LIGOTimeGPSVector time-stamps vectors.
UINT4 length
number of timestamps vectors or ifos
LIGOTimeGPSVector ** data
timestamps vector for each ifo
One noise-weight (number) per SFT (therefore indexed over IFOs and SFTs.
UINT4 length
number of detectors
REAL8Vector ** data
weights-vector for each detector
REAL8 Alpha
Right ascension [radians] alpha of pulsar.
CHAR * ephemSun
Sun ephemeris file to use.
CHAR * outab
output file for antenna pattern functions a(t), b(t) at each timestamp
CHAR * ephemEarth
Earth ephemeris file to use.
LALStringVector * timeStampsFiles
alternative: read in timestamps from file(s)
REAL8 Delta
Declination [radians] delta of pulsar.
BOOLEAN singleIFOweighting
Normalize single-IFO quantities by single-IFO SX instead of Stot.
REAL8 Tsft
SFT time baseline Tsft.
LALStringVector * IFOs
list of detector-names "H1,H2,L1,.." or single detector
CHAR * outABCD
output file for antenna pattern matrix elements A, B, C, D averaged over timestamps
CHAR * skyGridFile
alternative: matrix of (Alpha,Delta) pairs from a file
INT4 Tsft
assumed length of SFTs, needed for offset to timestamps when comparing to CFS_v2, PFS etc
LALStringVector * timeGPS
GPS timestamps to compute detector state for (REAL8 format)
LALStringVector * noiseSqrtShX
per-detector noise PSD sqrt(SX)