53#include <gsl/gsl_math.h>
55#include <lal/LALString.h>
56#include <lal/AVFactories.h>
57#include <lal/LALInitBarycenter.h>
58#include <lal/UserInput.h>
59#include <lal/TranslateAngles.h>
60#include <lal/TranslateMJD.h>
61#include <lal/SFTfileIO.h>
62#include <lal/ExtrapolatePulsarSpins.h>
63#include <lal/FstatisticTools.h>
64#include <lal/NormalizeSFTRngMed.h>
65#include <lal/ComputeFstat.h>
66#include <lal/LALHough.h>
67#include <lal/LogPrintf.h>
68#include <lal/DopplerFullScan.h>
69#include <lal/BinaryPulsarTiming.h>
70#include <lal/TransientCW_utils.h>
71#include <lal/LineRobustStats.h>
72#include <lal/HeapToplist.h>
73#include <lal/LALPulsarVCSInfo.h>
79#define SQ(x) ( (x) * (x) )
85#define MYMAX(x,y) ( (x) > (y) ? (x) : (y) )
86#define MYMIN(x,y) ( (x) < (y) ? (x) : (y) )
89#define LAL_NAN XLALREAL4FailNaN()
216 REAL8 orbitPeriodBand;
219 REAL8 orbitasiniBand;
246 REAL8 metricMismatch;
254 CHAR *outputFstatHist;
260 INT4 NumCandidatesToKeep;
261 REAL8 FracCandidatesToKeep;
262 INT4 clusterOnScanline;
276 CHAR *outputFstatAtoms;
279 CHAR *RankingStatistic;
287 CHAR *outputTransientStats;
288 CHAR *outputTransientStatsAll;
289 CHAR *transient_WindowType;
291 UINT4 transient_t0Offset;
292 UINT4 transient_t0Band;
295 UINT4 transient_tauBand;
300 CHAR *outputFstatTiming;
305 REAL8 allowedMismatchFromSFTLength;
320int main(
int argc,
char *argv[] );
349#define GETTIME XLALGetCPUTime
360int main(
int argc,
char *argv[] )
362 FILE *fpFstat = NULL;
363 LALFILE *fpTransientStats = NULL, *fpTransientStatsAll = NULL;
364 REAL8 numTemplates, templateCounter;
369 gsl_vector_int *Fstat_histogram = NULL;
404 if ( uvar.outputLogfile ) {
409 const UINT4 n_orbitasini = 1 + (
XLALUserVarWasSet( &uvar.dorbitasini ) ? (
UINT4 ) floor( uvar.orbitasiniBand / uvar.dorbitasini ) : 0 );
410 const UINT4 n_orbitPeriod = 1 + (
XLALUserVarWasSet( &uvar.dorbitPeriod ) ? (
UINT4 ) floor( uvar.orbitPeriodBand / uvar.dorbitPeriod ) : 0 );
412 const UINT4 n_orbitArgp = 1 + (
XLALUserVarWasSet( &uvar.dorbitArgp ) ? (
UINT4 ) floor( uvar.orbitArgpBand / uvar.dorbitArgp ) : 0 );
414 const UINT4 n_orbit = n_orbitasini * n_orbitPeriod * n_orbitTp * n_orbitArgp * n_orbitEcc;
418 if ( ( uvar.outputFstat &&
GV.
runSearch ) || uvar.outputGrid ) {
419 if ( uvar.outputGrid ) {
420 XLAL_CHECK_MAIN( ( fpFstat = fopen( uvar.outputGrid,
"wb" ) ) != NULL,
XLAL_ESYS,
"\nError opening file '%s' for writing..\n\n", uvar.outputGrid );
422 XLAL_CHECK_MAIN( ( fpFstat = fopen( uvar.outputFstat,
"wb" ) ) != NULL,
XLAL_ESYS,
"\nError opening file '%s' for writing..\n\n", uvar.outputFstat );
427 char column_headings_string[1024];
429 strcat( column_headings_string,
"freq alpha delta f1dot f2dot f3dot" );
430 if ( !uvar.outputGrid ) {
431 strcat( column_headings_string,
" 2F" );
432 if ( uvar.computeBSGL ) {
433 strcat( column_headings_string,
" log10BSGL" );
435 if ( uvar.outputSingleFstats || uvar.computeBSGL ) {
440 strcat( column_headings_string, headingX );
445 strcat( column_headings_string,
" asini period tp argp ecc" );
447 fprintf( fpFstat,
"%%%% columns:\n%%%% %s\n", column_headings_string );
453 numTemplates *= n_orbit;
454 if ( uvar.countTemplates ) {
455 printf(
"%%%% Number of templates: %0.0f\n", numTemplates );
458 if ( uvar.outputGrid ) {
460 for (
UINT4 i_orbitasini = 0; i_orbitasini < n_orbitasini; ++i_orbitasini ) {
461 for (
UINT4 i_orbitPeriod = 0; i_orbitPeriod < n_orbitPeriod; ++i_orbitPeriod ) {
462 for (
UINT4 i_orbitTp = 0; i_orbitTp < n_orbitTp; ++i_orbitTp ) {
463 for (
UINT4 i_orbitArgp = 0; i_orbitArgp < n_orbitArgp; ++i_orbitArgp ) {
464 for (
UINT4 i_orbitEcc = 0; i_orbitEcc < n_orbitEcc; ++i_orbitEcc ) {
465 dopplerpos.asini = uvar.orbitasini + i_orbitasini * uvar.dorbitasini;
466 dopplerpos.period = uvar.orbitPeriod + i_orbitPeriod * uvar.dorbitPeriod;
467 dopplerpos.tp = uvar.orbitTp;
468 XLALGPSAdd( &dopplerpos.tp, i_orbitTp * uvar.dorbitTp );
469 dopplerpos.argp = uvar.orbitArgp + i_orbitArgp * uvar.dorbitArgp;
470 dopplerpos.ecc = uvar.orbitEcc + i_orbitEcc * uvar.dorbitEcc;
473 thisFCand.doppler = dopplerpos;
474 thisFCand.doppler.fkdot[0] += iFreq *
GV.
dFreq;
491 XLAL_CHECK_MAIN( ( fpTransientStats =
XLALFileOpen( uvar.outputTransientStats,
"wb" ) ) != NULL,
XLAL_ESYS,
"\nError opening file '%s' for writing..\n\n", uvar.outputTransientStats );
496 if ( uvar.outputTransientStatsAll &&
GV.
runSearch ) {
497 XLAL_CHECK_MAIN( ( fpTransientStatsAll =
XLALFileOpen( uvar.outputTransientStatsAll,
"wb" ) ) != NULL,
XLAL_ESYS,
"\nError opening file '%s' for writing..\n\n", uvar.outputTransientStatsAll );
505 gsl_vector_int_set_zero( Fstat_histogram );
512 templateCounter = 0.0;
516 REAL8 tic0, tic, toc, timeOfLastProgressUpdate = 0;
524 for (
UINT4 i_orbitasini = 0; i_orbitasini < n_orbitasini; ++i_orbitasini ) {
525 for (
UINT4 i_orbitPeriod = 0; i_orbitPeriod < n_orbitPeriod; ++i_orbitPeriod ) {
526 for (
UINT4 i_orbitTp = 0; i_orbitTp < n_orbitTp; ++i_orbitTp ) {
527 for (
UINT4 i_orbitArgp = 0; i_orbitArgp < n_orbitArgp; ++i_orbitArgp ) {
528 for (
UINT4 i_orbitEcc = 0; i_orbitEcc < n_orbitEcc; ++i_orbitEcc ) {
530 dopplerpos.asini = uvar.orbitasini + i_orbitasini * uvar.dorbitasini;
531 dopplerpos.period = uvar.orbitPeriod + i_orbitPeriod * uvar.dorbitPeriod;
532 dopplerpos.tp = uvar.orbitTp;
533 XLALGPSAdd( &dopplerpos.tp, i_orbitTp * uvar.dorbitTp );
534 dopplerpos.argp = uvar.orbitArgp + i_orbitArgp * uvar.dorbitArgp;
535 dopplerpos.ecc = uvar.orbitEcc + i_orbitEcc * uvar.dorbitEcc;
543 timing.tauFstat += ( toc - tic );
546 templateCounter += 1.0;
547 if (
LogLevel() >=
LOG_NORMAL && ( ( toc - timeOfLastProgressUpdate ) > uvar.timerCount ) ) {
549 REAL8 taup = diffSec / templateCounter ;
550 REAL8 timeLeft = ( numTemplates - templateCounter ) * taup;
552 templateCounter, numTemplates, templateCounter / numTemplates * 100.0, timeLeft );
553 timeOfLastProgressUpdate = toc;
563 thisFCand.doppler = dopplerpos;
564 thisFCand.doppler.fkdot[0] += iFreq *
GV.
dFreq;
565 thisFCand.twoF = Fstat_res->
twoF[iFreq];
568 for (
UINT4 X = 0; X < thisFCand.numDetectors; ++X ) {
569 thisFCand.twoFX[X] = Fstat_res->
twoFPerDet[X][iFreq];
572 thisFCand.numDetectors = 0;
576 thisFCand.Fa = Fstat_res->
Fa[iFreq];
577 thisFCand.Fb = Fstat_res->
Fb[iFreq];
581 thisFCand.Mmunu = Fstat_res->
Mmunu;
588 if ( !isfinite( thisFCand.twoF ) ) {
590 thisFCand.twoF, creal( thisFCand.Fa ), cimag( thisFCand.Fa ), creal( thisFCand.Fb ), cimag( thisFCand.Fb ) );
592 thisFCand.doppler.Alpha, thisFCand.doppler.Delta,
593 thisFCand.doppler.fkdot[0], thisFCand.doppler.fkdot[1], thisFCand.doppler.fkdot[2], thisFCand.doppler.fkdot[3] );
594 if ( thisFCand.doppler.asini > 0 ) {
596 thisFCand.doppler.tp.gpsSeconds, thisFCand.doppler.tp.gpsNanoSeconds,
597 thisFCand.doppler.argp, thisFCand.doppler.asini,
598 thisFCand.doppler.ecc, thisFCand.doppler.period );
603 if ( uvar.computeBSGL ) {
620 isOver2FThreshold =
TRUE;
624 isOverBSGLthreshold =
FALSE;
626 if ( is1DlocalMax && isOver2FThreshold && isOverBSGLthreshold ) {
633 if ( uvar.computeBSGL ) {
634 LogPrintfVerbatim(
LOG_DEBUG,
", 2F_H1 = %f, 2F_L1 = %f, log10BSGL = %f", writeCand->twoFX[0], writeCand->twoFX[1], writeCand->log10BSGL );
637 LogPrintf(
LOG_DEBUG,
"NOT added the candidate into toplist: 2F = %f", writeCand->twoF );
638 if ( uvar.computeBSGL ) {
639 LogPrintfVerbatim(
LOG_DEBUG,
", 2F_H1 = %f, 2F_L1 = %f, log10BSGL = %f", writeCand->twoFX[0], writeCand->twoFX[1], writeCand->log10BSGL );
643 }
else if ( fpFstat ) {
655 if ( thisFCand.twoF > loudestFCand.twoF ) {
656 loudestFCand = thisFCand;
660 if ( thisFCand.log10BSGL > loudestFCand.log10BSGL ) {
661 loudestFCand = thisFCand;
670 if ( uvar.outputFstatHist ) {
673 const size_t bin = thisFCand.twoF / uvar.FstatHistBin;
676 if ( !Fstat_histogram || bin >= Fstat_histogram->size ) {
681 gsl_vector_int_set( Fstat_histogram, bin,
682 gsl_vector_int_get( Fstat_histogram, bin ) + 1 );
689 if ( uvar.outputFstatAtoms ) {
690 LALFILE *fpFstatAtoms = NULL;
691 CHAR *fnameAtoms = NULL;
696 len = strlen( uvar.outputFstatAtoms ) + strlen( dopplerName ) + 10;
698 sprintf( fnameAtoms,
"%s_%s.dat", uvar.outputFstatAtoms, dopplerName );
712 if ( fpTransientStats || fpTransientStatsAll ) {
719 timing.tauTransFstatMap += ( toc - tic );
726 timing.tauTransMarg += ( toc - tic );
729 pdf1D_t *pdf_t0 = NULL;
730 pdf1D_t *pdf_tau = NULL;
735 if ( fpTransientStats ) {
746 timing.NStart = transientCand.FstatMap->F_mn->size1;
747 timing.NTau = transientCand.FstatMap->F_mn->size2;
750 transientCand.doppler = dopplerpos;
753 if ( fpTransientStats ) {
758 if ( fpTransientStatsAll ) {
774 timing.tauTemplate += ( toc - tic0 );
802 timing.tauFstat /= num_templates;
803 timing.tauTemplate /= num_templates;
804 timing.tauF0 = timing.tauFstat / timing.NSFTs;
805 timing.tauTransFstatMap /= num_templates;
806 timing.tauTransMarg /= num_templates;
816 if ( (
fp = fopen( uvar.outputFstatTiming,
"rb" ) ) != NULL ) {
818 XLAL_CHECK( (
fp = fopen( uvar.outputFstatTiming,
"ab" ) ),
XLAL_ESYS,
"Failed to open existing timing-file '%s' for appending\n", uvar.outputFstatTiming );
821 XLAL_CHECK( (
fp = fopen( uvar.outputFstatTiming,
"wb" ) ),
XLAL_ESYS,
"Failed to open new timing-file '%s' for writing\n", uvar.outputFstatTiming );
846 LogPrintf(
LOG_CRITICAL,
"Internal consistency problems with toplist: contains fewer elements than expected!\n" );
858 fprintf( fpFstat,
"%%DONE\n" );
869 pulsarParams.Doppler = loudestFCand.doppler;
873 XLAL_CHECK_MAIN( ( fpLoudest = fopen( uvar.outputLoudest,
"wb" ) ) != NULL,
XLAL_ESYS,
"Error opening file '%s' for writing..\n\n", uvar.outputLoudest );
882 gsl_matrix_free( pulsarParams.AmpFisherMatrix );
892 FILE *fpFstatHist = fopen( uvar.outputFstatHist,
"wb" );
897 for (
i = 0;
i < Fstat_histogram->size; ++
i )
898 fprintf( fpFstatHist,
"%0.3f %0.3f %i\n",
899 uvar.FstatHistBin *
i,
900 uvar.FstatHistBin * (
i + 1 ),
901 gsl_vector_int_get( Fstat_histogram,
i ) );
903 fprintf( fpFstatHist,
"%%DONE\n" );
904 fclose( fpFstatHist );
914 if ( Fstat_histogram ) {
915 gsl_vector_int_free( Fstat_histogram );
936 uvar->FreqBand = 0.0;
941 uvar->skyRegion = NULL;
947 uvar->assumeSqrtSX = NULL;
948 uvar->UseNoiseWeights =
TRUE;
951 uvar->dAlpha = 0.001;
952 uvar->dDelta = 0.001;
959 uvar->orbitasini = 0 ;
961 uvar->TwoFthreshold = 0.0;
962 uvar->NumCandidatesToKeep = 0;
963 uvar->FracCandidatesToKeep = 0.0;
964 uvar->clusterOnScanline = 0;
967 uvar->projectMetric =
TRUE;
970 uvar->metricMismatch = 0.02;
972 uvar->outputLogfile = NULL;
973 uvar->outputFstat = NULL;
974 uvar->outputLoudest = NULL;
976 uvar->outputFstatHist = NULL;
977 uvar->FstatHistBin = 0.1;
979 uvar->countTemplates =
FALSE;
981 uvar->gridFile = NULL;
992 uvar->timerCount = 10;
994 uvar->strictSpindownBounds =
FALSE;
996 uvar->spindownAge = 0.0;
997 uvar->minBraking = 0.0;
998 uvar->maxBraking = 0.0;
1002 uvar->outputSingleFstats =
FALSE;
1005 uvar->computeBSGL =
FALSE;
1006 uvar->BSGLlogcorr =
TRUE;
1012 uvar->transient_useFReg = 0;
1014 uvar->allowedMismatchFromSFTLength = 0;
1015 uvar->injectionSources = NULL;
1016 uvar->injectSqrtSX = NULL;
1018 uvar->timestampsFiles = NULL;
1020 uvar->Tsft = 1800.0;
1023 XLALRegisterUvarMember(
Alpha, RAJ,
'a', OPTIONAL,
"Sky: equatorial J2000 right ascension (in radians or hours:minutes:seconds)" );
1024 XLALRegisterUvarMember(
Delta, DECJ,
'd', OPTIONAL,
"Sky: equatorial J2000 declination (in radians or degrees:minutes:seconds)" );
1025 XLALRegisterUvarMember( skyRegion,
STRING,
'R', OPTIONAL,
"ALTERNATIVE: Sky-region polygon '(Alpha1,Delta1),(Alpha2,Delta2),...' or 'allsky'" );
1032 XLALRegisterUvarMember( AlphaBand, RAJ,
'z', OPTIONAL,
"Sky: search band from Alpha to Alpha+AlphaBand (in radians or h:m:s)" );
1033 XLALRegisterUvarMember( DeltaBand, DECJ,
'c', OPTIONAL,
"Sky: search band from Delta to Delta+DeltaBand (in radians or d:m:s)" );
1046 XLALRegisterUvarMember( orbitasini,
REAL8, 0, OPTIONAL,
"Binary Orbit: Projected semi-major axis in light-seconds [Default: 0.0]" );
1048 XLALRegisterUvarMember( orbitTp, EPOCH, 0, OPTIONAL,
"Binary Orbit: (true) epoch of periapsis: use 'xx.yy[GPS|MJD]' format." );
1052 XLALRegisterUvarMember( orbitasiniBand,
REAL8, 0, OPTIONAL,
"Binary Orbit: Band in Projected semi-major axis in light-seconds [Default: 0.0]" );
1054 XLALRegisterUvarMember( orbitTpBand,
REAL8, 0, OPTIONAL,
"Binary Orbit: Band in (true) epoch of periapsis: use 'xx.yy[GPS|MJD]' format." );
1058 XLALRegisterUvarMember( dorbitasini,
REAL8, 0, OPTIONAL,
"Binary Orbit: Spacing in Projected semi-major axis in light-seconds [Default: 0.0]" );
1060 XLALRegisterUvarMember( dorbitTp,
REAL8, 0, OPTIONAL,
"Binary Orbit: Spacing in (true) epoch of periapsis: use 'xx.yy[GPS|MJD]' format." );
1064 XLALRegisterUvarMember( DataFiles,
STRING,
'D', OPTIONAL,
"File-pattern specifying (also multi-IFO) input SFT-files. Possibilities are:\n"
1065 " - '<SFT file>;<SFT file>;...', where <SFT file> may contain wildcards\n - 'list:<file containing list of SFT files>'" );
1067 XLALRegisterUvarMember( assumeSqrtSX, STRINGVector, 0, OPTIONAL,
"Don't estimate noise-floors but assume (stationary) per-IFO sqrt{SX} (if single value: use for all IFOs).\nNote that, unlike the historic --SignalOnly flag, this option will not lead to explicitly adding a +4 'correction' for noiseless SFTs to the output F-statistic." );
1070 XLALRegisterUvarMember( gridType,
INT4, 0, OPTIONAL,
"Grid: 0=flat, 1=isotropic, 2=metric, 3=skygrid-file, 6=grid-file, 8=spin-square, 9=spin-age-brk" );
1075 XLALRegisterUvarMember( refTime, EPOCH, 0, OPTIONAL,
"Reference SSB epoch for pulsar-parameters: use 'xx.yy[GPS|MJD]' format [Default: startTime]" );
1085 XLALRegisterUvarMember( clusterOnScanline,
INT4, 0, OPTIONAL,
"Neighbors on each side for finding 1D local maxima on scanline" );
1087 XLALRegisterUvarMember( minStartTime, EPOCH, 0, OPTIONAL,
"Only use SFTs with timestamps starting from (including) this epoch (format 'xx.yy[GPS|MJD]') " );
1088 XLALRegisterUvarMember( maxStartTime, EPOCH, 0, OPTIONAL,
"Only use SFTs with timestamps up to (excluding) this epoch (format 'xx.yy[GPS|MJD]')" );
1090 XLALRegisterUvarMember( outputFstatAtoms,
STRING, 0, OPTIONAL,
"Output filename *base* for F-statistic 'atoms' {a,b,Fa,Fb}_alpha. One file per doppler-point." );
1097 XLALRegisterUvarMember( oLGX, STRINGVector, 0, OPTIONAL,
"BSGL: prior per-detector line-vs-Gauss odds 'oLGX' (Defaults to oLGX=1/Ndet)" );
1103 XLALRegisterUvarMember( outputTransientStatsAll,
STRING, 0, DEVELOPER,
"TransientCW: Output filename for transient-CW statistics -- including the whole (t0,tau) grid for each candidate -- WARNING: CAN BE HUGE!." );
1104 XLALRegisterUvarMember( transient_WindowType,
STRING, 0, OPTIONAL,
"TransientCW: Type of transient signal window to use. ('none', 'rect', 'exp')." );
1105 XLALRegisterUvarMember( transient_t0Epoch, EPOCH, 0, OPTIONAL,
"TransientCW: Earliest start-time for transient window search, in seconds (format 'xx.yy[GPS|MJD]')" );
1106 XLALRegisterUvarMember( transient_t0Offset,
UINT4, 0, OPTIONAL,
"TransientCW: Earliest start-time for transient window search, as offset in seconds from dataStartGPS" );
1107 XLALRegisterUvarMember( transient_t0Band,
UINT4, 0, OPTIONAL,
"TransientCW: Range of GPS start-times to search in transient search, in seconds" );
1108 XLALRegisterUvarMember( transient_dt0,
INT4, 0, OPTIONAL,
"TransientCW: Step-size in transient-CW start-time in seconds [Default:Tsft]" );
1110 XLALRegisterUvarMember( transient_tauBand,
UINT4, 0, OPTIONAL,
"TransientCW: Range of transient-CW duration timescales to search, in seconds" );
1111 XLALRegisterUvarMember( transient_dtau,
INT4, 0, OPTIONAL,
"TransientCW: Step-size in transient-CW duration timescale, in seconds [Default:Tsft]" );
1126 XLALRegisterUvarMember( Dterms,
INT4,
't', DEVELOPER,
"Number of kernel terms (single-sided) to use in\na) Dirichlet kernel if FstatMethod=Demod*\nb) sinc-interpolation kernel if FstatMethod=Resamp*" );
1133 XLALRegisterUvarMember( strictSpindownBounds,
BOOLEAN, 0, DEVELOPER,
"suppress spindown grid points outside the [fkdot,fkdotBand] ranges? (only supported for --gridType=8)" );
1139 XLALRegisterUvarMember( transient_useFReg,
BOOLEAN, 0, DEVELOPER,
"FALSE: use 'standard' e^F for marginalization, if TRUE: use e^FReg = (1/D)*e^F (BAD)" );
1142 XLALRegisterUvarMember( outputFstatTiming,
STRING, 0, DEVELOPER,
"Append F-statistic timing measurements and parameters into this file" );
1144 XLALRegisterUvarMember( resampFFTPowerOf2,
BOOLEAN, 0, DEVELOPER,
"For Resampling methods: enforce FFT length to be a power of two (by rounding up)" );
1146 XLALRegisterUvarMember( allowedMismatchFromSFTLength,
REAL8, 0, DEVELOPER,
"Maximum allowed mismatch from SFTs being too long [Default: what's hardcoded in XLALFstatMaximumSFTLength]" );
1150 XLALRegisterUvarMember( injectSqrtSX, STRINGVector, 0, DEVELOPER,
"Generate Gaussian Noise SFTs on-the-fly: CSV list of detectors' noise-floors sqrt{Sn}" );
1151 XLALRegisterUvarMember(
IFOs, STRINGVector, 0, DEVELOPER,
"CSV list of detectors, eg. \"H1,H2,L1,G1, ...\", when no SFT files are specified" );
1153 "Files containing timestamps for the generated SFTs when using "UVAR_STR( injectSqrtSX )
". "
1154 "Arguments correspond to the detectors given by " UVAR_STR(
IFOs )
1155 "; for example, if " UVAR_STR(
IFOs )
" is set to 'H1,L1', then an argument of "
1156 "'t1.txt,t2.txt' to this option will read H1 timestamps from the file 't1.txt', and L1 timestamps from the file 't2.txt'. "
1157 "The timebase of the generated SFTs is specified by " UVAR_STR(
Tsft )
". "
1159 XLALRegisterUvarMember(
Tsft,
REAL8, 0, DEVELOPER,
"Generate SFTs with this timebase (in seconds) instead of loading from files. Requires --injectSqrtSX, --IFOs, --timestampsFiles" );
1174 REAL8 fCoverMin, fCoverMax;
1178 size_t toplist_length = uvar->NumCandidatesToKeep;
1181 cfg->
runSearch = !( uvar->countTemplates || uvar->outputGrid );
1182 XLAL_CHECK( cfg->
runSearch || !( uvar->outputFstat || uvar->outputFstatAtoms || uvar->outputFstatHist || uvar->outputFstatTiming || uvar->outputLoudest || uvar->outputTransientStats || uvar->outputTransientStatsAll ),
XLAL_EINVAL,
"Invalid input: --countTemplates or --outputGrid means that no search is actually run, so we can't do any of --outputFstat --outputFstatAtoms --outputFstatHist --outputFstatTiming --outputLoudest --outputTransientStats --outputTransientStatsAll" );
1185 XLAL_CHECK( chdir( uvar->workingDir ) == 0,
XLAL_EINVAL,
"Unable to change directory to workinDir '%s'\n", uvar->workingDir );
1192 XLAL_ERROR(
XLAL_EINVAL,
"\nUse of resampling FstatMethod is incompatible with non-factored gridType=%i\n\n", uvar->gridType );
1196 if ( uvar->IFOs != NULL ) {
1202 constraints.minStartTime = &minStartTime;
1203 constraints.maxStartTime = &maxStartTime;
1206 if ( uvar->timestampsFiles != NULL ) {
1217 if ( uvar->DataFiles != NULL ) {
1247 refTime = uvar->refTime;
1253 cfg->
Alpha = uvar->Alpha;
1254 cfg->
Delta = uvar->Delta;
1257 REAL8 fMin, fMax, f1dotMin, f1dotMax, f2dotMin, f2dotMax, f3dotMin, f3dotMax;
1259 fMin =
MYMIN( uvar->Freq, uvar->Freq + uvar->FreqBand );
1260 fMax =
MYMAX( uvar->Freq, uvar->Freq + uvar->FreqBand );
1278 f1dotMin = -1.0 * fMax / ( ( uvar->minBraking - 1.0 ) * uvar->spindownAge );
1279 f1dotMax = -1.0 *
fMin / ( ( uvar->maxBraking - 1.0 ) * uvar->spindownAge );
1281 f2dotMin = uvar->minBraking * ( f1dotMax * f1dotMax ) / fMax;
1282 f2dotMax = uvar->maxBraking * ( f1dotMin * f1dotMin ) /
fMin;
1286 f1dotMin =
MYMIN( uvar->f1dot, uvar->f1dot + uvar->f1dotBand );
1287 f1dotMax =
MYMAX( uvar->f1dot, uvar->f1dot + uvar->f1dotBand );
1289 f2dotMin =
MYMIN( uvar->f2dot, uvar->f2dot + uvar->f2dotBand );
1290 f2dotMax =
MYMAX( uvar->f2dot, uvar->f2dot + uvar->f2dotBand );
1294 f3dotMin =
MYMIN( uvar->f3dot, uvar->f3dot + uvar->f3dotBand );
1295 f3dotMax =
MYMAX( uvar->f3dot, uvar->f3dot + uvar->f3dotBand );
1303 if ( uvar->skyRegion ) {
1306 }
else if ( haveAlphaDelta ) {
1308 }
else if ( !uvar->gridFile ) {
1309 XLAL_ERROR(
XLAL_EINVAL,
"\nCould not setup searchRegion, have neither skyRegion nor (Alpha, Delta) nor a gridFile!\n\n" );
1328 if ( uvar->injectionSources != NULL ) {
1352 scanInit.
gridType = uvar->gridType;
1353 scanInit.
gridFile = uvar->gridFile;
1369 scanInit.
extraArgs[0] = !uvar->strictSpindownBounds;
1371 scanInit.
extraArgs[0] = uvar->spindownAge;
1372 scanInit.
extraArgs[1] = uvar->minBraking;
1373 scanInit.
extraArgs[2] = uvar->maxBraking;
1383 const REAL8 binaryMaxAsini =
MYMAX( uvar->orbitasini, uvar->orbitasini + uvar->orbitasiniBand );
1384 const REAL8 binaryMinPeriod =
MYMIN( uvar->orbitPeriod, uvar->orbitPeriod + uvar->orbitPeriodBand );
1385 const REAL8 binaryMaxEcc =
MYMAX( uvar->orbitEcc, uvar->orbitEcc + uvar->orbitEccBand );
1398 spinRangeRef.
fkdotBand[0] = tmpFreqBandRef;
1413 XLAL_CHECK(
XLALFstatCheckSFTLengthMismatch( cfg->
Tsft, fCoverMax, binaryMaxAsini, binaryMinPeriod, uvar->allowedMismatchFromSFTLength ) ==
XLAL_SUCCESS,
XLAL_EFUNC,
"Excessive mismatch would be incurred due to SFTs being too long for the current search setup. Please double-check your parameter ranges or provide shorter input SFTs. If you really know what you're doing, you could also consider using the --allowedMismatchFromSFTLength override." );
1420 if ( uvar->assumeSqrtSX != NULL ) {
1422 assumeSqrtSX = &s_assumeSqrtSX;
1424 assumeSqrtSX = NULL;
1428 cfg->
dFreq = uvar->dFreq;
1441 if ( uvar->injectSqrtSX != NULL ) {
1443 injectSqrtSX = &s_injectSqrtSX;
1447 optionalArgs.
Dterms = uvar->Dterms;
1448 optionalArgs.
SSBprec = uvar->SSBprecision;
1495 if ( 0.0 < uvar->FracCandidatesToKeep && uvar->FracCandidatesToKeep <= 1.0 ) {
1497 XLAL_ERROR(
XLAL_EINVAL,
"Cannot use FracCandidatesToKeep because number of templates was counted to be zero!\n" );
1503 if ( toplist_length > 0 ) {
1504 if ( strcmp( uvar->RankingStatistic,
"F" ) == 0 ) {
1506 }
else if ( strcmp( uvar->RankingStatistic,
"BSGL" ) == 0 ) {
1507 if ( !uvar->computeBSGL ) {
1512 XLAL_ERROR(
XLAL_EINVAL,
"\nERROR: Invalid value specified for candidate ranking - supported are 'F' and 'BSGL'.\n\n" );
1537 ),
XLAL_EINVAL,
"ERROR: transientWindow->type == NONE, but window-parameters were set! Use a different window-type!" );
1571 if ( ( uvar->outputFstatAtoms != NULL ) || ( uvar->outputTransientStats != NULL ) || ( uvar->outputTransientStatsAll != NULL ) ) {
1576 if ( uvar->outputSingleFstats || uvar->computeBSGL ) {
1581 if ( uvar->computeBSGL ) {
1584 REAL4 *oLGX_p = NULL;
1586 if ( uvar->oLGX != NULL ) {
1612 CHAR *logstr = NULL;
1639 struct tm startTimeUTC = *
XLALGPSToUTC( &startTimeUTC, startTimeSeconds );
1642 startTimeUTCString[strlen( startTimeUTCString ) - 1] = 0;
1679 XLAL_CHECK( ( fplog = fopen( log_fname,
"wb" ) ) != NULL,
XLAL_ESYS,
"Failed to open log-file '%s' for writing.\n\n", log_fname );
1681 fprintf( fplog,
"%%%% LOG-FILE for ComputeFstatistic run\n\n" );
1682 fprintf( fplog,
"%s", log_string );
1756 XLALPrintError(
"\nNegative value of stepsize dAlpha not allowed!\n\n" );
1760 XLALPrintError(
"\nNegative value of stepsize dDelta not allowed!\n\n" );
1764 XLALPrintError(
"\nNegative value of stepsize dFreq not allowed!\n\n" );
1770 XLALPrintError(
"\nNegative or zero value of orbital period not allowed!\n\n" );
1774 XLALPrintError(
"\nNegative value of projected orbital semi-major axis not allowed!\n\n" );
1778 XLALPrintError(
"\nOrbital argument of periapse must lie in range [0 2*PI)!\n\n" );
1782 XLALPrintError(
"\nNegative value of orbital eccentricity not allowed!\n\n" );
1790 BOOLEAN haveSkyRegion, haveAlphaDelta, haveGridFile;
1791 BOOLEAN useSkyGridFile, useFullGridFile, haveMetric, useMetric;
1793 haveSkyRegion = ( uvar->skyRegion != NULL );
1795 haveGridFile = ( uvar->gridFile != NULL );
1801 if ( !useFullGridFile && !useSkyGridFile && haveGridFile ) {
1802 XLALPrintError(
"\nERROR: gridFile was specified but not needed for gridType=%d\n\n", uvar->gridType );
1805 if ( useSkyGridFile && !haveGridFile ) {
1806 XLALPrintError(
"\nERROR: gridType=SKY-FILE, but no --gridFile specified!\n\n" );
1809 if ( useFullGridFile && !haveGridFile ) {
1810 XLALPrintError(
"\nERROR: gridType=GRID-FILE, but no --gridFile specified!\n\n" );
1814 if ( ( haveAlphaBand && !haveDeltaBand ) || ( haveDeltaBand && !haveAlphaBand ) ) {
1815 XLALPrintError(
"\nERROR: Need either BOTH (AlphaBand, DeltaBand) or NONE.\n\n" );
1819 if ( haveSkyRegion && haveAlphaDelta ) {
1820 XLALPrintError(
"\nOverdetermined sky-region: only use EITHER (Alpha,Delta) OR skyRegion!\n\n" );
1823 if ( !haveSkyRegion && !haveAlphaDelta && !useSkyGridFile && !useFullGridFile ) {
1824 XLALPrintError(
"\nUnderdetermined sky-region: use one of (Alpha,Delta), skyRegion or a gridFile!\n\n" );
1828 if ( !useMetric && haveMetric ) {
1829 XLALPrintWarning(
"\nWARNING: Metric was specified for non-metric grid... will be ignored!\n" );
1831 if ( useMetric && !haveMetric ) {
1832 XLALPrintError(
"\nERROR: metric grid-type selected, but no metricType selected\n\n" );
1840 if ( uvar->dFreq != 0.0 || uvar->df1dot != 0.0 || uvar->df2dot != 0.0 || uvar->df3dot != 0.0 ) {
1841 XLALPrintError(
"\nERROR: dFreq and df{1,2,3}dot cannot be used with gridType={8,9}\n\n" );
1848 XLALPrintError(
"\nERROR: strictSpindownBounds can only be used with gridType=8\n\n" );
1856 if ( uvar->f3dot != 0.0 || uvar->f3dotBand != 0.0 ) {
1857 XLALPrintError(
"\nERROR: f3dot and f3dotBand cannot be used with gridType=9\n\n" );
1862 if ( uvar->spindownAge <= 0.0 ) {
1863 XLALPrintError(
"\nERROR: spindownAge must be strictly positive with gridType=9\n\n" );
1866 if ( uvar->minBraking <= 0.0 ) {
1867 XLALPrintError(
"\nERROR: minBraking must be strictly positive with gridType=9\n\n" );
1870 if ( uvar->maxBraking <= 0.0 ) {
1871 XLALPrintError(
"\nERROR: minBraking must be strictly positive with gridType=9\n\n" );
1874 if ( uvar->minBraking >= uvar->maxBraking ) {
1875 XLALPrintError(
"\nERROR: minBraking must be strictly less than maxBraking with gridType=9\n\n" );
1880 if ( uvar->f1dot != 0.0 || uvar->f1dotBand != 0.0 ) {
1881 XLALPrintError(
"\nERROR: f1dot and f1dotBand cannot be used with gridType=9\n\n" );
1884 if ( uvar->f2dot != 0.0 || uvar->f2dotBand != 0.0 ) {
1885 XLALPrintError(
"\nERROR: f2dot and f2dotBand cannot be used with gridType=9\n\n" );
1895 XLALPrintError(
"\nERROR: NumCandidatesToKeep and FracCandidatesToKeep are mutually exclusive\n\n" );
1898 if (
XLALUserVarWasSet( &uvar->FracCandidatesToKeep ) && ( uvar->FracCandidatesToKeep <= 0.0 || 1.0 < uvar->FracCandidatesToKeep ) ) {
1899 XLALPrintError(
"\nERROR: FracCandidatesToKeep must be greater than 0.0 and less than or equal to 1.0\n\n" );
1904 XLAL_CHECK( ( uvar->DataFiles == NULL ) ^ ( uvar->injectSqrtSX == NULL ),
XLAL_EINVAL,
"Must pass exactly one out of --DataFiles or --injectSqrtSX \n" );
1905 if ( uvar->DataFiles != NULL ) {
1910 if ( uvar->injectSqrtSX != NULL ) {
1911 XLAL_CHECK( uvar->timestampsFiles != NULL && uvar->IFOs != NULL,
XLAL_EINVAL,
"--injectSqrtSX requires --IFOs, --timestampsFiles \n" );
1927 if ( !fname || !amcoe || !amcoe->
a || !amcoe->
b || !detStates ) {
1932 if ( ( len != amcoe->
b->
length ) || ( len != detStates->
length ) ) {
1936 if ( (
fp = fopen( fname,
"wb" ) ) == NULL ) {
1940 for (
i = 0;
i < len;
i ++ ) {
1962 if ( !
fp || !pulsarParams || !Fcand ) {
1996 if ( (
h0 + dh0 ) > 0 ) {
2005 fprintf(
fp,
"dcosi = % .6g;\n", dcosi );
2038 fprintf(
fp,
"Fa = % .6g %+.6gi;\n", creal( Fcand->
Fa ), cimag( Fcand->
Fa ) );
2039 fprintf(
fp,
"Fb = % .6g %+.6gi;\n", creal( Fcand->
Fb ), cimag( Fcand->
Fb ) );
2043 for ( X = 0; X <
numDet ; X ++ ) {
2064 if ( twoF1 < twoF2 ) {
2066 }
else if ( twoF1 > twoF2 ) {
2080 if ( BSGL1 < BSGL2 ) {
2082 }
else if ( BSGL1 > BSGL2 ) {
2098 if ( !
fp || !thisFCand ) {
2103 fprintf(
fp,
"%.16g %.16g %.16g %.16g %.16g %.16g",
2107 if ( output_stats ) {
2109 char extraStatsStr[256] =
"";
2113 snprintf( extraStatsStr,
sizeof( extraStatsStr ),
" %.9g", thisFCand->
log10BSGL );
2117 snprintf( buf0,
sizeof( buf0 ),
" %.9g", thisFCand->
twoFX[X] );
2118 UINT4 len1 = strlen( extraStatsStr ) + strlen( buf0 ) + 1;
2119 if ( len1 >
sizeof( extraStatsStr ) ) {
2120 XLAL_ERROR(
XLAL_EINVAL,
"assembled output string too long! (%d > %zu)\n", len1,
sizeof( extraStatsStr ) );
2123 strcat( extraStatsStr, buf0 );
2129 if ( output_orbit ) {
2130 fprintf(
fp,
" %.16g %.16g %.16g %.16g %.16g",
2156 UINT4 windowLen = 1 + 2 * windowWings;
2172 if ( !scanlineWindow ) {
2176 if ( scanlineWindow->
window ) {
2194 if ( !nextCand || !scanWindow || !scanWindow->
window ) {
2198 for (
i = 1;
i < scanWindow->
length;
i ++ ) {
2202 scanWindow->
window[ scanWindow->
length - 1 ] = *nextCand;
2215 if ( !scanWindow || !scanWindow->
center ) {
2240 XLALPrintError(
"Unsupported ranking statistic '%d' ! Supported: 'F=0' and 'BSGL=2'.\n", rankingStatistic );
2262 if ( (
fp = fopen( fname,
"rb" ) ) != NULL ) {
2264 XLAL_CHECK( (
fp = fopen( fname,
"ab" ) ),
XLAL_ESYS,
"Failed to open existing timing-file '%s' for appending\n", fname );
2266 XLAL_CHECK( (
fp = fopen( fname,
"wb" ) ),
XLAL_ESYS,
"Failed to open new timing-file '%s' for writing\n", fname );
2268 fprintf(
fp,
"%2s%6s %10s %10s %10s %10s %10s %10s %10s %10s %10s %16s %12s\n",
2269 "%%",
"NSFTs",
"NFreq",
"tauF[s]",
"tauFEff[s]",
"tauF0[s]",
"FstatMethod",
2270 "tauMin",
"tauMax",
"NStart",
"NTau",
"tauTransFstatMap",
"tauTransMarg"
2274 fprintf(
fp,
"%8d %10d %10.1e %10.1e %10.1e %10s %10d %10d %10d %10d %16.1e %12.1e\n",
2288 gsl_vector_int *new_hist = gsl_vector_int_alloc(
size );
2290 gsl_vector_int_set_zero( new_hist );
2291 if ( old_hist != NULL ) {
2292 gsl_vector_int_view old = gsl_vector_int_subvector( old_hist, 0, GSL_MIN( old_hist->size,
size ) );
2293 gsl_vector_int_view
new = gsl_vector_int_subvector( new_hist, 0, GSL_MIN( old_hist->size,
size ) );
2294 gsl_vector_int_memcpy( &
new.
vector, &old.vector );
2295 gsl_vector_int_free( old_hist );
int main(int argc, char *argv[])
MAIN function of ComputeFstatistic code.
int initUserVars(UserInput_t *uvar)
Register all our "user-variables" that can be specified from cmd-line and/or config-file.
void Freemem(ConfigVariables *cfg)
Free all globally allocated memory.
int compareFstatCandidates(const void *candA, const void *candB)
comparison function for our candidates toplist
int outputBeamTS(const CHAR *fname, const AMCoeffs *amcoe, const DetectorStateSeries *detStates)
int write_PulsarCandidate_to_fp(FILE *fp, const PulsarCandidate *pulsarParams, const FstatCandidate *Fcand)
write full 'PulsarCandidate' (i.e.
RankingStat_t
Enum for which statistic is used to "rank" significance of candidates.
@ RANKBY_2F
rank candidates by F-statistic
@ RANKBY_BSGL
rank candidates by BSGListic
@ RANKBY_NC
HierarchSearchGCT also has RANKBY_NC = 1, not applicable here.
gsl_vector_int * resize_histogram(gsl_vector_int *old_hist, size_t size)
CHAR * XLALGetLogString(const ConfigVariables *cfg, const BOOLEAN verbose)
Produce a log-string describing the present run-setup.
#define MYMAX(x, y)
convert GPS-time to REAL8
int compareFstatCandidates_BSGL(const void *candA, const void *candB)
comparison function for our candidates toplist with alternate sorting statistic BSGL=log10BSGL
int XLALAdvanceScanlineWindow(const FstatCandidate *nextCand, scanlineWindow_t *scanWindow)
Advance by pushing a new candidate into the scanline-window.
int vrbflg
defined in lal/lib/std/LALError.c
void XLALDestroyScanlineWindow(scanlineWindow_t *scanlineWindow)
int write_TimingInfo(const CHAR *timingFile, const timingInfo_t *ti, const ConfigVariables *cfg)
Function to append one timing-info line to output file.
int InitFstat(ConfigVariables *cfg, const UserInput_t *uvar)
Initialized Fstat-code: handle user-input and set everything up.
BOOLEAN XLALCenterIsLocalMax(const scanlineWindow_t *scanWindow, const UINT4 sortingStatistic)
check wether central candidate in Scanline-window is a local maximum
int checkUserInputConsistency(const UserInput_t *uvar)
Some general consistency-checks on user-input.
int WriteFstatLog(const CHAR *log_fname, const CHAR *logstr)
Log the all relevant parameters of the present search-run to a log-file.
scanlineWindow_t * XLALCreateScanlineWindow(UINT4 windowWings)
Create a scanline window, with given windowWings >= 0.
MultiNoiseWeights * getUnitWeights(const MultiSFTVector *multiSFTs)
int write_FstatCandidate_to_fp(FILE *fp, const FstatCandidate *thisFCand, const BOOLEAN output_stats, const BOOLEAN output_orbit)
write one 'FstatCandidate' (i.e.
void XLALDestroyDopplerFullScan(DopplerFullScanState *scan)
Destroy the a full DopplerFullScanState structure.
REAL8 XLALNumDopplerTemplates(DopplerFullScanState *scan)
Return (and compute if not done so yet) the total number of Doppler templates of the DopplerScan scan...
UINT8 XLALNumDopplerPointsAtDimension(DopplerFullScanState *scan, const size_t dim)
Compute and return the total number of frequency and spindown points up to and along a certain dimens...
DopplerFullScanState * XLALInitDopplerFullScan(const DopplerFullScanInit *init)
Set up a full multi-dimensional grid-scan.
int XLALGetDopplerSpinRange(PulsarSpinRange *spinRange, const DopplerFullScanState *scan)
Return the spin-range spanned by the given template bank stored in the opaque DopplerFullScanState.
int XLALNextDopplerPos(PulsarDopplerParams *pos, DopplerFullScanState *scan)
Function to step through the full template grid point by point.
CHAR * XLALSkySquare2String(REAL8 Alpha, REAL8 Delta, REAL8 AlphaBand, REAL8 DeltaBand)
parse a 'classical' sky-square (Alpha, Delta, AlphaBand, DeltaBand) into a "SkyRegion"-string of the ...
@ GRID_METRIC
generate grid using a 2D sky-metric
@ GRID_SPINDOWN_SQUARE
spindown tiling for a single sky position and square parameter space
@ GRID_FLAT
"flat" sky-grid: fixed step-size (dAlpha,dDelta)
@ GRID_FILE_SKYGRID
read skygrid from a file
@ GRID_FILE_FULLGRID
load the full D-dim grid from a file
@ GRID_SKY_LAST
end-marker for factored grid types
@ GRID_SPINDOWN_AGEBRK
spindown tiling for a single sky position and non-square parameter space defined by spindown age and ...
int create_toplist(toplist_t **list, size_t length, size_t size, int(*smaller)(const void *, const void *))
void free_toplist(toplist_t **list)
void qsort_toplist(toplist_t *list, int(*compare)(const void *, const void *))
void * toplist_elem(toplist_t *list, size_t ind)
int insert_into_toplist(toplist_t *list, void *element)
lal_errhandler_t lal_errhandler
int LAL_ERR_EXIT(LALStatus *stat, const char *func, const char *file, const int line, volatile const char *id)
void LALCheckMemoryLeaks(void)
const LALVCSInfoList lalPulsarVCSInfoList
NULL-terminated list of VCS and build information for LALPulsar and its dependencies
ConfigVariables GV
global container for various derived configuration settings
REAL8 XLALFindModeOfPDF1D(const pdf1D_t *pdf)
Find the 'mode' of the probabilty distribution, ie.
void XLALDestroyPDF1D(pdf1D_t *pdf)
Destructor function for 1-D pdf.
PulsarParamsVector * XLALPulsarParamsFromUserInput(const LALStringVector *UserInput, const LIGOTimeGPS *refTimeDef)
Function to determine the PulsarParamsVector input from a user-input defining CW sources.
const char *const InjectionSourcesHelpString
void XLALDestroyPulsarParamsVector(PulsarParamsVector *ppvect)
Destructor for PulsarParamsVector type.
const MultiLIGOTimeGPSVector * XLALGetFstatInputTimestamps(const FstatInput *input)
Returns the SFT timestamps stored in a FstatInput structure.
const MultiLALDetector * XLALGetFstatInputDetectors(const FstatInput *input)
Returns the detector information stored in a FstatInput structure.
const CHAR * XLALGetFstatInputMethodName(const FstatInput *input)
Returns the human-readable name of the -statistic method being used by a FstatInput structure.
const FstatOptionalArgs FstatOptionalArgsDefaults
Global initializer for setting FstatOptionalArgs to default values.
int XLALFstatCheckSFTLengthMismatch(const REAL8 Tsft, const REAL8 maxFreq, const REAL8 binaryMaxAsini, const REAL8 binaryMinPeriod, const REAL8 allowedMismatch)
Check that the SFT length does not exceed the result of XLALFstatMaximumSFTLength(),...
const UserChoices * XLALFstatMethodChoices(void)
Return pointer to a static array of all (available) FstatMethodType choices.
void XLALDestroyFstatInput(FstatInput *input)
Free all memory associated with a FstatInput structure.
int XLALAppendFstatTiming2File(const FstatInput *input, FILE *fp, BOOLEAN printHeader)
FstatQuantities
Bit-field of -statistic quantities which can be computed by XLALComputeFstat().
FstatInput * XLALCreateFstatInput(const SFTCatalog *SFTcatalog, const REAL8 minCoverFreq, const REAL8 maxCoverFreq, const REAL8 dFreq, const EphemerisData *ephemerides, const FstatOptionalArgs *optionalArgs)
Create a fully-setup FstatInput structure for computing the -statistic using XLALComputeFstat().
int XLALComputeFstat(FstatResults **Fstats, FstatInput *input, const PulsarDopplerParams *doppler, const UINT4 numFreqBins, const FstatQuantities whatToCompute)
Compute the -statistic over a band of frequencies.
void XLALDestroyFstatResults(FstatResults *Fstats)
Free all memory associated with a FstatResults structure.
@ FMETHOD_RESAMP_GENERIC
Resamp: generic implementation
@ FSTATQ_2F
Compute multi-detector .
@ FSTATQ_FAFB
Compute multi-detector and .
@ FSTATQ_ATOMS_PER_DET
Compute per-SFT -statistic atoms for each detector (Demod only).
@ FSTATQ_2F_PER_DET
Compute for each detector.
char * XLALGPSToStr(char *s, const LIGOTimeGPS *t)
int XLALParseMultiLALDetector(MultiLALDetector *detInfo, const LALStringVector *detNames)
Parse string-vectors (typically input by user) of N detector-names for detectors ,...
int XLALParseMultiNoiseFloor(MultiNoiseFloor *multiNoiseFloor, const LALStringVector *sqrtSX, UINT4 numDetectors)
Parse string-vectors (typically input by user) of N detector noise-floors for detectors ,...
int XLALFileClose(LALFILE *file)
LALFILE * XLALFileOpen(const char *path, const char *mode)
int XLALFilePrintf(LALFILE *file, const char *fmt,...)
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,...)
void * XLALCalloc(size_t m, size_t n)
char char * XLALStringDuplicate(const char *s)
int char * XLALStringAppend(char *s, const char *append)
char * XLALVCSInfoString(const LALVCSInfoList vcs_list, const int verbose, const char *prefix)
BSGLSetup * XLALCreateBSGLSetup(const UINT4 numDetectors, const REAL4 Fstar0sc, const REAL4 oLGX[PULSAR_MAX_DETECTORS], const BOOLEAN useLogCorrection, const UINT4 numSegments)
REAL4 XLALComputeBSGL(const REAL4 twoF, const REAL4 twoFX[PULSAR_MAX_DETECTORS], const BSGLSetup *setup)
Single-bin wrapper of XLALVectorComputeBSGL(), provided for backwards compatibility.
int XLALParseLinePriors(REAL4 oLGX[PULSAR_MAX_DETECTORS], const LALStringVector *oLGX_string)
Parse string-vectors (typically input by user) of N per-detector line-to-Gaussian prior ratios to a ...
const char * LogGetTimestamp(void)
void void int XLALfprintfGSLmatrix(FILE *fp, const char *fmt, const gsl_matrix *gij) _LAL_GCC_VPRINTF_FORMAT_(2)
void void LogPrintfVerbatim(LogLevel_t, const char *format,...) _LAL_GCC_PRINTF_FORMAT_(2
LogLevel_t LogLevel(void)
void LogPrintf(LogLevel_t, const char *format,...) _LAL_GCC_PRINTF_FORMAT_(2
#define PULSAR_MAX_DETECTORS
maximal number of detectors we can handle (for static arrays of detector quantities)
#define PULSAR_MAX_SPINS
maximal number of spin-parameters (Freq + spindowns) we can handle
@ TRANSIENT_NONE
Note: in this case the window-parameters will be ignored, and treated as rect={data},...
const LALDetector * XLALGetSiteInfo(const CHAR *name)
Find the site geometry-information 'LALDetector' for given a detector name (or prefix).
void XLALDestroySFTCatalog(SFTCatalog *catalog)
Free an 'SFT-catalogue'.
MultiLIGOTimeGPSVector * XLALReadMultiTimestampsFilesConstrained(const LALStringVector *fnames, const LIGOTimeGPS *minGPS, const LIGOTimeGPS *maxGPS)
Load several timestamps files, return a MultiLIGOTimeGPSVector struct, allocated here.
SFTCatalog * XLALMultiAddToFakeSFTCatalog(SFTCatalog *catalog, const LALStringVector *detectors, const MultiLIGOTimeGPSVector *timestamps)
Multi-detector and multi-timestamp wrapper of XLALAddToFakeSFTCatalog().
SFTCatalog * XLALSFTdataFind(const CHAR *file_pattern, const SFTConstraints *constraints)
Find the list of SFTs matching the file_pattern and satisfying the given constraints,...
void XLALDestroyMultiTimestamps(MultiLIGOTimeGPSVector *multiTS)
Destroy a MultiLIGOTimeGPSVector timestamps vector.
INT4 XLALCountIFOsInCatalog(const SFTCatalog *catalog)
Count the number of the unique IFOs in the given catalog.
SSBprecision
The precision in calculating the barycentric transformation.
const UserChoices SSBprecisionChoices
Static array of all SSBprecision choices, for use by the UserInput module parsing routines.
void XLALDestroyStringVector(LALStringVector *vect)
LALStringVector * XLALAppendString2Vector(LALStringVector *vect, const CHAR *string)
transientFstatMap_t * XLALComputeTransientFstatMap(const MultiFstatAtomVector *multiFstatAtoms, transientWindowRange_t windowRange, BOOLEAN useFReg)
Function to compute transient-window "F-statistic map" over start-time and timescale {t0,...
void XLALDestroyTransientFstatMap(transientFstatMap_t *FstatMap)
Standard destructor for transientFstatMap_t Fully NULL-robust as usual.
int XLALParseTransientWindowName(const char *windowName)
Parse a transient window name string into the corresponding transientWindowType.
int write_transientCandidate_to_fp(LALFILE *fp, const transientCandidate_t *thisCand, const char timeUnit)
Write one line for given transient CW candidate into output file.
int write_MultiFstatAtoms_to_fp(LALFILE *fp, const MultiFstatAtomVector *multiAtoms)
Write multi-IFO F-stat atoms 'multiAtoms' into output stream 'fstat'.
CHAR * XLALPulsarDopplerParams2String(const PulsarDopplerParams *par)
Turn pulsar doppler-params into a single string that can be used for filenames The format is tRefNNNN...
int write_transientCandidateAll_to_fp(LALFILE *fp, const transientCandidate_t *thisCand)
Write full set of t0 and tau grid points for given transient CW candidate into output file.
pdf1D_t * XLALComputeTransientPosterior_t0(transientWindowRange_t windowRange, const transientFstatMap_t *FstatMap)
Compute transient-CW posterior (normalized) on start-time t0, using given type and parameters of tran...
pdf1D_t * XLALComputeTransientPosterior_tau(transientWindowRange_t windowRange, const transientFstatMap_t *FstatMap)
Compute transient-CW posterior (normalized) on timescale tau, using given type and parameters of tran...
REAL8 XLALComputeTransientBstat(transientWindowRange_t windowRange, const transientFstatMap_t *FstatMap)
Compute transient-CW Bayes-factor B_SG = P(x|HypS)/P(x|HypG) (where HypG = Gaussian noise hypothesis)...
void XLALDestroyUINT4Vector(UINT4Vector *vector)
UINT4Vector * XLALCreateUINT4Vector(UINT4 length)
struct tm * XLALGPSToUTC(struct tm *utc, INT4 gpssec)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_MAIN(assertion,...)
#define XLAL_ERROR_MAIN(...)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
int int XLALPrintWarning(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
#define XLAL_CHECK_NULL(assertion,...)
static _LAL_INLINE_ int XLALIsREAL4FailNaN(REAL4 val)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
This structure contains the per-SFT (weighted) antenna-pattern functions , with the SFT-index,...
REAL4Vector * b
(weighted) per-SFT antenna-pattern function
REAL4Vector * a
(weighted) per-SFT antenna-pattern function
Struct holding the "antenna-pattern" matrix , in terms of the multi-detector scalar product.
REAL8 Sinv_Tsft
normalization-factor (using single-sided PSD!)
Configuration settings required for and defining a coherent pulsar search.
scanlineWindow_t * scanlineWindow
moving window of candidates on scanline to find local maxima
MultiLALDetector multiIFO
detectors to generate data for (if provided by user and not via noise files)
LALStringVector * detectorIDs
detector ID names, for column headings string
RankingStat_t RankingStatistic
rank candidates according to F or BSGL
UINT4Vector * numSFTsPerDet
number of SFTs per detector, for log strings, etc.
FstatInput * Fstat_in
Fstat input data struct.
CHAR * VCSInfoString
Git version string.
REAL8 Tspan
time spanned by all SFTs
REAL8 Tsft
length of one SFT in seconds
BSGLSetup * BSGLsetup
pre-computed setup for line-robust statistic
PulsarParamsVector * injectionSources
Source parameters to inject: comma-separated list of file-patterns and/or direct config-strings ('{....
DopplerRegion searchRegion
parameter-space region to search over
toplist_t * FstatToplist
sorted 'toplist' of the NumCandidatesToKeep loudest candidates
REAL8 Alpha
sky position alpha in radians
EphemerisData * ephemeris
ephemeris data (from XLALInitBarycenter())
CHAR * logstring
log containing max-info on the whole search setup
DopplerFullScanState * scanState
current state of the Doppler-scan
UINT4 NSFTs
total number of all SFTs used
PulsarDopplerParams stepSizes
user-preferences on Doppler-param step-sizes
MultiLIGOTimeGPSVector * multiTimestamps
a vector of timestamps (only set if provided from dedicated time stamp files)
FstatQuantities Fstat_what
Fstat quantities to compute.
transientWindowRange_t transientWindowRange
search range parameters for transient window
REAL8 Delta
sky position delta in radians
LIGOTimeGPS startTime
starting timestamp of SFTs
BOOLEAN runSearch
whether to actually perform the search, or just generate a grid and/or count templates
LIGOTimeGPS tGPS
GPS timestamps corresponding to this entry.
REAL8 LMST
local mean sidereal time at the detector-location in radians
Timeseries of DetectorState's, representing the detector-info at different timestamps.
DetectorState * data
array of DetectorState entries
UINT4 length
total number of entries
Structure describing a region in paramter-space (a,d,f,f1dot,..).
LALPulsarMetricType metricType
which metric to use if GRID_METRIC
const CHAR * gridFile
filename for sky-grid or full-grid if GRID_FILE_SKYGRID or GRID_FILE_FULLGRID
REAL8 metricMismatch
for GRID_METRIC and GRID_ISOTROPIC
REAL8 extraArgs[3]
extra grid-specific setup arguments
const LALDetector * Detector
Current detector.
LIGOTimeGPS startTime
start-time of the observation
REAL8 Tspan
total time spanned by observation
DopplerRegion searchRegion
Doppler-space region to be covered + scanned.
BOOLEAN projectMetric
project metric on f=const subspace
PulsarDopplerParams stepSizes
user-settings for stepsizes if GRID_FLAT
const EphemerisData * ephemeris
ephemeris-data for numerical metrics
DopplerGridType gridType
which type of grid to generate
PulsarSpins fkdotBand
spin-intervals
CHAR * skyRegionString
sky-region string '(a1,d1), (a2,d2), ..'
PulsarSpins fkdot
reference time of definition of Doppler parameters
This structure contains all information about the center-of-mass positions of the Earth and Sun,...
What info do we want to store in our toplist?
COMPLEX16 Fa
complex amplitude Fa
LIGOTimeGPS FaFb_refTime
reference time of Fa and Fb
AntennaPatternMatrix Mmunu
antenna-pattern matrix Mmunu = (h_mu|h_nu)
PulsarDopplerParams doppler
Doppler params of this 'candidate'.
COMPLEX16 Fb
complex amplitude Fb
REAL4 log10BSGL
Line-robust statistic .
UINT4 numDetectors
number of detectors = effective vector length.
REAL4 twoFX[PULSAR_MAX_DETECTORS]
vector of single-detector F-statistic values (array of fixed size)
REAL4 twoF
F-statistic value.
Struct of optional 'advanced level' and (potentially method-specific) arguments to be passed to the ...
UINT4 randSeed
Random-number seed value used in case of fake Gaussian noise generation (injectSqrtSX)
MultiNoiseFloor * injectSqrtSX
Single-sided PSD values for fake Gaussian noise to be added to SFT data.
PulsarParamsVector * injectSources
Vector of parameters of CW signals to simulate and inject.
UINT4 runningMedianWindow
If SFT noise weights are calculated from the SFTs, the running median window length to use.
MultiNoiseFloor * assumeSqrtSX
Single-sided PSD values to be used for computing SFT noise weights instead of from a running median o...
BOOLEAN resampFFTPowerOf2
Resamp: round up FFT lengths to next power of 2; see FstatMethodType.
REAL8 allowedMismatchFromSFTLength
Optional override for XLALFstatCheckSFTLengthMismatch().
BOOLEAN collectTiming
a flag to turn on/off the collection of F-stat-method-specific timing-data
UINT4 Dterms
Number of Dirichlet kernel terms, used by some Demod methods; see FstatMethodType.
FstatMethodType FstatMethod
Method to use for computing the -statistic.
SSBprecision SSBprec
Barycentric transformation precision.
XLALComputeFstat() computed results structure.
AntennaPatternMatrix Mmunu
Antenna pattern matrix , used in computing .
UINT4 numDetectors
Number of detectors over which the were computed.
REAL4 * twoFPerDet[PULSAR_MAX_DETECTORS]
If whatWasComputed & FSTATQ_2F_PER_DET is true, the values computed at numFreqBins frequencies space...
REAL4 * twoF
If whatWasComputed & FSTATQ_2F is true, the multi-detector values computed at numFreqBins frequencie...
COMPLEX8 * Fa
If whatWasComputed & FSTATQ_PARTS is true, the multi-detector and computed at numFreqBins frequenci...
LIGOTimeGPS refTimePhase
For performance reasons the global phase of all returned 'Fa' and 'Fb' quantities (Fa,...
MultiFstatAtomVector ** multiFatoms
If whatWasComputed & FSTATQ_ATOMS_PER_DET is true, the per-SFT -statistic multi-atoms computed at nu...
REAL8 deltaT
'length' of each timestamp (e.g.
A multi-detector vector of FstatAtomVector.
array of detectors definitions 'LALDetector'
UINT4 length
number of detectors
LALDetector sites[PULSAR_MAX_DETECTORS]
array of site information
A collection of (multi-IFO) LIGOTimeGPSVector time-stamps vectors.
UINT4 length
number of timestamps vectors or ifos
LIGOTimeGPSVector ** data
timestamps vector for each ifo
array of detector-specific 'noise floors' (ie PSD values), assumed constant over the frequency-band o...
One noise-weight (number) per SFT (therefore indexed over IFOs and SFTs.
A collection of SFT vectors – one for each IFO in a multi-IFO search.
REAL8 aCross
Signal amplitude (cross)
REAL8 psi
polarization angle psi
REAL8 aPlus
Signal amplitude (plus)
REAL8 phi0
initial signal-phase (at some reference time)
Type containing a "candidate": parameter-space point with estimated errors and Fstat-value/significan...
PulsarAmplitudeParams dAmp
amplitude-parameters and error-estimates
PulsarAmplitudeParams Amp
gsl_matrix * AmpFisherMatrix
Fisher-matrix of amplitude-subspace: has more info than dAmp!
PulsarDopplerParams Doppler
Type containing the 'Doppler-parameters' affecting the time-evolution of the phase.
REAL8 period
Binary: orbital period (sec)
LIGOTimeGPS tp
Binary: time of observed periapsis passage (in SSB)
PulsarSpins fkdot
Intrinsic spins: [Freq, f1dot, f2dot, ... ] where fkdot = d^kFreq/dt^k.
REAL8 Delta
Sky position: DEC (latitude) in equatorial coords and radians.
LIGOTimeGPS refTime
Reference time of pulsar parameters (in SSB!)
REAL8 Alpha
Sky position: RA (longitude) in equatorial coords and radians.
REAL8 ecc
Binary: orbital eccentricity.
REAL8 asini
Binary: projected, normalized orbital semi-major axis (s).
REAL8 argp
Binary: argument of periapsis (radians)
Straightforward vector type of N PulsarParams structs.
Contains a "spin-range", ie spins and corresponding bands at a given (SSB) reference GPS-time .
PulsarSpins fkdot
Vector of spin-values .
LIGOTimeGPS refTime
SSB reference GPS-time at which spin-range is defined.
PulsarSpins fkdotBand
Vector of spin-bands , MUST be same length as fkdot.
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...
SFTtype header
SFT-header info.
moving 'Scanline window' of candidates on the scan-line, which is used to find local 1D maxima.
FstatCandidate * window
array holding candidates
FstatCandidate * center
pointer to middle candidate in window
Struct holding various timing measurements and relevant search parameters.
UINT4 tauMin
shortest transient timescale [s]
UINT4 NSFTs
total number of SFTs
REAL8 tauF0
Demod timing constant = time per template per SFT.
UINT4 NTau
number of transient timescale steps in FstatMap matrix
UINT4 NFreq
number of frequency bins
REAL8 tauTransFstatMap
time to compute transient-search Fstatistic-map over {t0, tau} [s]
UINT4 tauMax
longest transient timescale [s]
UINT4 NStart
number of transient start-time steps in FstatMap matrix
REAL8 tauTemplate
total loop time per template, includes candidate-handling (transient stats, toplist etc)
REAL8 tauFstat
time to compute one Fstatistic over full data-duration (NSFT atoms) [in seconds]
REAL8 tauTransMarg
time to marginalize the Fstat-map to compute transient-search Bayes [s]
Struct holding a transient CW candidate.
Struct defining a range of transient windows.
UINT4 tauBand
range of transient timescales tau to search, in seconds
UINT4 dtau
stepsize to search tau-range with, in seconds
UINT4 tau
shortest transient timescale tau in seconds
UINT4 t0
earliest GPS start-time 't0' in seconds
UINT4 dt0
stepsize to search t0-range with, in seconds
transientWindowType_t type
window-type: none, rectangular, exponential, ....
UINT4 t0Band
range of start-times 't0' to search, in seconds