Skip to content

Commit

Permalink
Resolve formal integral test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfullard committed Jun 28, 2024
1 parent e192a9d commit 1ec39a2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
13 changes: 13 additions & 0 deletions tardis/spectrum/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest

from tardis.opacities.opacity_state import opacity_state_initialize


@pytest.fixture(scope="package")
def simulation_verysimple_opacity_state(simulation_verysimple):
return opacity_state_initialize(
simulation_verysimple.plasma,
line_interaction_type="macroatom",
disable_line_scattering=False,
continuum_processes_enabled=False,
)
8 changes: 4 additions & 4 deletions tardis/spectrum/tests/test_cuda_formal_integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,15 @@ def test_calculate_p_values(N):
not GPUs_available, reason="No GPU is available to test CUDA function"
)
@pytest.mark.parametrize("nu_insert", np.linspace(3e12, 3e16, 10))
def test_line_search_cuda(nu_insert, verysimple_opacity_state):
def test_line_search_cuda(nu_insert, simulation_verysimple_opacity_state):
"""
Initializes the test of the cuda version
against the numba implementation of the
line_search
"""
actual = np.zeros(1)
expected = np.zeros(1)
line_list_nu = verysimple_opacity_state.line_list_nu
line_list_nu = simulation_verysimple_opacity_state.line_list_nu

expected[0] = formal_integral_numba.line_search(
line_list_nu, nu_insert, len(line_list_nu)
Expand Down Expand Up @@ -283,7 +283,7 @@ def line_search_cuda_caller(line_list_nu, nu_insert, actual):
@pytest.mark.parametrize(
"nu_insert", [*np.linspace(3e12, 3e16, 10), 288786721666522.1]
)
def test_reverse_binary_search(nu_insert, verysimple_opacity_state):
def test_reverse_binary_search(nu_insert, simulation_verysimple_opacity_state):
"""
Initializes the test of the cuda version
against the numba implementation of the
Expand All @@ -292,7 +292,7 @@ def test_reverse_binary_search(nu_insert, verysimple_opacity_state):
"""
actual = np.zeros(1)
expected = np.zeros(1)
line_list_nu = verysimple_opacity_state.line_list_nu
line_list_nu = simulation_verysimple_opacity_state.line_list_nu

imin = 0
imax = len(line_list_nu) - 1
Expand Down

0 comments on commit 1ec39a2

Please sign in to comment.