61#define VALIDATEOUT "./outHM1/skypatch_1/HM1validate"
62#define VALIDATEIN "./outHM1/skypatch_1/HM1templates"
67#define SQ(x) ((x)*(x))
73int main(
int argc,
char *argv[] )
86 CHAR *uvar_earthEphemeris = NULL;
87 CHAR *uvar_sunEphemeris = NULL;
89 REAL8 *alphaVec = NULL;
90 REAL8 *deltaVec = NULL;
91 REAL8 *freqVec = NULL;
92 REAL8 *spndnVec = NULL;
97 CHAR *uvar_ifo = NULL;
99 CHAR *uvar_fnameOut = NULL;
100 CHAR *uvar_fnameIn = NULL;
101 INT4 numberCount, ind;
104 REAL8 uvar_peakThreshold;
109 UINT4 loopId, tempLoopId;
111 CHAR *fnameLog = NULL;
168 fnameLog =
LALCalloc( ( strlen( uvar_fnameOut ) + strlen(
".log" ) + 10 ), 1 );
169 strcpy( fnameLog, uvar_fnameOut );
170 strcat( fnameLog,
".log" );
171 if ( ( fpLog = fopen( fnameLog,
"w" ) ) == NULL ) {
172 fprintf( stderr,
"Unable to open file %s for writing\n", fnameLog );
180 fprintf( fpLog,
"## Log file for HoughValidate\n\n" );
181 fprintf( fpLog,
"# User Input:\n" );
182 fprintf( fpLog,
"#-------------------------------------------\n" );
183 fprintf( fpLog,
"%s", logstr );
188 CHAR command[1024] =
"";
189 fprintf( fpLog,
"\n\n# CVS-versions of executable:\n" );
190 fprintf( fpLog,
"# -----------------------------------------\n" );
193 sprintf( command,
"ident %s | sort -u >> %s", argv[0], fnameLog );
197 if ( system( command ) ) {
198 fprintf( stderr,
"\nsystem('%s') returned non-zero status!\n\n", command );
205 fpOut = fopen( uvar_fnameOut,
"w" );
207 setvbuf( fpOut, (
char * )NULL, _IOLBF, 0 );
215 REAL8 temp1, temp2, temp3, temp4, temp5;
216 UINT8 templateCounter;
218 fpIn = fopen( uvar_fnameIn,
"r" );
220 fprintf( stderr,
"Unable to fine file %s\n", uvar_fnameIn );
227 r =
fscanf( fpIn,
"%lf%lf%lf%lf%lf\n", &temp1, &temp2, &temp3, &temp4, &temp5 );
232 }
while (
r != EOF );
241 for ( templateCounter = 0; templateCounter < nTemplates; templateCounter++ ) {
242 r =
fscanf( fpIn,
"%lf%lf%lf%lf%lf\n", &temp1, alphaVec + templateCounter, deltaVec + templateCounter,
243 freqVec + templateCounter, spndnVec + templateCounter );
254 f_max = freqVec[nTemplates - 1] ;
269 CHAR *tempDir = NULL;
282 strcat( tempDir,
"/*SFT*.*" );
287 mObsCoh = catalog->
length;
307 sftFminBin = floor( (
REAL4 )( timeBase * inputSFTs->
data->
f0 ) + (
REAL4 )( 0.5 ) );
308 tempFbin = floor( timeBase * inputSFTs->
data->
f0 + 0.5 );
310 if ( tempFbin - sftFminBin ) {
311 fprintf( stderr,
"Rounding error in calculating fminbin....be careful! \n" );
322 for ( tempLoopId = 0; tempLoopId < mObsCoh; tempLoopId++ ) {
324 pgV[tempLoopId]->
length = sftlength;
325 pgV[tempLoopId]->
data = NULL;
346 for (
j = 0;
j < mObsCoh;
j++ ) {
355 timeDiffV.
length = mObsCoh;
356 timeDiffV.
data = NULL;
363 midTimeBase = 0.5 * timeBase;
367 timeDiffV.
data[0] = midTimeBase;
369 for (
j = 1;
j < mObsCoh; ++
j ) {
372 timeDiffV.
data[
j] =
ts + tn -
t0 + midTimeBase;
389 velPar.
tBase = timeBase;
422 baryinput.
dInv = 0.e0;
425 baryinput.
alpha = 0.0;
426 baryinput.
delta = 0.0;
435 amParams->
earth = &earth;
466 for ( loopId = 0; loopId < nTemplates; ++loopId ) {
469 pulsarTemplate.
f0 = freqVec[loopId];
470 pulsarTemplate.
longitude = alphaVec[loopId];
471 pulsarTemplate.
latitude = deltaVec[loopId];
476 REAL8 f0new, vcProdn, timeDiffN;
477 REAL8 sourceDelta, sourceAlpha, cosDelta, factorialN;
481 sourceDelta = pulsarTemplate.
latitude;
483 cosDelta = cos( sourceDelta );
485 sourceLocation.
x = cosDelta * cos( sourceAlpha );
486 sourceLocation.
y = cosDelta * sin( sourceAlpha );
487 sourceLocation.
z = sin( sourceDelta );
492 for (
j = 0;
j < mObsCoh; ++
j ) {
494 vcProdn = velV.
data[
j].
x * sourceLocation.
x
495 + velV.
data[
j].
y * sourceLocation.
y
496 + velV.
data[
j].
z * sourceLocation.
z;
499 f0new = pulsarTemplate.
f0;
501 timeDiffN = timeDiffV.
data[
j];
502 for (
i = 0;
i < msp; ++
i ) {
503 factorialN *= (
i + 1.0 );
504 f0new += pulsarTemplate.
spindown.
data[
i] * timeDiffN / factorialN;
505 timeDiffN *= timeDiffN;
508 f0newBin = floor( f0new * timeBase + 0.5 );
509 foft = f0newBin * ( 1.0 + vcProdn ) / timeBase;
515 ind = floor( foft * timeBase + 0.5 ) - sftFminBin;
518 numberCount += pg1->
data[ind];
528 fprintf( fpOut,
"%d %f %f %f %g \n",
550 for ( tempLoopId = 0; tempLoopId < mObsCoh; tempLoopId++ ) {
551 pg1 = pgV[tempLoopId];
608 cos2psi = cos( 2.0 *
params->polAngle );
609 sin2psi = sin( 2.0 *
params->polAngle );
612 for (
i = 0;
i < length; ++
i ) {
624 b[
i] =
zeta * ( response.
cross * cos2psi + response.
plus * sin2psi );
629 sumAB += (
a[
i] ) * ( b[
i] );
640 coe->
D = ( coe->
A * coe->
B -
SQ( coe->
C ) );
#define DRIVEHOUGHCOLOR_EFILE
#define DRIVEHOUGHCOLOR_ENORM
static void LALComputeAM(LALStatus *, AMCoeffs *coe, LIGOTimeGPS *ts, AMCoeffsParams *params)
Original antenna-pattern function by S Berukoff.
int main(int argc, char *argv[])
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 ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
void SFTtoUCHARPeakGram(LALStatus *status, UCHARPeakGram *pg, const SFTtype *sft, REAL8 thr)
Convert a normalized sft into a peakgram by selecting bins in which power exceeds a threshold.
void LALComputeDetAMResponse(LALStatus *status, LALDetAMResponse *pResponse, const LALDetAndSource *pDetAndSrc, const LIGOTimeGPS *gps)
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.
#define XLAL_INIT_DECL(var,...)
#define VTOT
Total detector velocity/c TO BE CHANGED DEPENDING ON DETECTOR.
int XLALNormalizeSFTVect(SFTVector *sftVect, UINT4 blockSize, const REAL8 assumeSqrtS)
Function for normalizing a vector of SFTs.
const LALDetector * XLALGetSiteInfo(const CHAR *name)
Find the site geometry-information 'LALDetector' for given a detector name (or prefix).
void XLALDestroySFTVector(SFTVector *vect)
XLAL interface to destroy an SFTVector.
void XLALDestroySFTCatalog(SFTCatalog *catalog)
Free an 'SFT-catalogue'.
CHAR * XLALGetChannelPrefix(const CHAR *name)
Find the valid CW detector prefix.
SFTVector * XLALLoadSFTs(const SFTCatalog *catalog, REAL8 fMin, REAL8 fMax)
Load the given frequency-band [fMin, fMax) (half-open) from the SFT-files listed in the SFT-'catalogu...
SFTCatalog * XLALSFTdataFind(const CHAR *file_pattern, const SFTConstraints *constraints)
Find the list of SFTs matching the file_pattern and satisfying the given constraints,...
COORDINATESYSTEM_EQUATORIAL
void LALAvgDetectorVel(LALStatus *status, REAL8 v[3], VelocityPar *in)
This function outputs the average velocity REAL8 v[3] of the detector during a time interval.
#define XLAL_CHECK_MAIN(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
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
A vector of COMPLEX8FrequencySeries.
COMPLEX8FrequencySeries * data
Pointer to the data array.
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
Three dimensional Cartessian coordinates.
REAL8Cart3Coor * data
x.y.z
UINT4 length
number of elements
An "SFT-catalogue": a vector of SFTdescriptors, as returned by XLALSFTdataFind()
SFTDescriptor * data
array of data-entries describing matched SFTs
UINT4 length
number of SFTs in catalog
'Constraints' for SFT-matching: which detector, within which time-stretch and which timestamps exactl...
CHAR * detector
2-char channel-prefix describing the detector (eg 'H1', 'H2', 'L1', 'G1' etc)
SFTtype header
SFT-header info.
Explicit peakgram structure – 1 if power in bin is above threshold and 0 if below.
UCHAR * data
pointer to the data {0,1}
LIGOTimeGPS epoch
epoch of first series sample
INT4 length
number of elements in data
This structure stores the parameters required by XLALBarycenter() to calculate Earth velocity at a gi...
EphemerisData * edat
ephemeris data pointer from XLALInitBarycenter()
LALDetector detector
the detector
REAL8 tBase
duration of interval
LIGOTimeGPS startTime
start of time interval
REAL8 vTol
fractional accuracy required for velocity (redundant for average velocity calculation)