26 #include <lal/LALDatatypes.h>
27 #include <lal/TimeSeries.h>
28 #include <lal/TimeSeriesInterp.h>
29 #include <lal/Units.h>
39 for(i = 0 ; i <
new->data->length; i++)
40 new->data->data[i] = fill;
65 double t = t0 + i * s->
deltaT;
75 for(i = 0; i <
dst->data->length; i++) {
125 double rms, min, max;
129 fprintf(stderr,
"error vector: RMS=%g, min=%g, max=%g\n", rms, min, max);
131 if(rms > rms_bound || min < residual_min || max > residual_max) {
132 fprintf(stderr,
"error vector larger than allowed\n");
141 LALREAL8TimeSeriesInterp *interp;
155 mdl =
new_series(1. / 1e8, round(1. /
f * 1e8), 0.0);
159 fprintf(stderr,
"interpolating unit amplitude %g kHz sine function sampled at %g Hz to %g MHz\n",
f / 1000., 1.0 /
src->deltaT, 1.0 /
dst->deltaT / 1e6);
176 FILE *
output = fopen(
"input.txt",
"w");
177 for(i = 0; i <
src->data->length; i++) {
182 output = fopen(
"output.txt",
"w");
207 mdl =
new_series(1. / 1e8, round(3. /
f * 1e8), 0.0);
211 fprintf(stderr,
"interpolating unit amplitude %g kHz sine function sampled at %g Hz to %g MHz\n",
f / 1000., 1.0 /
src->deltaT, 1.0 /
dst->deltaT / 1e6);
222 FILE *
output = fopen(
"input.txt",
"w");
223 for(i = 0; i <
src->data->length; i++) {
228 output = fopen(
"output.txt",
"w");
252 src->data->data[
src->data->length] = 1;
260 fprintf(stderr,
"checking for out-of-bounds failure ...\n");
263 fprintf(stderr,
"error: interpolator failed to report error beyond end of array\n");
266 fprintf(stderr,
"... passed\n");
270 fprintf(stderr,
"error: interpolator failed in final sample (expected %.16g got %.16g)\n", 0., result);
276 fprintf(stderr,
"error: interpolator failed in final sample (expected %.16g got %.16g)\n", 0., result);
LALREAL8TimeSeriesInterp * XLALREAL8TimeSeriesInterpCreate(const REAL8TimeSeries *series, int kernel_length, void(*kernel)(double *, int, double, void *), void *kernel_data)
Create a new REAL8TimeSeries interpolator associated with the given REAL8TimeSeries object.
void XLALREAL8TimeSeriesInterpDestroy(LALREAL8TimeSeriesInterp *interp)
Free a LALREAL8TimeSeriesInterp object.
REAL8 XLALREAL8TimeSeriesInterpEval(LALREAL8TimeSeriesInterp *interp, const LIGOTimeGPS *t, int bounds_check)
Evaluate a LALREAL8TimeSeriesInterp at the LIGOTimeGPS t.
static void minmax(const REAL8TimeSeries *s, double *min, double *max)
static REAL8TimeSeries * new_series(double deltaT, unsigned length, double fill)
static REAL8TimeSeries * error(const REAL8TimeSeries *s1, const REAL8TimeSeries *s0)
static void check_result(const REAL8TimeSeries *model, const REAL8TimeSeries *result, double rms_bound, double residual_min, double residual_max)
static LIGOTimeGPS gps_zero
static LIGOTimeGPS t_i(const REAL8TimeSeries *s, unsigned i)
static void evaluate(REAL8TimeSeries *dst, LALREAL8TimeSeriesInterp *interp, int bounds_check)
static void add_sine(REAL8TimeSeries *s, LIGOTimeGPS epoch, double ampl, double freq)
static REAL8TimeSeries * copy_series(const REAL8TimeSeries *src)
static double RMS(const REAL8TimeSeries *s)
static double f(double theta, double y, double xi)
#define LAL_TWOPI
2*pi is circumference of a circle divided by its radius
#define LIGOTIMEGPSZERO
Zero-initializer for LIGOTimeGPS structs.
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
REAL8TimeSeries * XLALCutREAL8TimeSeries(const REAL8TimeSeries *series, size_t first, size_t length)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
const LALUnit lalDimensionlessUnit
dimensionless units
#define XLAL_IS_REAL8_FAIL_NAN(val)
Tests if val is a XLAL REAL8 failure NaN.
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
Adds a double to a GPS time.
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
Difference between two GPS times as double.
Epoch relative to GPS epoch, see LIGOTimeGPS type for more details.
INT4 gpsSeconds
Seconds since 0h UTC 6 Jan 1980.
INT4 gpsNanoSeconds
Residual nanoseconds.
Time series of REAL8 data, see DATATYPE-TimeSeries types for more details.
REAL8Sequence * data
The sequence of sampled data.
REAL8 deltaT
The time step between samples of the time series in seconds.
LIGOTimeGPS epoch
The start time of the time series.
REAL8 * data
Pointer to the data array.
UINT4 length
Number of elements in array.
void output(int gps_sec, int output_type)