Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import numpy as np
import pytest
import mvcm.conf as conf
@pytest.fixture
def fixturepath():
return os.path.join(os.path.dirname(__file__), 'fixtures')
@pytest.fixture
def rad():
return np.arange(260, 282)
@pytest.fixture
def single_threshold():
return [267, 270, 273, 1]
@pytest.fixture
def double_threshold():
return [264, 267, 270, 273, 276, 279, 1]
@pytest.fixture
def reference_data(fixturepath):
return os.path.join(fixturepath, 'ref_conf.npz')
def test_single_threshold(rad, single_threshold, reference_data):
ref_confidence = np.load(reference_data)['ref_sgl']
ref_confidence_flipped = np.load(reference_data)['ref_sgl_flipped']
c = conf.conf_test_new(rad, single_threshold)
assert np.all(c == ref_confidence)
single_threshold[0:-1] = single_threshold[-2::-1]
c = conf.conf_test_new(rad, single_threshold)
assert np.all(c == ref_confidence_flipped)
def test_double_threshold(rad, double_threshold, reference_data):
ref_confidence = np.load(reference_data)['ref_dbl']
ref_confidence_flipped = np.load(reference_data)['ref_dbl_flipped']
c = conf.conf_test_dble(rad, double_threshold)
print(c)
assert np.all(c == ref_confidence)
double_threshold[0:-1] = double_threshold[-2::-1]
c = conf.conf_test_dble(rad, double_threshold)
assert np.all(c == ref_confidence_flipped)