Commit c29c2741 authored by David Keitel's avatar David Keitel
Browse files

XLALReadPulsarParams: switch recommended usage to transientStartTime,...

XLALReadPulsarParams: switch recommended usage to transientStartTime, transientTau in integer seconds

 -these were internally rounded to UINT4 already,
  better to be upfront with it!
 -transientTauDays kept for backwards compatibility for now,
  but throw deprecation warning
 -also make some error messages more verbose
parent 642b6161
...@@ -790,7 +790,7 @@ XLALDestroyPulsarParams ( PulsarParams *params ) ...@@ -790,7 +790,7 @@ XLALDestroyPulsarParams ( PulsarParams *params )
* OPTIONAL: * OPTIONAL:
* f1dot, f2dot, f3dot, f4dot, f5dot, f6dot * f1dot, f2dot, f3dot, f4dot, f5dot, f6dot
* {h0, cosi} or {aPlus, aCross}, psi, phi0 * {h0, cosi} or {aPlus, aCross}, psi, phi0
* transientWindowType, transientStartTime, transientTauDays * transientWindowType, transientStartTime, transientTau
* *
* Other config-variables found in the file will ... ?? error or accept? * Other config-variables found in the file will ... ?? error or accept?
*/ */
...@@ -947,9 +947,11 @@ XLALReadPulsarParams ( PulsarParams *pulsarParams, ///< [out] pulsar parameters ...@@ -947,9 +947,11 @@ XLALReadPulsarParams ( PulsarParams *pulsarParams, ///< [out] pulsar parameters
char *transientWindowType = NULL; BOOLEAN have_transientWindowType; char *transientWindowType = NULL; BOOLEAN have_transientWindowType;
XLAL_CHECK ( XLALReadConfigSTRINGVariable ( &transientWindowType, cfgdata, secName, "transientWindowType", &have_transientWindowType ) == XLAL_SUCCESS, XLAL_EFUNC ); XLAL_CHECK ( XLALReadConfigSTRINGVariable ( &transientWindowType, cfgdata, secName, "transientWindowType", &have_transientWindowType ) == XLAL_SUCCESS, XLAL_EFUNC );
// ----- t0 // ----- t0
REAL8 transientStartTime = 0; BOOLEAN have_transientStartTime; UINT4 transientStartTime = 0; BOOLEAN have_transientStartTime;
XLAL_CHECK ( XLALReadConfigREAL8Variable ( &transientStartTime, cfgdata, secName, "transientStartTime", &have_transientStartTime ) == XLAL_SUCCESS, XLAL_EFUNC ); XLAL_CHECK ( XLALReadConfigUINT4Variable ( &transientStartTime, cfgdata, secName, "transientStartTime", &have_transientStartTime ) == XLAL_SUCCESS, XLAL_EFUNC );
// ----- tau // ----- tau (still keeping deprecated Days variant for backwards compatibility, for now)
UINT4 transientTau = 0; BOOLEAN have_transientTau;
XLAL_CHECK ( XLALReadConfigUINT4Variable ( &transientTau, cfgdata, secName, "transientTau", &have_transientTau ) == XLAL_SUCCESS, XLAL_EFUNC );
REAL8 transientTauDays = 0; BOOLEAN have_transientTauDays; REAL8 transientTauDays = 0; BOOLEAN have_transientTauDays;
XLAL_CHECK ( XLALReadConfigREAL8Variable ( &transientTauDays, cfgdata, secName, "transientTauDays", &have_transientTauDays ) == XLAL_SUCCESS, XLAL_EFUNC ); XLAL_CHECK ( XLALReadConfigREAL8Variable ( &transientTauDays, cfgdata, secName, "transientTauDays", &have_transientTauDays ) == XLAL_SUCCESS, XLAL_EFUNC );
...@@ -962,16 +964,22 @@ XLALReadPulsarParams ( PulsarParams *pulsarParams, ///< [out] pulsar parameters ...@@ -962,16 +964,22 @@ XLALReadPulsarParams ( PulsarParams *pulsarParams, ///< [out] pulsar parameters
if ( pulsarParams->Transient.type != TRANSIENT_NONE ) if ( pulsarParams->Transient.type != TRANSIENT_NONE )
{ {
XLAL_CHECK ( have_transientStartTime && have_transientTauDays, XLAL_EINVAL ); XLAL_CHECK ( have_transientStartTime && (have_transientTau || have_transientTauDays), XLAL_EINVAL, "For transientWindowType!=None, we also need transientStartTime and either transientTau (deprecated) or transientTau.");
XLAL_CHECK ( transientStartTime >= 0, XLAL_EDOM ); XLAL_CHECK ( !(have_transientTau && have_transientTauDays), XLAL_EINVAL, "Cannot have both transientTau and transientTauDays; the latter is deprecated." );
XLAL_CHECK ( transientTauDays > 0, XLAL_EDOM );
pulsarParams->Transient.t0 = transientStartTime;
pulsarParams->Transient.t0 = (UINT4) round ( transientStartTime ); if ( have_transientTauDays ) {
pulsarParams->Transient.tau = (UINT4) round ( transientTauDays * 86400 ); XLAL_CHECK ( transientTauDays > 0, XLAL_EDOM );
printf("Warning: Option transientTauDays is deprecated, please switch to using transientTau [UINT4, in seconds] instead.\n");
pulsarParams->Transient.tau = (UINT4) round ( transientTauDays * 86400 );
}
else {
pulsarParams->Transient.tau = transientTau;
}
} /* if transient window != none */ } /* if transient window != none */
else else
{ {
XLAL_CHECK ( !(have_transientStartTime || have_transientTauDays), XLAL_EINVAL ); XLAL_CHECK ( !(have_transientStartTime || have_transientTau || have_transientTauDays), XLAL_EINVAL, "Cannot use transientStartTime, transientTau or transientTauDays without transientWindowType!" );
} }
return XLAL_SUCCESS; return XLAL_SUCCESS;
......
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