Commit 707224f3 authored by Karl Wette's avatar Karl Wette

SuperskyMetrics: generalise range function XLALSuperskyLatticePhysicalRange()

- Does all supported physical parameters returned in 2 x PulsarDopplerParams
Original: d93004925226b756bbd1281c0dc79c58148c1481
parent 48a396b6
......@@ -2127,23 +2127,32 @@ int XLALSetSuperskyCoordinateSpinBound(
}
int XLALSuperskyLatticePulsarSpinRange(
PulsarSpinRange *spin_range,
int XLALSuperskyLatticePhysicalRange(
PulsarDopplerParams* min_range,
PulsarDopplerParams* max_range,
LatticeTiling *tiling,
const SuperskyTransformData *rssky_transf
)
{
// Check input
XLAL_CHECK( spin_range != NULL, XLAL_EFAULT );
XLAL_CHECK( min_range != NULL, XLAL_EFAULT );
XLAL_CHECK( max_range != NULL, XLAL_EFAULT );
XLAL_CHECK( tiling != NULL, XLAL_EFAULT );
XLAL_CHECK( CHECK_RSSKY_TRANSF( rssky_transf ), XLAL_EINVAL );
// Create arrays for minimum/maximum physical frequency/spindowns
PulsarSpins fkdotMin, fkdotMax;
// Initialise memory
XLAL_INIT_MEM( *min_range );
XLAL_INIT_MEM( *max_range );
// Set reference times of physical ranges
min_range->refTime = max_range->refTime = rssky_transf->ref_time;
// Initialise physical ranges
min_range->Alpha = GSL_POSINF; max_range->Alpha = GSL_NEGINF;
min_range->Delta = GSL_POSINF; max_range->Delta = GSL_NEGINF;
for ( size_t s = 0; s <= rssky_transf->SMAX; ++s ) {
fkdotMin[s] = GSL_POSINF;
fkdotMax[s] = GSL_NEGINF;
min_range->fkdot[s] = GSL_POSINF; max_range->fkdot[s] = GSL_NEGINF;
}
// Get frequency step size
......@@ -2167,28 +2176,22 @@ int XLALSuperskyLatticePulsarSpinRange(
INT4 left = 0, right = 0;
XLAL_CHECK( XLALCurrentLatticeTilingBlock( itr, rssky_transf->ndim - 1, &left, &right ) == XLAL_SUCCESS, XLAL_EFUNC );
// Store minimum/maximum physical frequency
fkdotMin[0] = GSL_MIN( fkdotMin[0], out_phys.fkdot[0] + dfreq * left );
fkdotMax[0] = GSL_MAX( fkdotMax[0], out_phys.fkdot[0] + dfreq * right );
// Store minimum/maximum sky position
min_range->Alpha = GSL_MIN( min_range->Alpha, out_phys.Alpha );
max_range->Alpha = GSL_MAX( max_range->Alpha, out_phys.Alpha );
min_range->Delta = GSL_MIN( min_range->Delta, out_phys.Delta );
max_range->Delta = GSL_MAX( max_range->Delta, out_phys.Delta );
// Store minimum/maximum physical spindowns
for ( size_t s = 0; s <= rssky_transf->SMAX; ++s ) {
fkdotMin[s] = GSL_MIN( fkdotMin[s], out_phys.fkdot[s] );
fkdotMax[s] = GSL_MAX( fkdotMax[s], out_phys.fkdot[s] );
}
// Store minimum/maximum frequency
min_range->fkdot[0] = GSL_MIN( min_range->fkdot[0], out_phys.fkdot[0] + dfreq * left );
max_range->fkdot[0] = GSL_MAX( max_range->fkdot[0], out_phys.fkdot[0] + dfreq * right );
}
// Initialise 'spin_range' to zero
XLAL_INIT_MEM( *spin_range );
// Set reference time of 'spin_range' to that of coordinate transform data
spin_range->refTime = rssky_transf->ref_time;
// Store minimum/maximum spindowns
for ( size_t s = 1; s <= rssky_transf->SMAX; ++s ) {
min_range->fkdot[s] = GSL_MIN( min_range->fkdot[s], out_phys.fkdot[s] );
max_range->fkdot[s] = GSL_MAX( max_range->fkdot[s], out_phys.fkdot[s] );
}
// Set spindown range
for ( size_t s = 0; s <= rssky_transf->SMAX; ++s ) {
spin_range->fkdot[s] = fkdotMin[s];
spin_range->fkdotBand[s] = fkdotMax[s] - fkdotMin[s];
}
// Cleanup
......
......@@ -258,11 +258,12 @@ int XLALSetSuperskyCoordinateSpinBound(
);
///
/// Fill a PulsarSpinRange with the physical frequency/spindown ranges covered by a reduced supersky
/// Fill two #PulsarDopplerParams structs with the physical ranges covered by a reduced supersky
/// lattice tiling.
///
int XLALSuperskyLatticePulsarSpinRange(
PulsarSpinRange *spin_range, ///< [in,out] Physical frequency/spindown range
int XLALSuperskyLatticePhysicalRange(
PulsarDopplerParams* min_range, ///< [in,out] Minima of physical ranges
PulsarDopplerParams* max_range, ///< [in,out] Maxima of physical ranges
LatticeTiling *tiling, ///< [in] Lattice tiling
const SuperskyTransformData *rssky_transf ///< [in] Reduced supersky coordinate transform data
);
......
......@@ -716,9 +716,9 @@ static int SuperskyTests(
// Check computation of spindown range for coherent tilings
for ( size_t n = 0; n < metrics->num_segments; ++n ) {
PulsarSpinRange spin_range;
XLAL_CHECK( XLALSuperskyLatticePulsarSpinRange( &spin_range, coh_tiling[n], metrics->coh_rssky_transf[n] ) == XLAL_SUCCESS, XLAL_EFUNC );
printf( "Coherent #%zu spindown range: freq=[%0.5g,%0.5g], f1dot=[%0.5g,%0.5g]\n", n, spin_range.fkdot[0], spin_range.fkdot[0] + spin_range.fkdotBand[0], spin_range.fkdot[1], spin_range.fkdot[1] + spin_range.fkdotBand[1] );
PulsarDopplerParams min_range, max_range;
XLAL_CHECK( XLALSuperskyLatticePhysicalRange( &min_range, &max_range, coh_tiling[n], metrics->coh_rssky_transf[n] ) == XLAL_SUCCESS, XLAL_EFUNC );
printf( "Coherent #%zu spindown range: freq=[%0.5g,%0.5g], f1dot=[%0.5g,%0.5g]\n", n, min_range.fkdot[0], max_range.fkdot[0], min_range.fkdot[1], max_range.fkdot[1] );
}
printf( "\n" );
......
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