Skip to content

Commit

Permalink
Do not execute test if numba is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobachetti committed Apr 2, 2024
1 parent 14f231a commit baa5060
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions stingray/tests/test_crossspectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from stingray.crossspectrum import normalize_crossspectrum, normalize_crossspectrum_gauss
from stingray.crossspectrum import coherence, time_lag
from stingray import StingrayError
from stingray.utils import HAS_NUMBA
from stingray.simulator import Simulator
from stingray.fourier import poisson_level
from stingray.filters import filter_for_deadtime
Expand Down Expand Up @@ -1250,6 +1251,7 @@ def test_classical_significances(self):
maxpower = np.max(cs.power)
assert np.all(np.isfinite(cs.classical_significances(threshold=maxpower / 2.0)))

@pytest.mark.skipif("not HAS_NUMBA")
def test_deadtime_corr(self):
tmax = 100.0
segment_size = 1
Expand Down
6 changes: 3 additions & 3 deletions stingray/tests/test_powerspectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from astropy.io import fits
from stingray import Lightcurve
from stingray.events import EventList
from stingray.utils import HAS_NUMBA
from stingray import Powerspectrum, AveragedPowerspectrum, DynamicalPowerspectrum
from stingray.powerspectrum import powerspectrum_from_time_array
from astropy.modeling.models import Lorentz1D
Expand Down Expand Up @@ -342,6 +343,7 @@ def test_leahy_correct_for_multiple(self, use_common_mean):
assert np.isclose(np.mean(ps.power), 2.0, atol=1e-2, rtol=1e-2)
assert np.isclose(np.std(ps.power), 2.0 / np.sqrt(ps.m), atol=0.1, rtol=0.1)

@pytest.mark.skipif("not HAS_NUMBA")
def test_deadtime_corr(self):
tmax = 100.0
segment_size = 1
Expand Down Expand Up @@ -501,9 +503,7 @@ def test_leahy_norm_total_variance(self):
square of the number of data points in the light curve
"""
ps = Powerspectrum(self.lc, norm="Leahy")
ps_var = (np.sum(self.lc.counts) / ps.n**2.0) * (
np.sum(ps.power[:-1]) + ps.power[-1] / 2.0
)
ps_var = (np.sum(self.lc.counts) / ps.n**2.0) * (np.sum(ps.power[:-1]) + ps.power[-1] / 2.0)

assert np.isclose(ps_var, np.var(self.lc.counts), atol=0.01)

Expand Down

0 comments on commit baa5060

Please sign in to comment.