Skip to content

PCA test sometimes fails... #2728

@richardjgowers

Description

@richardjgowers

I get this test failing locally when I run in parallel:

=============================================================== FAILURES ===============================================================
___________________________________________________________ test_given_mean ____________________________________________________________
[gw0] linux -- Python 3.6.10 /home/richard/miniconda3/envs/mda/bin/python

pca_aligned = <MDAnalysis.analysis.pca.PCA object at 0x7f7cda848588>, u = <Universe with 3341 atoms>

    def test_given_mean(pca_aligned, u):
        pca = PCA(u, select=SELECTION, align=False,
                  mean=pca_aligned._mean).run()
>       assert_almost_equal(pca_aligned.cov, pca.cov, decimal=5)
E       AssertionError: 
E       Arrays are not almost equal to 5 decimals
E       
E       Mismatched elements: 900 / 900 (100%)
E       Max absolute difference: 1.0380358
E       Max relative difference: 106.43334522
E        x: array([[ 6.85943e-02,  6.14962e-03, -2.85235e-02, -2.46964e-03,
E                4.93089e-03, -1.45766e-02,  6.77579e-03,  6.73560e-03,
E               -6.87083e-03, -1.39547e-02,  4.34639e-03, -1.46411e-02,...
E        y: array([[ 1.10663e+00, -4.76013e-01,  2.59657e-01,  8.86885e-01,
E               -4.62178e-01,  3.13851e-01,  7.73986e-01, -4.43201e-01,
E                2.00352e-01,  4.87414e-01, -3.32454e-01,  1.01439e-01,...

analysis/test_pca.py:169: AssertionError

This is when I run pytest -n 12 from the MDAnalysisTests/ directory. If I run pytest -n 12 analysis/ it doesn't fail any more. Varying core count seems to make it fail/not fail, so it feels like something unthreadsafe is happening?

I've tried reducing the scope of the fixture and this still fails.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions