39#define EARTHEPHEMERIS "./earth05-09.dat"
40#define SUNEPHEMERIS "./sun05-09.dat"
45#define MAXFILENAMELENGTH 512
47#define DIROUT "./outMulti"
48#define BASENAMEOUT "HM"
49#define TEMPOUT "./tempout"
53#define FALSEALARM 1.0e-9
54#define SKYFILE "./sky1"
58#define BLOCKSRNGMED 101
70int main(
int argc,
char *argv[] )
76 REAL8 scalepow = 1.0e40;
105 BOOLEAN uvar_weighAM, uvar_weighNoise;
106 BOOLEAN uvar_dumpAllW, uvar_dumpRelW, uvar_dumpNoise;
109 CHAR *uvar_timeStampsFile = NULL;
111 REAL8 uvar_AlphaWeight, uvar_DeltaWeight;
112 CHAR *uvar_earthEphemeris = NULL;
113 CHAR *uvar_sunEphemeris = NULL;
116 CHAR *uvar_outfile = NULL;
123 uvar_printLog =
FALSE;
124 uvar_weighAM =
FALSE;
125 uvar_weighNoise =
FALSE;
126 uvar_dumpAllW =
FALSE;
127 uvar_dumpRelW =
FALSE;
128 uvar_dumpNoise =
TRUE;
131 uvar_fSearchBand =
FBAND;
132 uvar_maxBinsClean = 100;
139 uvar_nfSizeCylinder =
NFSIZE;
140 uvar_AlphaWeight = 1.0;
141 uvar_DeltaWeight = 1.0;
144 strcpy( uvar_outfile,
TEMPOUT );
157 " - '<SFT file>;<SFT file>;...', where <SFT file> may contain wildcards\n - 'list:<file containing list of SFT files>'" ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
186 fprintf( stderr,
"start frequency must be positive\n" );
190 if ( uvar_fSearchBand < 0 ) {
191 fprintf( stderr,
"search frequency band must be positive\n" );
196 if ( uvar_printLog ) {
223 constraints.
timestamps = inputTimeStampsVector;
228 if ( ( catalog == NULL ) || ( catalog->
length == 0 ) ) {
239 mObsCoh = catalog->
length;
249 numifo = inputSFTs->
length;
257 for (
k = 0;
k < (
INT4 )numifo;
k++ ) {
267 if ( ( fpRand = fopen(
"/dev/urandom",
"r" ) ) == NULL ) {
268 fprintf( stderr,
"Error in opening /dev/urandom" );
272 if ( ( ranCount = fread( &
seed,
sizeof(
seed ), 1, fpRand ) ) != 1 ) {
273 fprintf( stderr,
"Error in getting random seed" );
301 weightsV.
length = mObsCoh;
317 if ( uvar_weighNoise ) {
321 for (
j = 0, iIFO = 0; iIFO < numifo; iIFO++ ) {
323 for ( iSFT = 0; iSFT < numsft; iSFT++,
j++ ) {
332 if ( uvar_dumpNoise ) {
334 REAL8 sumSn, normPSD, sumSnInv = 0.0;
340 for ( iIFO = 0; iIFO < numifo; iIFO++ ) {
343 for ( iSFT = 0; iSFT < numsft; iSFT++ ) {
347 for (
j = 0;
j < binsSFT;
j++ ) {
351 sumSnInv += binsSFT * binsSFT / ( sumSn * sumSn );
355 sumSnInv = sqrt( sumSnInv );
356 sumSnInv *= ( scalepow / normPSD );
357 sumSnInv = sqrt( sumSnInv );
368 if ( uvar_weighAM ) {
381 for (
k = 0, iIFO = 0; iIFO < numifo; iIFO++ ) {
384 for ( iSFT = 0; iSFT < numsft; iSFT++,
k++ ) {
388 b = multiAMcoef->
data[iIFO]->
b->
data[iSFT];
389 weightsV.
data[
k] *= (
a *
a + b * b );
400 if ( uvar_dumpAllW ) {
403 fp = fopen( uvar_outfile,
"w" );
404 setvbuf(
fp, (
char * )NULL, _IOLBF, 0 );
406 for (
k = 0;
k < (
INT4 )mObsCoh;
k++ ) {
415 if ( uvar_dumpRelW ) {
416 REAL8 *sumweights = NULL;
419 for (
j = 0, iIFO = 0; iIFO < numifo; iIFO++ ) {
422 for ( iSFT = 0; iSFT < numsft; iSFT++,
j++ ) {
423 sumweights[iIFO] += weightsV.
data[
j];
429 for ( iIFO = 0; iIFO < numifo; iIFO++ ) {
430 fprintf( stdout,
"%s %f\n", inputSFTs->
data[iIFO]->
data[0].
name, sumweights[iIFO] / mObsCoh );
464 CHAR *fnameLog = NULL;
474 strcpy( fnameLog,
"./MultiWeight.log" );
477 if ( ( fpLog = fopen( fnameLog,
"w" ) ) == NULL ) {
478 fprintf( stderr,
"Unable to open file %s for writing\n", fnameLog );
486 fprintf( fpLog,
"## LOG FILE FOR Hough Driver\n\n" );
487 fprintf( fpLog,
"# User Input:\n" );
488 fprintf( fpLog,
"#-------------------------------------------\n" );
489 fprintf( fpLog,
"%s", logstr );
498 for (
k = 0;
k < linefiles->
length;
k++ ) {
500 if ( ( fpLog = fopen( fnameLog,
"a" ) ) != NULL ) {
501 CHAR command[1024] =
"";
502 fprintf( fpLog,
"\n\n# Contents of linefile %s :\n", linefiles->
data[
k] );
503 fprintf( fpLog,
"# -----------------------------------------\n" );
505 sprintf( command,
"cat %s >> %s", linefiles->
data[
k], fnameLog );
506 if ( system( command ) ) {
507 fprintf( stderr,
"\nsystem('%s') returned non-zero status!\n\n", command );
514 if ( ( fpLog = fopen( fnameLog,
"a" ) ) != NULL ) {
515 CHAR command[1024] =
"";
516 fprintf( fpLog,
"\n\n# CVS-versions of executable:\n" );
517 fprintf( fpLog,
"# -----------------------------------------\n" );
520 sprintf( command,
"ident %s | sort -u >> %s", executable, fnameLog );
524 if ( system( command ) ) {
525 fprintf( stderr,
"\nsystem('%s') returned non-zero status!\n\n", command );
Header file for non-demodulated Hough search.
void REPORTSTATUS(LALStatus *status)
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 XLAL_CHECK_LAL(sp, assertion,...)
#define ATTATCHSTATUSPTR(statusptr)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
int main(int argc, char *argv[])
BOOLEAN uvar_printTemplates
void PrintLogFile(LALStatus *status, LALStringVector *linefiles, CHAR *executable)
#define MAXFILENAMELENGTH
void XLALDestroyMultiDetectorStateSeries(MultiDetectorStateSeries *mdetStates)
Helper function to get rid of a multi-IFO DetectorStateSeries Note, this is "NULL-robust" in the sens...
MultiDetectorStateSeries * XLALGetMultiDetectorStatesFromMultiSFTs(const MultiSFTVector *multiSFTs, const EphemerisData *edat, REAL8 tOffset)
Get the 'detector state' (ie detector-tensor, position, velocity, etc) for the given multi-vector of ...
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().
void LALHOUGHNormalizeWeights(LALStatus *status, REAL8Vector *weightV)
Normalizes weight factors so that their sum is N.
void LALHOUGHInitializeWeights(LALStatus *status, REAL8Vector *weightV)
Initializes weight factors to unity.
#define VTOT
Total detector velocity/c TO BE CHANGED DEPENDING ON DETECTOR.
MultiPSDVector * XLALNormalizeMultiSFTVect(MultiSFTVector *multsft, UINT4 blockSize, const MultiNoiseFloor *assumeSqrtSX)
Function for normalizing a multi vector of SFTs in a multi IFO search and returns the running-median ...
void XLALDestroyMultiPSDVector(MultiPSDVector *multvect)
Destroy a multi PSD-vector.
MultiNoiseWeights * XLALComputeMultiNoiseWeights(const MultiPSDVector *rngmed, UINT4 blocksRngMed, UINT4 excludePercentile)
Computes weight factors arising from MultiSFTs with different noise floors.
void XLALDestroyMultiNoiseWeights(MultiNoiseWeights *weights)
Destroy a MultiNoiseWeights object.
void LALCreateRandomParams(LALStatus *status, RandomParams **params, INT4 seed)
void LALDestroyRandomParams(LALStatus *status, RandomParams **params)
void LALRemoveKnownLinesInMultiSFTVector(LALStatus *status, MultiSFTVector *MultiSFTVect, INT4 width, INT4 window, LALStringVector *linefiles, RandomParams *randPar)
top level function to remove lines from a multi sft vector given a list of files containing list of k...
void XLALDestroySFTCatalog(SFTCatalog *catalog)
Free an 'SFT-catalogue'.
MultiSFTVector * XLALLoadMultiSFTs(const SFTCatalog *inputCatalog, REAL8 fMin, REAL8 fMax)
Function to load a catalog of SFTs from possibly different detectors.
void XLALDestroyMultiSFTVector(MultiSFTVector *multvect)
Destroy a multi SFT-vector.
SFTCatalog * XLALSFTdataFind(const CHAR *file_pattern, const SFTConstraints *constraints)
Find the list of SFTs matching the file_pattern and satisfying the given constraints,...
LIGOTimeGPSVector * XLALReadTimestampsFile(const CHAR *fname)
backwards compatible wrapper to XLALReadTimestampsFileConstrained() without GPS-time constraints
void XLALDestroyTimestampVector(LIGOTimeGPSVector *vect)
De-allocate a LIGOTimeGPSVector.
COORDINATESYSTEM_EQUATORIAL
#define XLAL_CHECK_MAIN(assertion,...)
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
REAL4Vector * b
(weighted) per-SFT antenna-pattern function
REAL4Vector * a
(weighted) per-SFT antenna-pattern function
COMPLEX8FrequencySeries * data
Pointer to the data array.
UINT4 length
Number of elements in array.
UINT4 length
total number of entries
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
A vector of 'timestamps' of type LIGOTimeGPS.
Multi-IFO container for antenna-pattern coefficients and atenna-pattern matrix .
AMCoeffs ** data
noise-weighted AM-coeffs , and
Multi-IFO time-series of DetectorStates.
DetectorStateSeries ** data
vector of pointers to DetectorStateSeries
One noise-weight (number) per SFT (therefore indexed over IFOs and SFTs.
REAL8Vector ** data
weights-vector for each detector
A collection of PSD vectors – one for each IFO in a multi-IFO search.
PSDVector ** data
sftvector for each ifo
A collection of SFT vectors – one for each IFO in a multi-IFO search.
UINT4 length
number of ifos
SFTVector ** data
sftvector for each ifo
REAL8FrequencySeries * data
Pointer to the data array.
UINT4 length
Number of elements in array.
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)
LIGOTimeGPSVector * timestamps
list of timestamps
LIGOTimeGPS * maxStartTime
only include SFTs whose epoch is < maxStartTime
LIGOTimeGPS * minStartTime
only include SFTs whose epoch is >= minStartTime
SFTtype header
SFT-header info.