@@ 39-59 (lines=21) @@ | ||
36 | return |
|
37 | ||
38 | ||
39 | @pytest.mark.parametrize( |
|
40 | "edissfunc, expected", |
|
41 | # exclude bremsstrahlung for now, |
|
42 | # scipy's rbf interpolation uses np.meshgrid |
|
43 | # which messes with the order of the dimensions |
|
44 | # and doesn't work for higher-dimensional arrays |
|
45 | EDISS_FUNCS_EXPECTED[:-1], |
|
46 | ) |
|
47 | def test_endiss_transposed(edissfunc, expected): |
|
48 | energies = np.logspace(-1, 2, 4) |
|
49 | fluxes = np.ones_like(energies) |
|
50 | # ca. 100, 150, 200 km |
|
51 | scale_heights = np.array([6e5, 27e5, 40e5]) |
|
52 | rhos = np.array([5e-10, 1.7e-12, 2.6e-13]) |
|
53 | ediss = edissfunc( |
|
54 | energies[:, None], fluxes[:, None], |
|
55 | scale_heights[None, :], rhos[None, :] |
|
56 | ) |
|
57 | assert ediss.shape == (4, 3) |
|
58 | np.testing.assert_allclose(ediss[2, 0], expected) |
|
59 | return |
|
60 | ||
61 | ||
62 | @pytest.mark.parametrize( |
|
@@ 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( |