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