From 9267e685a312b583e7c6cf12b11969baaaadaad9 Mon Sep 17 00:00:00 2001 From: Matteo Bachetti Date: Wed, 27 Sep 2023 15:21:59 +0200 Subject: [PATCH] Test --- stingray/tests/test_fourier.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/stingray/tests/test_fourier.py b/stingray/tests/test_fourier.py index 3c4ca5e70..80d4447e8 100644 --- a/stingray/tests/test_fourier.py +++ b/stingray/tests/test_fourier.py @@ -65,6 +65,31 @@ def test_flux_iterables(dtype): assert isinstance(er[0], cast_kind) +def test_avg_pds_imperfect_lc_size(): + times = np.arange(100) + fluxes = np.ones(100).astype(float) + gti = np.asarray([[-0.5, 99.5]]) + segment_size = 5.99 + dt = 1 + res = avg_pds_from_events(times, gti, segment_size, dt, fluxes=fluxes) + assert res.meta["segment_size"] == 5 + assert res.meta["dt"] == 1 + + +def test_avg_cs_imperfect_lc_size(): + times1 = times2 = np.arange(100) + fluxes1 = np.ones(100).astype(float) + fluxes2 = np.ones(100).astype(float) + gti = np.asarray([[-0.5, 99.5]]) + segment_size = 5.99 + dt = 1 + res = avg_cs_from_events( + times1, times2, gti, segment_size, dt, fluxes1=fluxes1, fluxes2=fluxes2 + ) + assert res.meta["segment_size"] == 5 + assert res.meta["dt"] == 1 + + class TestCoherence(object): @classmethod def setup_class(cls):