Commit 86ee450a authored by David Keitel's avatar David Keitel Committed by Reinhard Prix

CFSv2: transient (t0,tau) output in seconds by default

 -time unit option added to write_transientCandidate_to_fp()
 -new CFSv2 transient-output behaviour:
  -signal duration tau in seconds
  -signal start t0 as GPS epoch [seconds]
  -previously, t0 and tau were in days,
               and t0 as offset from starttime
  -old output in days (t0 relative to starttime)
   kept if any of the (now deprecated)
   --transient-*Days input options are used
  -synthesizeTransientStats keeps days for now
Original: d0c03822dc24798c033ab40876af554de962ce1d
parent 7459039c
......@@ -181,6 +181,7 @@ typedef struct {
FstatMethodType FstatMethod;
UINT4 numFreqBins_FBand;
REAL8 dFreq;
CHAR transientOutputTimeUnit; /**< output format for transient times t0,tau: 'd' for days (deprecated) or 's' for seconds */
} ConfigVariables;
......@@ -449,7 +450,7 @@ int main(int argc,char *argv[])
{
XLAL_CHECK_MAIN ( (fpTransientStats = fopen (uvar.outputTransientStats, "wb")) != NULL, XLAL_ESYS, "\nError opening file '%s' for writing..\n\n", uvar.outputTransientStats );
fprintf (fpTransientStats, "%s", GV.logstring ); /* write search log comment */
XLAL_CHECK_MAIN ( write_transientCandidate_to_fp ( fpTransientStats, NULL ) == XLAL_SUCCESS, XLAL_EFUNC ); /* write header-line comment */
XLAL_CHECK_MAIN ( write_transientCandidate_to_fp ( fpTransientStats, NULL, GV.transientOutputTimeUnit ) == XLAL_SUCCESS, XLAL_EFUNC ); /* write header-line comment */
}
if ( uvar.outputTransientStatsAll )
......@@ -751,7 +752,7 @@ int main(int argc,char *argv[])
if ( fpTransientStats )
{
/* output everything into stats-file (one line per candidate) */
XLAL_CHECK_MAIN ( write_transientCandidate_to_fp ( fpTransientStats, &transientCand ) == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK_MAIN ( write_transientCandidate_to_fp ( fpTransientStats, &transientCand, GV.transientOutputTimeUnit ) == XLAL_SUCCESS, XLAL_EFUNC );
}
if ( fpTransientStatsAll )
......@@ -1489,6 +1490,13 @@ InitFstat ( ConfigVariables *cfg, const UserInput_t *uvar )
XLAL_ERROR ( XLAL_EINVAL, "ERROR: transientWindow->type == NONE, but window-parameters were set! Use a different window-type!\n" );
}
if ( XLALUserVarWasSet ( &uvar->transient_t0Days ) || XLALUserVarWasSet ( &uvar->transient_t0DaysBand ) || XLALUserVarWasSet ( &uvar->transient_tauDays ) || XLALUserVarWasSet ( &uvar->transient_tauDaysBand ) ) {
cfg->transientOutputTimeUnit = 'd';
}
else {
cfg->transientOutputTimeUnit = 's';
}
if ( uvar->transient_t0DaysBand < 0 || uvar->transient_tauDaysBand < 0 ) {
XLAL_ERROR (XLAL_EINVAL, "Only positive t0/tau bands allowed (%f, %f)\n", uvar->transient_t0DaysBand, uvar->transient_tauDaysBand );
}
......
......@@ -362,7 +362,7 @@ int main(int argc,char *argv[])
/* ----- if requested, output transient-cand statistics */
if ( fpStats && write_BSGL_candidate_to_fp ( fpStats, &synthStats, uvar.IFOs, &injParamsDrawn, uvar.computeBSGL ) != XLAL_SUCCESS ) {
XLALPrintError ( "%s: write_transientCandidate_to_fp() failed.\n", __func__ );
XLALPrintError ( "%s: write_BSGL_candidate_to_fp() failed.\n", __func__ );
XLAL_ERROR ( XLAL_EFUNC );
}
......
......@@ -222,7 +222,7 @@ int main(int argc,char *argv[])
XLAL_ERROR ( XLAL_EIO );
}
fprintf (fpTransientStats, "%s", cfg.logString ); /* write search log comment */
if ( write_transientCandidate_to_fp ( fpTransientStats, NULL ) != XLAL_SUCCESS ) { /* write header-line comment */
if ( write_transientCandidate_to_fp ( fpTransientStats, NULL, 'd' ) != XLAL_SUCCESS ) { /* write header-line comment */
XLAL_ERROR ( XLAL_EFUNC );
}
} /* if outputStats */
......@@ -445,7 +445,7 @@ int main(int argc,char *argv[])
/* ----- if requested, output transient-cand statistics */
if ( fpTransientStats && write_transientCandidate_to_fp ( fpTransientStats, &cand ) != XLAL_SUCCESS ) {
if ( fpTransientStats && write_transientCandidate_to_fp ( fpTransientStats, &cand, 'd' ) != XLAL_SUCCESS ) {
XLALPrintError ( "%s: write_transientCandidate_to_fp() failed.\n", __func__ );
XLAL_ERROR ( XLAL_EFUNC );
}
......
......@@ -962,7 +962,7 @@ XLALmergeMultiFstatAtomsBinned ( const MultiFstatAtomVector *multiAtoms, UINT4 d
*
*/
int
write_transientCandidate_to_fp ( FILE *fp, const transientCandidate_t *thisCand )
write_transientCandidate_to_fp ( FILE *fp, const transientCandidate_t *thisCand, const char timeUnit )
{
/* sanity checks */
if ( !fp ) {
......@@ -973,7 +973,7 @@ write_transientCandidate_to_fp ( FILE *fp, const transientCandidate_t *thisCand
if ( thisCand == NULL ) /* write header-line comment */
{
fprintf (fp, "%%%% Freq[Hz] Alpha[rad] Delta[rad] fkdot[1] fkdot[2] fkdot[3] t0_ML[d] tau_ML[d] maxTwoF logBstat t0_MP[d] tau_MP[d]\n");
fprintf (fp, "%%%% Freq[Hz] Alpha[rad] Delta[rad] fkdot[1] fkdot[2] fkdot[3] t0_ML[%c] tau_ML[%c] maxTwoF logBstat t0_MP[%c] tau_MP[%c]\n", timeUnit, timeUnit, timeUnit, timeUnit);
}
else
{
......@@ -981,20 +981,38 @@ write_transientCandidate_to_fp ( FILE *fp, const transientCandidate_t *thisCand
XLALPrintError ("%s: incomplete: transientCand->FstatMap == NULL!\n", __func__ );
XLAL_ERROR ( XLAL_EINVAL );
}
UINT4 t0 = thisCand->windowRange.t0;
REAL8 t0_d_ML = 1.0 * (thisCand->FstatMap->t0_ML - t0) / DAY24;
REAL8 tau_d_ML= 1.0 * thisCand->FstatMap->tau_ML / DAY24;
REAL8 maxTwoF = 2.0 * thisCand->FstatMap->maxF;
REAL8 t0_d_MP = 1.0 * ( thisCand->t0_MP - t0 ) / DAY24;
REAL8 tau_d_MP= 1.0 * thisCand->tau_MP / DAY24;
fprintf (fp, " %- 18.16f %- 19.16f %- 19.16f %- 9.6g %- 9.5g %- 9.5g %-8.5f %-8.5f %- 11.8g %- 11.8g %-8.5f %8.5f\n",
REAL8 maxTwoF = 2.0 * thisCand->FstatMap->maxF;
fprintf (fp, " %- 18.16f %- 19.16f %- 19.16f %- 9.6g %- 9.5g %- 9.5g",
thisCand->doppler.fkdot[0], thisCand->doppler.Alpha, thisCand->doppler.Delta,
thisCand->doppler.fkdot[1], thisCand->doppler.fkdot[2], thisCand->doppler.fkdot[3],
t0_d_ML, tau_d_ML, maxTwoF,
thisCand->logBstat,
t0_d_MP, tau_d_MP
);
thisCand->doppler.fkdot[1], thisCand->doppler.fkdot[2], thisCand->doppler.fkdot[3]
);
if ( timeUnit == 's' )
{
fprintf (fp, " %10d %10d %- 11.8g %- 11.8g %15.4f %15.4f\n",
thisCand->FstatMap->t0_ML, thisCand->FstatMap->tau_ML,
maxTwoF, thisCand->logBstat,
thisCand->t0_MP, thisCand->tau_MP
);
}
else if ( timeUnit == 'd' )
{
UINT4 t0 = thisCand->windowRange.t0;
REAL8 t0_d_ML = 1.0 * (thisCand->FstatMap->t0_ML - t0) / DAY24;
REAL8 tau_d_ML= 1.0 * thisCand->FstatMap->tau_ML / DAY24;
REAL8 t0_d_MP = 1.0 * ( thisCand->t0_MP - t0 ) / DAY24;
REAL8 tau_d_MP= 1.0 * thisCand->tau_MP / DAY24;
fprintf (fp, " %-8.5f %-8.5f %- 11.8g %- 11.8g %-8.5f %8.5f\n",
t0_d_ML, tau_d_ML,
maxTwoF, thisCand->logBstat,
t0_d_MP, tau_d_MP
);
}
else
{
XLALPrintError ( "%s: Unknown time unit '%c'!\n", __func__, timeUnit );
XLAL_ERROR ( XLAL_EINVAL );
}
}
return XLAL_SUCCESS;
......
......@@ -107,7 +107,7 @@ int XLALApplyTransientWindow2NoiseWeights ( MultiNoiseWeights *multiNoiseWeights
const MultiLIGOTimeGPSVector *multiTS,
transientWindow_t TransientWindowParams );
int write_transientCandidate_to_fp ( FILE *fp, const transientCandidate_t *thisTransCand );
int write_transientCandidate_to_fp ( FILE *fp, const transientCandidate_t *thisTransCand, const char timeUnit );
int write_transientCandidateAll_to_fp ( FILE *fp, const transientCandidate_t *thisTransCand );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment