diff --git a/tardis/io/configuration/tests/test_config_reader.py b/tardis/io/configuration/tests/test_config_reader.py index 8c5639b31a0..f525557ca63 100644 --- a/tardis/io/configuration/tests/test_config_reader.py +++ b/tardis/io/configuration/tests/test_config_reader.py @@ -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) @@ -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: @@ -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): diff --git a/tardis/plasma/tests/test_nlte_solver.py b/tardis/plasma/tests/test_nlte_solver.py index 0f060064f30..29b9db456cb 100644 --- a/tardis/plasma/tests/test_nlte_solver.py +++ b/tardis/plasma/tests/test_nlte_solver.py @@ -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) @@ -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) @@ -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 @@ -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( diff --git a/tardis/tests/fixtures/atom_data.py b/tardis/tests/fixtures/atom_data.py index 11b8676d847..500552e4b9c 100644 --- a/tardis/tests/fixtures/atom_data.py +++ b/tardis/tests/fixtures/atom_data.py @@ -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 @@ -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)