@@ 18-35 (lines=18) @@ | ||
15 | ] |
|
16 | ||
17 | ||
18 | @pytest.mark.parametrize( |
|
19 | "edissfunc, expected", |
|
20 | EDISS_FUNCS_EXPECTED, |
|
21 | ) |
|
22 | def test_endiss(edissfunc, expected): |
|
23 | energies = np.logspace(-1, 2, 4) |
|
24 | fluxes = np.ones_like(energies) |
|
25 | # ca. 100, 150, 200 km |
|
26 | scale_heights = np.array([6e5, 27e5, 40e5]) |
|
27 | rhos = np.array([5e-10, 1.7e-12, 2.6e-13]) |
|
28 | # energy dissipation "profiles" |
|
29 | ediss = edissfunc( |
|
30 | energies[None, :], fluxes[None, :], |
|
31 | scale_heights[:, None], rhos[:, None] |
|
32 | ) |
|
33 | assert ediss.shape == (3, 4) |
|
34 | np.testing.assert_allclose(ediss[0, 2], expected) |
|
35 | return |
|
36 | ||
37 | ||
38 | @pytest.mark.parametrize( |
|
@@ 58-78 (lines=21) @@ | ||
55 | return |
|
56 | ||
57 | ||
58 | @pytest.mark.parametrize( |
|
59 | "edissfunc, expected", |
|
60 | EDISS_FUNCS_EXPECTED, |
|
61 | ) |
|
62 | def test_endiss_transposed(edissfunc, expected): |
|
63 | energies = np.logspace(-1, 2, 4) |
|
64 | fluxes = np.ones_like(energies) |
|
65 | # ca. 100, 150, 200 km |
|
66 | scale_heights = np.array([6e5, 27e5, 40e5]) |
|
67 | rhos = np.array([5e-10, 1.7e-12, 2.6e-13]) |
|
68 | ediss = edissfunc( |
|
69 | energies[:, None], fluxes[:, None], |
|
70 | scale_heights[None, :], rhos[None, :] |
|
71 | ) |
|
72 | assert ediss.shape == (4, 3) |
|
73 | np.testing.assert_allclose(ediss[2, 0], expected) |
|
74 | return |
|
75 | ||
76 | ||
77 | @pytest.mark.parametrize( |
|
78 | "edissfunc, expected", |
|
79 | EDISS_FUNCS_EXPECTED, |
|
80 | ) |
|
81 | def test_endiss_3d(edissfunc, expected): |