From dc7335146ce6d7bcfc5d390834451c57e65b4e07 Mon Sep 17 00:00:00 2001 From: Aaron Viets <aaron.viets@ligo.org> Date: Fri, 14 Dec 2018 18:27:10 -0800 Subject: [PATCH] lal_demodulate: Bug fix for rounding negative frequencies. --- gstlal-calibration/gst/lal/gstlal_demodulate.c | 15 ++++++++------- gstlal-calibration/gst/lal/gstlal_demodulate.h | 2 +- .../tests/check_calibration/Makefile | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/gstlal-calibration/gst/lal/gstlal_demodulate.c b/gstlal-calibration/gst/lal/gstlal_demodulate.c index 3cd606a14a..16e2f5d4c5 100644 --- a/gstlal-calibration/gst/lal/gstlal_demodulate.c +++ b/gstlal-calibration/gst/lal/gstlal_demodulate.c @@ -67,7 +67,7 @@ */ -static void demodulate_float(const float *src, gsize src_size, float complex *dst, guint64 t, gint rate, const int frequency, complex float prefactor) +static void demodulate_float(const float *src, gsize src_size, float complex *dst, guint64 t, gint rate, const gint64 frequency, complex float prefactor) { const float *src_end; guint64 i = 0; @@ -80,7 +80,7 @@ static void demodulate_float(const float *src, gsize src_size, float complex *ds } -static void demodulate_double(const double *src, gsize src_size, double complex *dst, guint64 t, gint rate, const int frequency, complex double prefactor) +static void demodulate_double(const double *src, gsize src_size, double complex *dst, guint64 t, gint rate, const gint64 frequency, complex double prefactor) { const double *src_end; guint64 i = 0; @@ -93,7 +93,7 @@ static void demodulate_double(const double *src, gsize src_size, double complex } -static void demodulate_complex_float(const complex float *src, gsize src_size, float complex *dst, guint64 t, gint rate, const int frequency, complex float prefactor) +static void demodulate_complex_float(const complex float *src, gsize src_size, float complex *dst, guint64 t, gint rate, const gint64 frequency, complex float prefactor) { const complex float *src_end; guint64 i = 0; @@ -106,7 +106,7 @@ static void demodulate_complex_float(const complex float *src, gsize src_size, f } -static void demodulate_complex_double(const complex double *src, gsize src_size, double complex *dst, guint64 t, gint rate, const int frequency, complex double prefactor) +static void demodulate_complex_double(const complex double *src, gsize src_size, double complex *dst, guint64 t, gint rate, const gint64 frequency, complex double prefactor) { const complex double *src_end; guint64 i = 0; @@ -119,7 +119,7 @@ static void demodulate_complex_double(const complex double *src, gsize src_size, } -static void demodulate(const void *src, gsize src_size, void *dst, guint64 t, gint rate, enum gstlal_demodulate_data_type data_type, const int frequency, complex double prefactor) +static void demodulate(const void *src, gsize src_size, void *dst, guint64 t, gint rate, enum gstlal_demodulate_data_type data_type, const gint64 frequency, complex double prefactor) { switch(data_type) { @@ -581,8 +581,9 @@ static void set_property(GObject *object, enum property prop_id, const GValue *v GST_OBJECT_LOCK(element); switch (prop_id) { - case ARG_LINE_FREQUENCY: - element->line_frequency = (int) (1000000.0 * g_value_get_double(value) + 0.5); /* Round to the nearest uHz */ + case ARG_LINE_FREQUENCY: ; + double freq = g_value_get_double(value); + element->line_frequency = (gint64) (1000000.0 * freq + (freq > 0 ? 0.5 : -0.5)); /* Round to the nearest uHz */ break; case ARG_PREFACTOR_REAL: element->prefactor_real = g_value_get_double(value); diff --git a/gstlal-calibration/gst/lal/gstlal_demodulate.h b/gstlal-calibration/gst/lal/gstlal_demodulate.h index 71e41d5f47..4c753e441b 100644 --- a/gstlal-calibration/gst/lal/gstlal_demodulate.h +++ b/gstlal-calibration/gst/lal/gstlal_demodulate.h @@ -79,7 +79,7 @@ struct _GSTLALDemodulate { gboolean need_discont; /* properties */ - int line_frequency; /* in centihertz */ + gint64 line_frequency; /* in uHz */ double prefactor_real; double prefactor_imag; }; diff --git a/gstlal-calibration/tests/check_calibration/Makefile b/gstlal-calibration/tests/check_calibration/Makefile index d325b6ec33..402fe71e3a 100644 --- a/gstlal-calibration/tests/check_calibration/Makefile +++ b/gstlal-calibration/tests/check_calibration/Makefile @@ -27,7 +27,7 @@ GDSTESTCONFIGS = ../../config_files/PreER13/H1/H1GDS_TEST_1225558818.ini DCSTESTCONFIGS = ../../config_files/O2/H1/tests/H1DCS_AllCorrections_Cleaning_TEST.ini GDSSHMCONFIGS = ../../config_files/PreER13/H1/tests/H1GDS_1222058826_shm2frames.ini -all: DCS_over_C02 noise_subtraction_ASD_DCH_DCS noise_subtraction_tf_DCS noise_subtraction_tf_DCH_DCS +all: noise_subtraction_ASD_DCS noise_subtraction_tf_DCS ############################################### ### These commands should change less often ### -- GitLab