From 30bfa351604367a5506e68add2f1471d34d65ddd Mon Sep 17 00:00:00 2001 From: Matteo Bachetti Date: Thu, 9 Jan 2025 10:13:59 +0100 Subject: [PATCH] Add test --- stingray/pulse/tests/test_accelsearch.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/stingray/pulse/tests/test_accelsearch.py b/stingray/pulse/tests/test_accelsearch.py index 8fd3d54ca..5c4f854c4 100644 --- a/stingray/pulse/tests/test_accelsearch.py +++ b/stingray/pulse/tests/test_accelsearch.py @@ -1,6 +1,6 @@ import numpy as np import pytest -from stingray.pulse.accelsearch import accelsearch +from stingray.pulse.accelsearch import accelsearch, _create_responses from stingray.utils import HAS_NUMBA pytestmark = pytest.mark.slow @@ -46,6 +46,16 @@ def setup_class(cls): def test_prepare(self): pass + @pytest.mark.parametrize("kind", [float, np.longdouble]) + def test_create_response_types(self, kind): + z = np.array([-1, 0, 1], dtype=kind) + zint = np.array([-1, 0, 1], dtype=int) + + rs = _create_responses(z) + rints = _create_responses(zint) + for r, rint in zip(rs, rints): + assert np.allclose(r, rint) + def test_signal(self): candidate_table = accelsearch( self.times,