| Total Complexity | 4 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 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 |