Code Duplication    Length = 21-21 lines in 2 locations

tests/test_ionization.py 2 locations

@@ 105-125 (lines=21) @@
102
	return
103
104
105
@pytest.mark.parametrize(
106
	"edissfunc, expected",
107
	# exclude bremsstrahlung for now,
108
	# scipy's rbf interpolation uses np.meshgrid
109
	# which messes with the order of the dimensions
110
	# and doesn't work for higher-dimensional arrays
111
	EDISS_FUNCS_EXPECTED[:-1],
112
)
113
def test_endiss_3d_transposed(edissfunc, expected):
114
	energies = np.logspace(-1, 2, 4)
115
	fluxes = np.ones_like(energies)
116
	# ca. 100, 150, 200 km
117
	scale_heights = np.array([6e5, 27e5, 40e5])
118
	rhos = np.array([5e-10, 1.7e-12, 2.6e-13])
119
	ediss = edissfunc(
120
		energies[None, :, None], fluxes[None, :, None],
121
		scale_heights[:, None, None], rhos[:, None, None]
122
	)
123
	assert ediss.shape == (3, 4, 1)
124
	np.testing.assert_allclose(ediss[0, 2, 0], expected)
125
	return
126
127
128
def test_ssusi_ioniz():
@@ 82-102 (lines=21) @@
79
	return
80
81
82
@pytest.mark.parametrize(
83
	"edissfunc, expected",
84
	# exclude bremsstrahlung for now,
85
	# scipy's rbf interpolation uses np.meshgrid
86
	# which messes with the order of the dimensions
87
	# and doesn't work for higher-dimensional arrays
88
	EDISS_FUNCS_EXPECTED[:-1],
89
)
90
def test_endiss_3d(edissfunc, expected):
91
	energies = np.logspace(-1, 2, 4)
92
	fluxes = np.ones_like(energies)
93
	# ca. 100, 150, 200 km
94
	scale_heights = np.array([6e5, 27e5, 40e5])
95
	rhos = np.array([5e-10, 1.7e-12, 2.6e-13])
96
	ediss = edissfunc(
97
		energies[None, None, :], fluxes[None, None, :],
98
		scale_heights[:, None, None], rhos[:, None, None]
99
	)
100
	assert ediss.shape == (3, 1, 4)
101
	np.testing.assert_allclose(ediss[0, 0, 2], expected)
102
	return
103
104
105
@pytest.mark.parametrize(