test_compare.test_PDD_pdist()   A
last analyzed

Complexity

Conditions 4

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 12
rs 9.9
c 0
b 0
f 0
cc 4
nop 2
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