Commit d2b245a0 authored by Karl Wette's avatar Karl Wette

SuperskyMetrics: make reduced supersky metric coordinate transform data opaque

- Change from a gsl_matrix into an opaque struct SuperskyTransformData,
  though internally for now this just contains a gsl_matrix pointer 'data'
- SuperskyMetricsTest must have its own definition of SuperskyTransformData
Original: 7f94322b84ba4e5f045c2afbec7cbb418f9d0a27
parent 05c95be3
This diff is collapsed.
......@@ -39,6 +39,11 @@ extern "C" {
/// @{
///
///
/// Supersky metric coordinate transform data
///
typedef struct tagSuperskyTransformData SuperskyTransformData;
///
/// Computed supersky metrics, returned by XLALComputeSuperskyMetrics().
///
......@@ -55,10 +60,10 @@ typedef struct tagSuperskyMetrics {
#ifdef SWIG // SWIG interface directives
SWIGLAL( ARRAY_1D( SuperskyMetrics, gsl_matrix *, coh_rssky_transf, size_t, num_segments ) );
#endif // SWIG
gsl_matrix **coh_rssky_transf; ///< Coherent reduced supersky metric coordinate transform data for each segment
SuperskyTransformData **coh_rssky_transf; ///< Coherent reduced supersky metric coordinate transform data for each segment
gsl_matrix *semi_rssky_metric; ///< Semicoherent reduced supersky metric (2-dimensional sky)
gsl_matrix *semi_rssky_transf; ///< Semicoherent reduced supersky metric coordinate transform data
SuperskyTransformData *semi_rssky_transf; ///< Semicoherent reduced supersky metric coordinate transform data
} SuperskyMetrics;
......@@ -116,7 +121,7 @@ SWIGLAL( COPYINOUT_ARRAYS( gsl_matrix, rssky_metric, rssky_transf ) );
///
int XLALScaleSuperskyMetricFiducialFreq(
gsl_matrix *rssky_metric, ///< [in] Reduced supersky metric
gsl_matrix *rssky_transf, ///< [in] Reduced supersky metric coordinate transform data
SuperskyTransformData *rssky_transf, ///< [in] Reduced supersky metric coordinate transform data
const double new_fiducial_freq ///< [in] New fiducial frequency
);
......@@ -148,7 +153,7 @@ int XLALEqualizeReducedSuperskyMetricsFreqSpacing(
int XLALConvertPhysicalToSuperskyPoint(
gsl_vector *out_rssky, ///< [out] Output point in supersky coordinates
const PulsarDopplerParams *in_phys, ///< [in] Input point in physical coordinates
const gsl_matrix *rssky_transf ///< [in] Reduced supersky coordinate transform data
const SuperskyTransformData *rssky_transf ///< [in] Reduced supersky coordinate transform data
);
///
......@@ -158,7 +163,7 @@ int XLALConvertSuperskyToPhysicalPoint(
PulsarDopplerParams *out_phys, ///< [out] Output point in physical coordinates
const gsl_vector *in_rssky, ///< [in] Input point in supersky coordinates
const gsl_vector *ref_rssky, ///< [in,optional] Reference point in supersky coordinates
const gsl_matrix *rssky_transf ///< [in] Reduced supersky coordinate transform data
const SuperskyTransformData *rssky_transf ///< [in] Reduced supersky coordinate transform data
);
///
......@@ -166,9 +171,9 @@ int XLALConvertSuperskyToPhysicalPoint(
///
int XLALConvertSuperskyToSuperskyPoint(
gsl_vector *out_rssky, ///< [out] Output point in supersky coordinates
const gsl_matrix *out_rssky_transf, ///< [in] Output reduced supersky coordinate transform data
const SuperskyTransformData *out_rssky_transf,///< [in] Output reduced supersky coordinate transform data
const gsl_vector *in_rssky, ///< [in] Input point in supersky coordinates
const gsl_matrix *in_rssky_transf ///< [in] Input reduced supersky coordinate transform data
const SuperskyTransformData *in_rssky_transf ///< [in] Input reduced supersky coordinate transform data
);
///
......@@ -180,7 +185,7 @@ SWIGLAL( INOUT_STRUCTS( gsl_matrix **, out_rssky ) );
int XLALConvertPhysicalToSuperskyPoints(
gsl_matrix **out_rssky, ///< [out] Columns are output point in supersky coordinates
const gsl_matrix *in_phys, ///< [in] Columns are input point in physical coordinates
const gsl_matrix *rssky_transf ///< [in] Reduced supersky coordinate transform data
const SuperskyTransformData *rssky_transf ///< [in] Reduced supersky coordinate transform data
);
///
......@@ -192,7 +197,7 @@ SWIGLAL( INOUT_STRUCTS( gsl_matrix **, out_phys ) );
int XLALConvertSuperskyToPhysicalPoints(
gsl_matrix **out_phys, ///< [out] Columns are output point in physical coordinates
const gsl_matrix *in_rssky, ///< [in] Columns are input point in supersky coordinates
const gsl_matrix *rssky_transf ///< [in] Reduced supersky coordinate transform data
const SuperskyTransformData *rssky_transf ///< [in] Reduced supersky coordinate transform data
);
#ifdef SWIG // SWIG interface directives
......@@ -208,7 +213,7 @@ SWIGLAL( COPYINOUT_ARRAYS( gsl_matrix, rssky_metric, rssky_transf ) );
int XLALSetSuperskyPhysicalSkyBounds(
LatticeTiling *tiling, ///< [in] Lattice tiling
gsl_matrix *rssky_metric, ///< [in,out] Reduced supersky metric
gsl_matrix *rssky_transf, ///< [in,out] Reduced supersky coordinate transform data
SuperskyTransformData *rssky_transf, ///< [in,out] Reduced supersky coordinate transform data
const double alpha1, ///< [in] First bound on sky position right ascension
const double alpha2, ///< [in] Second bound on sky position right ascension
const double delta1, ///< [in] First bound on sky position declination
......@@ -238,7 +243,7 @@ SWIGLAL_CLEAR( COPYINOUT_ARRAYS( gsl_matrix, rssky_metric, rssky_transf ) );
///
int XLALSetSuperskyPhysicalSpinBound(
LatticeTiling *tiling, ///< [in] Lattice tiling
const gsl_matrix *rssky_transf, ///< [in] Reduced supersky coordinate transform data
const SuperskyTransformData *rssky_transf, ///< [in] Reduced supersky coordinate transform data
const size_t s, ///< [in] Spindown order; 0=frequency, 1=first spindown, etc.
const double bound1, ///< [in] First bound on frequency/spindown
const double bound2 ///< [in] Second bound on frequency/spindown
......@@ -251,7 +256,7 @@ int XLALSetSuperskyPhysicalSpinBound(
///
int XLALSetSuperskyCoordinateSpinBound(
LatticeTiling *tiling, ///< [in] Lattice tiling.
const gsl_matrix *rssky_transf, ///< [in] Reduced supersky coordinate transform data
const SuperskyTransformData *rssky_transf, ///< [in] Reduced supersky coordinate transform data
const size_t s, ///< [in] Spindown order; 0=frequency, 1=first spindown, etc.
const double bound1, ///< [in] First bound on frequency/spindown
const double bound2 ///< [in] Second bound on frequency/spindown
......@@ -264,7 +269,7 @@ int XLALSetSuperskyCoordinateSpinBound(
int XLALSuperskyLatticePulsarSpinRange(
PulsarSpinRange *spin_range, ///< [in,out] Physical frequency/spindown range
LatticeTiling *tiling, ///< [in] Lattice tiling
const gsl_matrix *rssky_transf ///< [in] Reduced supersky coordinate transform data
const SuperskyTransformData *rssky_transf ///< [in] Reduced supersky coordinate transform data
);
/// @}
......
......@@ -37,6 +37,12 @@
#define REF_TIME { REF_TIME_S, 0 }
#define FIDUCIAL_FREQ 100.0
// Internal definition of reduced supersky metric coordinate transform data
// - Must match that given in src/SuperskyMetrics.c
struct tagSuperskyTransformData {
gsl_matrix *data;
};
const PulsarDopplerParams phys_points[NUM_POINTS] = {
{ .refTime = REF_TIME, .Alpha = 0.00000000000000, .Delta = 0.000000000000000, .fkdot = {100.0000000000000, 0.00000000000000e-00} },
{ .refTime = REF_TIME, .Alpha = 4.88014010120016, .Delta = -0.954446475246007, .fkdot = { 99.9999983978492, 1.48957780038094e-09} },
......@@ -182,7 +188,7 @@ static int CompareDoppler( const PulsarDopplerParams *a, const PulsarDopplerPara
static int CheckSuperskyMetrics(
const gsl_matrix *rssky_metric,
const double rssky_metric_ref[4][4],
const gsl_matrix *rssky_transf,
const SuperskyTransformData *rssky_transf,
const double rssky_transf_ref[6][3],
const double phys_mismatch[NUM_POINTS][NUM_POINTS],
const double phys_mismatch_tol
......@@ -196,11 +202,11 @@ static int CheckSuperskyMetrics(
XLAL_CHECK( err <= err_tol, XLAL_ETOL, "'rssky_metric' check failed: err = %0.3e > %0.3e = err_tol", err, err_tol );
}
{
XLAL_CHECK( rssky_transf->size1 == 6 && rssky_transf->size2 == 3, XLAL_ESIZE );
XLAL_CHECK( rssky_transf->data->size1 == 6 && rssky_transf->data->size2 == 3, XLAL_ESIZE );
const double err_tol = 1e-5;
for ( size_t i = 0; i < rssky_transf->size1; ++i ) {
for ( size_t j = 0; j < rssky_transf->size2; ++j ) {
const double rssky_transf_ij = gsl_matrix_get( rssky_transf, i, j );
for ( size_t i = 0; i < rssky_transf->data->size1; ++i ) {
for ( size_t j = 0; j < rssky_transf->data->size2; ++j ) {
const double rssky_transf_ij = gsl_matrix_get( rssky_transf->data, i, j );
const double rssky_transf_ref_ij = rssky_transf_ref[i][j];
CHECK_RELERR( rssky_transf_ij, rssky_transf_ref_ij, err_tol );
}
......
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