42#define EARTHEPHEMERIS "/home/badkri/lscsoft/share/lal/earth05-09.dat"
43#define SUNEPHEMERIS "/home/badkri/lscsoft/share/lal/sun05-09.dat"
45#define MAXFILENAMELENGTH 512
47#define DIROUT "./outMulti"
48#define BASENAMEOUT "HM"
52#define FALSEALARM 1.0e-9
53#define SKYFILE "./skypatchfile"
57#define BLOCKSRNGMED 101
67int main(
int argc,
char *argv[] )
111 REAL8 alphaPeak, meanN, sigmaN;
114 BOOLEAN uvar_weighAM, uvar_weighNoise;
117 REAL8 uvar_fStart, uvar_peakThreshold, uvar_fSearchBand;
119 REAL8 uvar_AlphaWeight, uvar_DeltaWeight;
120 CHAR *uvar_earthEphemeris = NULL;
121 CHAR *uvar_sunEphemeris = NULL;
123 CHAR *uvar_timeStampsFile = NULL;
124 CHAR *uvar_outfile = NULL;
134 uvar_weighNoise =
TRUE;
136 uvar_nfSizeCylinder =
NFSIZE;
138 uvar_fSearchBand =
FBAND;
140 uvar_maxBinsClean = 100;
149 uvar_AlphaWeight = uvar_Alpha;
150 uvar_DeltaWeight = uvar_Delta;
153 strcpy( uvar_outfile,
"./tempout" );
174 " - '<SFT file>;<SFT file>;...', where <SFT file> may contain wildcards\n - 'list:<file containing list of SFT files>'" ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
200 if ( uvar_fStart < 0 ) {
201 fprintf( stderr,
"start frequency must be positive\n" );
205 if ( uvar_fSearchBand < 0 ) {
206 fprintf( stderr,
"search frequency band must be positive\n" );
210 if ( uvar_peakThreshold < 0 ) {
211 fprintf( stderr,
"peak selection threshold must be positive\n" );
243 constraints.
timestamps = inputTimeStampsVector;
248 if ( ( catalog == NULL ) || ( catalog->
length == 0 ) ) {
259 mObsCoh = catalog->
length;
280 timeDiffV.
length = mObsCoh;
281 timeDiffV.
data = NULL;
285 doppWings = ( uvar_fStart + uvar_fSearchBand ) *
VTOT;
300 if ( ( fpRand = fopen(
"/dev/urandom",
"r" ) ) == NULL ) {
301 fprintf( stderr,
"Error in opening /dev/urandom" );
305 if ( ( ranCount = fread( &
seed,
sizeof(
seed ), 1, fpRand ) ) != 1 ) {
306 fprintf( stderr,
"Error in getting random seed" );
320 numifo = inputSFTs->
length;
322 sftFminBin = (
INT4 ) floor( inputSFTs->
data[0]->
data[0].
f0 * timeBase + 0.5 );
345 weightsV.
length = mObsCoh;
352 if ( uvar_weighNoise ) {
366 for (
j = 0, iIFO = 0; iIFO < numifo; iIFO++ ) {
370 for ( iSFT = 0; iSFT < numsft; iSFT++,
j++ ) {
376 if ( uvar_weighNoise ) {
387 if ( uvar_weighNoise ) {
392 for (
j = 0;
j < mObsCoh;
j++ ) {
396 if ( uvar_weighNoise ) {
405 if ( uvar_weighAM ) {
418 for (
k = 0, iIFO = 0; iIFO < numifo; iIFO++ ) {
422 for ( iSFT = 0; iSFT < numsft; iSFT++,
k++ ) {
427 b = multiAMcoef->
data[iIFO]->
b->
data[iSFT];
428 weightsV.
data[
k] *= (
a *
a + b * b );
447 pulsarTemplate.
f0 = uvar_Freq;
448 pulsarTemplate.
latitude = uvar_Delta;
466 REAL8 sumWeightSquare;
471 sumWeightSquare = 0.0;
472 for (
k = 0;
k < (
INT4 )mObsCoh;
k++ ) {
473 sumWeightSquare += weightsV.
data[
k] * weightsV.
data[
k];
477 alphaPeak = exp( - uvar_peakThreshold );
478 meanN = mObsCoh * alphaPeak;
479 sigmaN = sqrt( sumWeightSquare * alphaPeak * ( 1.0 - alphaPeak ) );
489 for (
j = 0, iIFO = 0; iIFO < numifo; iIFO++ ) {
492 for ( iSFT = 0; iSFT < numsft; iSFT++,
j++ ) {
494 sft = inputSFTs->
data[iIFO]->
data + iSFT;
498 ind = floor( foft.
data[
j] * timeBase - sftFminBin + 0.5 );
500 numberCount += pg1.
data[ind] * weightsV.
data[
j];
510 fp = fopen(
"./tempout",
"w" );
511 fprintf(
fp,
"%g %g %g\n", ( numberCount - meanN ) / sigmaN, meanN, sigmaN );
512 fprintf( stdout,
"%g %g %g\n", ( numberCount - meanN ) / sigmaN, meanN, sigmaN );
558 REAL8 f0new, vcProdn, timeDiffN;
560 REAL8 sourceDelta, sourceAlpha, cosDelta;
561 INT4 j,
i, nspin, factorialN;
578 sourceDelta = pulsarTemplate->
latitude;
580 cosDelta = cos( sourceDelta );
582 sourceLocation.
x = cosDelta * cos( sourceAlpha );
583 sourceLocation.
y = cosDelta * sin( sourceAlpha );
584 sourceLocation.
z = sin( sourceDelta );
589 for (
j = 0;
j < mObsCoh; ++
j ) {
590 vcProdn = velV->
data[
j].
x * sourceLocation.
x
591 + velV->
data[
j].
y * sourceLocation.
y
592 + velV->
data[
j].
z * sourceLocation.
z;
593 f0new = pulsarTemplate->
f0;
595 timeDiffN = timeDiffV->
data[
j];
597 for (
i = 0;
i < nspin; ++
i ) {
598 factorialN *= (
i + 1 );
599 f0new += pulsarTemplate->
spindown.
data[
i] * timeDiffN / factorialN;
600 timeDiffN *= timeDiffN;
602 f0newBin = floor( f0new * timeBase + 0.5 );
603 foft->
data[
j] = f0newBin * ( 1.0 + vcProdn ) / timeBase;
Header file for non-demodulated Hough search.
#define DRIVEHOUGHCOLOR_MSGENULL
#define DRIVEHOUGHCOLOR_ENULL
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 ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#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.
int main(int argc, char *argv[])
void ComputeFoft(LALStatus *status, REAL8Vector *foft, HoughTemplate *pulsarTemplate, REAL8Vector *timeDiffV, REAL8Cart3CoorVector *velV, REAL8 timeBase)
BOOLEAN uvar_printTemplates
#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)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
REAL4Vector * b
(weighted) per-SFT antenna-pattern function
REAL4Vector * a
(weighted) per-SFT antenna-pattern function
COMPLEX8FrequencySeries * data
Pointer to the data array.
LIGOTimeGPS tGPS
GPS timestamps corresponding to this entry.
DetectorState * data
array of DetectorState entries
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.
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
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.
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
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)
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.
Explicit peakgram structure – 1 if power in bin is above threshold and 0 if below.
UCHAR * data
pointer to the data {0,1}
INT4 length
number of elements in data