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

test_compare   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 14
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_PDD_pdist() 0 13 4
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