Passed
Push — master ( 8b2ed0...4823d2 )
by Daniel
03:53
created

test_compare.test_PDD_pdist()   A

Complexity

Conditions 4

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 13
rs 9.95
c 0
b 0
f 0
cc 4
nop 2
1
import os
2
import pytest
3
import amd
4
import numpy as np
5
6
7
def test_PDD_pdist(root_dir, reference_data):
8
9
    for name in reference_data:
10
        
11
        if 1 < len(reference_data[name]) < 1000:
12
            
13
            pdds = [s.pdd for s in reference_data[name]]
14
            cdm = amd.PDD_pdist(pdds)
15
            loaded = np.load(os.path.join(root_dir, rf'{name}_cdm.npz'))
16
            reference_cdm = loaded['cdm']
17
            
18
            if not np.amax(np.abs(cdm - reference_cdm)) < 1e-6:
19
                pytest.fail(f'PDD_pdist disagrees with reference.')
20
         
21
                
22
# def test_PDD_cdist(root_dir, reference_data):
23
    
24
#     t2_exp_pdds = [s.pdd for s in reference_data['T2_experimental']]
25
#     t2_sim_pdds = [s.pdd for s in reference_data['T2_simulated']]
26
    
27
#     cdm = amd.PDD_cdist(t2_exp_pdds, t2_sim_pdds)
28
    
29
#     loaded = np.load(os.path.join(root_dir, r'T2_exp_vs_sim_cdm.npz'))
30
#     reference_cdm = loaded['cdm']
31
    
32
#     if not np.amax(np.abs(cdm - reference_cdm)) < 1e-6:
33
#         pytest.fail(f'PDD_cdist disagrees with reference.')
34