diff --git a/src/openmc_plasma_source/fuel_types.py b/src/openmc_plasma_source/fuel_types.py index 45e6ac6..2b50426 100644 --- a/src/openmc_plasma_source/fuel_types.py +++ b/src/openmc_plasma_source/fuel_types.py @@ -52,7 +52,7 @@ def get_neutron_energy_distribution( # print("DTmean", DTmean) DDmean, DDvar = nst.DDprimspecmoments(ion_temperature_kev) # print("DDmean", DDmean) - #todo make use of these DTvar and DDvar values in muir or gaussian distribution + # todo make use of these DTvar and DDvar values in muir or gaussian distribution if ["D", "T"] == sorted(set(fuel.keys())): @@ -66,8 +66,8 @@ def get_neutron_energy_distribution( dNdE_TT = strength_TT * nst.dNdE_TT(E_pspec, ion_temperature_kev) tt_source = openmc.stats.Tabular(E_pspec * 1e6, dNdE_TT) - dd_source = openmc.stats.muir(e0=DDmean*1e6, m_rat=4, kt=ion_temperature) - dt_source = openmc.stats.muir(e0=DTmean*1e6, m_rat=5, kt=ion_temperature) + dd_source = openmc.stats.muir(e0=DDmean * 1e6, m_rat=4, kt=ion_temperature) + dt_source = openmc.stats.muir(e0=DTmean * 1e6, m_rat=5, kt=ion_temperature) # todo look into combining distributions openmc.data.combine_distributions() return [tt_source, dd_source, dt_source], [ strength_TT, @@ -78,7 +78,7 @@ def get_neutron_energy_distribution( elif ["D"] == sorted(set(fuel.keys())): strength_DD = 1.0 - dd_source = openmc.stats.muir(e0=DDmean*1e6, m_rat=4, kt=ion_temperature) + dd_source = openmc.stats.muir(e0=DDmean * 1e6, m_rat=4, kt=ion_temperature) return [dd_source], [strength_DD] elif ["T"] == sorted(set(fuel.keys())): diff --git a/tests/test_fuel_types.py b/tests/test_fuel_types.py index 17dc1c5..b0a2c8a 100644 --- a/tests/test_fuel_types.py +++ b/tests/test_fuel_types.py @@ -3,35 +3,44 @@ from openmc_plasma_source import get_neutron_energy_distribution -@pytest.mark.parametrize("temperature, fuel", [ - (2e3, {'D': 1.}), - (2e3, {'T': 1.}), - (2e3, {'T': 0.5, 'D': 0.5}), - (2e3, {'T': 0.2, 'D': 0.8}), -]) +@pytest.mark.parametrize( + "temperature, fuel", + [ + (2e3, {"D": 1.0}), + (2e3, {"T": 1.0}), + (2e3, {"T": 0.5, "D": 0.5}), + (2e3, {"T": 0.2, "D": 0.8}), + ], +) def test_fuel_with_correct_inputs(temperature, fuel): # Should accept any non-zero positive inputs to either variable get_neutron_energy_distribution(temperature, fuel) -@pytest.mark.parametrize("temperature, fuel", [ - (2e3, {'D': 1.1}), - (2e3, {'T': 0.9}), - (2e3, {'T': -0.5, 'D': 0.5}), - (2e3, {'T': -0.2, 'D': -0.8}), -]) +@pytest.mark.parametrize( + "temperature, fuel", + [ + (2e3, {"D": 1.1}), + (2e3, {"T": 0.9}), + (2e3, {"T": -0.5, "D": 0.5}), + (2e3, {"T": -0.2, "D": -0.8}), + ], +) def test_fuel_with_bad_inputs(temperature, fuel): # Should reject any negative numbers and zeros. with pytest.raises(ValueError): get_neutron_energy_distribution(temperature, fuel) -@pytest.mark.parametrize("temperature, fuel", [ - (2e3, {'DD': 1.1}), - (2e3, {'DT': 0.9}), - (2e3, {'He3': -0.5, 'D': 0.5}), - (2e3, {1: -0.2, 'D': -0.8}), -]) +@pytest.mark.parametrize( + "temperature, fuel", + [ + (2e3, {"DD": 1.1}), + (2e3, {"DT": 0.9}), + (2e3, {"He3": -0.5, "D": 0.5}), + (2e3, {1: -0.2, "D": -0.8}), + ], +) def test_fuel_with_incorrect_isotopese(temperature, fuel): # Should reject anything which is not 'D' or 'T'. with pytest.raises(ValueError):