5 #include <boost/test/unit_test.hpp> 13 int const delay = 1250;
17 timeseries_type a(nsamples);
18 timeseries_type b(nsamples);
19 tested estimator(a, b);
23 a, std::chrono::microseconds(delay), std::chrono::microseconds(1));
25 auto e = estimator.estimate_delay(a, b);
26 BOOST_CHECK_EQUAL(e.first,
true);
27 BOOST_CHECK_CLOSE(e.second,
double(delay), 0.01);
38 timeseries_type a = {0};
39 timeseries_type b = a;
41 tested estimator(a, b);
42 auto e = estimator.estimate_delay(a, b);
43 BOOST_CHECK_EQUAL(e.first,
false);
45 b.resize(nsamples / 2);
46 BOOST_CHECK_THROW(estimator.estimate_delay(a, b), std::exception);
48 BOOST_CHECK_THROW(tested tmp(a, b), std::exception);
timeseries_t delay_timeseries_periodic(timeseries_t const &ts, duration_t delay, duration_t sampling_period)
Delay a timeseries using a periodic extension for early values.
std::vector< T, jb::fftw::allocator< T > > aligned_vector
Alias std::vector with properly allocated storage for FFTW3.
A simple time delay estimator based on cross-correlation.
void create_square_timeseries(int nsamples, timeseries &ts)
Create a simple timeseries where the values look like a square.
std::size_t nsamples(container_type const &a)
Count the elements in the last dimension of a vector-like container.
BOOST_AUTO_TEST_CASE(fftw_time_delay_estimator_simple)