Code Duplication    Length = 18-21 lines in 2 locations

tests/test_ionization.py 2 locations

@@ 19-36 (lines=18) @@
16
]
17
18
19
@pytest.mark.parametrize(
20
	"edissfunc, expected",
21
	EDISS_FUNCS_EXPECTED,
22
)
23
def test_endiss(edissfunc, expected):
24
	energies = np.logspace(-1, 2, 4)
25
	fluxes = np.ones_like(energies)
26
	# ca. 100, 150, 200 km
27
	scale_heights = np.array([6e5, 27e5, 40e5])
28
	rhos = np.array([5e-10, 1.7e-12, 2.6e-13])
29
	# energy dissipation "profiles"
30
	ediss = edissfunc(
31
		energies[None, :], fluxes[None, :],
32
		scale_heights[:, None], rhos[:, None]
33
	)
34
	assert ediss.shape == (3, 4)
35
	np.testing.assert_allclose(ediss[0, 2], expected)
36
	return
37
38
39
@pytest.mark.parametrize(
@@ 59-79 (lines=21) @@
56
	return
57
58
59
@pytest.mark.parametrize(
60
	"edissfunc, expected",
61
	# exclude bremsstrahlung for now,
62
	# scipy's rbf interpolation uses np.meshgrid
63
	# which messes with the order of the dimensions
64
	# and doesn't work for higher-dimensional arrays
65
	EDISS_FUNCS_EXPECTED[:-1],
66
)
67
def test_endiss_transposed(edissfunc, expected):
68
	energies = np.logspace(-1, 2, 4)
69
	fluxes = np.ones_like(energies)
70
	# ca. 100, 150, 200 km
71
	scale_heights = np.array([6e5, 27e5, 40e5])
72
	rhos = np.array([5e-10, 1.7e-12, 2.6e-13])
73
	ediss = edissfunc(
74
		energies[:, None], fluxes[:, None],
75
		scale_heights[None, :], rhos[None, :]
76
	)
77
	assert ediss.shape == (4, 3)
78
	np.testing.assert_allclose(ediss[2, 0], expected)
79
	return
80
81
82
@pytest.mark.parametrize(