Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHls committed Nov 29, 2023
1 parent 9bfdeba commit c3bd2b6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
12 changes: 3 additions & 9 deletions tardis/io/configuration/tests/test_config_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ def test_plasma_nlte_section_root_config(
] = [
"He I",
]
tardis_config_verysimple_nlte["plasma"]["nlte_ionization_species"] = [
"H I"
]
tardis_config_verysimple_nlte["plasma"]["nlte_ionization_species"] = ["H I"]
config = Configuration.from_config_dict(tardis_config_verysimple_nlte)
with pytest.raises(PlasmaConfigError) as ve:
assemble_plasma(config, nlte_raw_model_root, nlte_atom_data)
Expand Down Expand Up @@ -229,9 +227,7 @@ def test_plasma_nlte_section_lu_config(
] = [
"He I",
]
tardis_config_verysimple_nlte["plasma"]["nlte_ionization_species"] = [
"H I"
]
tardis_config_verysimple_nlte["plasma"]["nlte_ionization_species"] = ["H I"]
tardis_config_verysimple_nlte["plasma"]["nlte_solver"] = "lu"
config = Configuration.from_config_dict(tardis_config_verysimple_nlte)
with pytest.raises(PlasmaConfigError) as ve:
Expand Down Expand Up @@ -262,9 +258,7 @@ def test_plasma_nlte_root_exc_section_config(
] = [
"He I",
]
tardis_config_verysimple_nlte["plasma"]["nlte_excitation_species"] = [
"H I"
]
tardis_config_verysimple_nlte["plasma"]["nlte_excitation_species"] = ["H I"]
tardis_config_verysimple_nlte["plasma"]["nlte_solver"] = "root"
config = Configuration.from_config_dict(tardis_config_verysimple_nlte)
with pytest.raises(PlasmaConfigError):
Expand Down
24 changes: 18 additions & 6 deletions tardis/plasma/tests/test_nlte_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,13 @@ def nlte_raw_plasma_dilution_factor_0_lu(
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv #
###############################################################################
@pytest.mark.xfail
def test_critical_case_dilution_factor_1_root(nlte_raw_plasma_dilution_factor_1):
def test_critical_case_dilution_factor_1_root(
nlte_raw_plasma_dilution_factor_1,
):
"""Check that the LTE and NLTE solution agree for dilution_factor=1.0."""
ion_number_density_nlte = nlte_raw_plasma_dilution_factor_1_root.ion_number_density.values
ion_number_density_nlte = (
nlte_raw_plasma_dilution_factor_1_root.ion_number_density.values
)
ion_number_density_nlte[np.abs(ion_number_density_nlte) < 1e-10] = 0.0

ind = IonNumberDensity(nlte_raw_plasma_dilution_factor_1_root)
Expand All @@ -309,7 +313,9 @@ def test_critical_case_dilution_factor_1_root(nlte_raw_plasma_dilution_factor_1)
@pytest.mark.xfail
def test_critical_case_dilution_factor_1_lu(nlte_raw_plasma_dilution_factor_1):
"""Check that the LTE and NLTE solution agree for dilution_factor=1.0."""
ion_number_density_nlte = nlte_raw_plasma_dilution_factor_1_lu.ion_number_density.values
ion_number_density_nlte = (
nlte_raw_plasma_dilution_factor_1_lu.ion_number_density.values
)
ion_number_density_nlte[np.abs(ion_number_density_nlte) < 1e-10] = 0.0

ind = IonNumberDensity(nlte_raw_plasma_dilution_factor_1_lu)
Expand All @@ -331,9 +337,13 @@ def test_critical_case_dilution_factor_1_lu(nlte_raw_plasma_dilution_factor_1):


@pytest.mark.xfail
def test_critical_case_dilution_factor_0_root(nlte_raw_plasma_dilution_factor_0_root):
def test_critical_case_dilution_factor_0_root(
nlte_raw_plasma_dilution_factor_0_root,
):
"""Check that the LTE and NLTE solution agree for dilution_factor=0.0."""
nlte_solver = NLTEPopulationSolverRoot(nlte_raw_plasma_dilution_factor_0_root)
nlte_solver = NLTEPopulationSolverRoot(
nlte_raw_plasma_dilution_factor_0_root
)
ion_number_density_nlte = nlte_solver.calculate(
nlte_raw_plasma_dilution_factor_0_root.gamma,
0.0, # to test collisions only, we set the radiative recombination rate to 0
Expand Down Expand Up @@ -370,7 +380,9 @@ def test_critical_case_dilution_factor_0_root(nlte_raw_plasma_dilution_factor_0_


@pytest.mark.xfail
def test_critical_case_dilution_factor_0_lu(nlte_raw_plasma_dilution_factor_0_lu):
def test_critical_case_dilution_factor_0_lu(
nlte_raw_plasma_dilution_factor_0_lu,
):
"""Check that the LTE and NLTE solution agree for dilution_factor=0.0."""
nlte_solver = NLTEPopulationSolverLU(nlte_raw_plasma_dilution_factor_0_lu)
ion_number_density_nlte = nlte_solver.calculate(
Expand Down
3 changes: 2 additions & 1 deletion tardis/tests/fixtures/atom_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from copy import deepcopy
from pathlib import Path
from pathlib import Path
import pytest

from tardis.io.atom_data.base import AtomData
Expand Down Expand Up @@ -97,6 +97,7 @@ def tardis_model_config_nlte_lu(example_configuration_dir):
def nlte_raw_model_root(tardis_model_config_nlte_root):
return SimulationState.from_config(tardis_model_config_nlte_root)


@pytest.fixture # (scope="session")
def nlte_raw_model_lu(tardis_model_config_nlte_lu):
return SimulationState.from_config(tardis_model_config_nlte_lu)

0 comments on commit c3bd2b6

Please sign in to comment.