Code Duplication    Length = 21-21 lines in 2 locations

tests/test_ionization.py 2 locations

@@ 85-105 (lines=21) @@
82
	return
83
84
85
@pytest.mark.parametrize(
86
	"edissfunc, expected",
87
	# exclude bremsstrahlung for now,
88
	# scipy's rbf interpolation uses np.meshgrid
89
	# which messes with the order of the dimensions
90
	# and doesn't work for higher-dimensional arrays
91
	EDISS_FUNCS_EXPECTED[:-1],
92
)
93
def test_endiss_3d_transposed(edissfunc, expected):
94
	energies = np.logspace(-1, 2, 4)
95
	fluxes = np.ones_like(energies)
96
	# ca. 100, 150, 200 km
97
	scale_heights = np.array([6e5, 27e5, 40e5])
98
	rhos = np.array([5e-10, 1.7e-12, 2.6e-13])
99
	ediss = edissfunc(
100
		energies[None, :, None], fluxes[None, :, None],
101
		scale_heights[:, None, None], rhos[:, None, None]
102
	)
103
	assert ediss.shape == (3, 4, 1)
104
	np.testing.assert_allclose(ediss[0, 2, 0], expected)
105
	return
106
107
108
def test_ssusi_ioniz():
@@ 62-82 (lines=21) @@
59
	return
60
61
62
@pytest.mark.parametrize(
63
	"edissfunc, expected",
64
	# exclude bremsstrahlung for now,
65
	# scipy's rbf interpolation uses np.meshgrid
66
	# which messes with the order of the dimensions
67
	# and doesn't work for higher-dimensional arrays
68
	EDISS_FUNCS_EXPECTED[:-1],
69
)
70
def test_endiss_3d(edissfunc, expected):
71
	energies = np.logspace(-1, 2, 4)
72
	fluxes = np.ones_like(energies)
73
	# ca. 100, 150, 200 km
74
	scale_heights = np.array([6e5, 27e5, 40e5])
75
	rhos = np.array([5e-10, 1.7e-12, 2.6e-13])
76
	ediss = edissfunc(
77
		energies[None, None, :], fluxes[None, None, :],
78
		scale_heights[:, None, None], rhos[:, None, None]
79
	)
80
	assert ediss.shape == (3, 1, 4)
81
	np.testing.assert_allclose(ediss[0, 0, 2], expected)
82
	return
83
84
85
@pytest.mark.parametrize(