test_compare   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 15
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_PDD_pdist() 0 12 4
1
import os
2
import numpy as np
3
import pytest
4
import amd
5
6
7
def test_PDD_pdist(data_dir, reference_data):
8
    for name in reference_data:
9
        if len(reference_data[name]) == 1:
10
            continue
11
12
        pdds = [s["PDD100"] for s in reference_data[name]]
13
        cdm = amd.PDD_pdist(pdds)
14
        loaded = np.load(str(data_dir / f"{name}_cdm.npz"))
15
        reference_cdm = loaded["cdm"]
16
17
        if not np.amax(np.abs(cdm - reference_cdm)) < 1e-8:
18
            pytest.fail("PDD_pdist disagrees with reference.")
19