Passed
Push — master ( 70a901...767401 )
by Stefan
03:27
created

test_ionization.test_ssusi_ioniz()   A

Complexity

Conditions 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 11
rs 9.95
c 0
b 0
f 0
cc 1
nop 0
1
# -*- coding: utf-8 -*-
2
import datetime as dt
3
import numpy as np
4
import pytest
5
6
import eppaurora as aur
7
8
9
@pytest.mark.parametrize(
10
	"edissfunc",
11
	[
12
		aur.rr1987,
13
		aur.rr1987_mod,
14
		aur.fang2008,
15
		aur.fang2010_mono,
16
		aur.fang2010_maxw_int,
17
		aur.fang2013_protons,
18
		aur.berger1974,
19
	]
20
)
21
def test_endiss(edissfunc):
22
	energies = np.logspace(-1, 2, 4)
23
	fluxes = np.ones_like(energies)
24
	# ca. 100, 150, 200 km
25
	scale_heights = np.array([6e5, 27e5, 40e5])
26
	rhos = np.array([5e-10, 1.7e-12, 2.6e-13])
27
	# energy dissipation "profiles"
28
	ediss = edissfunc(
29
		energies[None, :], fluxes[None, :],
30
		scale_heights[:, None], rhos[:, None]
31
	)
32
	assert ediss.shape == (3, 4)
33
	return
34
35
36
def test_ssusi_ioniz():
37
	energies = np.logspace(-1, 2, 4)
38
	fluxes = np.ones_like(energies)
39
	z = np.array([100, 120, 150])
40
	# energy dissipation "profiles"
41
	ediss = aur.ssusi_ioniz(
42
		z[:, None],
43
		energies[None, :], fluxes[None, :],
44
	)
45
	assert ediss.shape == (3, 4)
46
	return
47