Skip to content

Commit

Permalink
Fix: Pca.py doctest error (#4377)
Browse files Browse the repository at this point in the history
* fix: rmsip error

* refact: implement round

* refact: implement round

* change log

---------

Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 1, 2024
1 parent 93630da commit 6ec838b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions package/CHANGELOG
Expand Up @@ -21,6 +21,8 @@ The rules for this file:
* 2.8.0

Fixes
* Fix doctest errors of analysis/pca.py related to rounding issues
(Issue #3925, PR #4377)
* Convert openmm Quantity to raw value for KE and PE in OpenMMSimulationReader.
* Atomname methods can handle empty groups (Issue #2879, PR #4529)
* Add support for TPR files produced by Gromacs 2024.1 (PR #4523)
Expand Down
20 changes: 10 additions & 10 deletions package/MDAnalysis/analysis/pca.py
Expand Up @@ -650,10 +650,10 @@ def rmsip(self, other, n_components=None):
>>> first_interval = pca.PCA(u, select="backbone").run(start=0, stop=25)
>>> second_interval = pca.PCA(u, select="backbone").run(start=25, stop=50)
>>> last_interval = pca.PCA(u, select="backbone").run(start=75)
>>> first_interval.rmsip(second_interval, n_components=3)
0.38147609331128324
>>> first_interval.rmsip(last_interval, n_components=3)
0.17478244043688052
>>> round(first_interval.rmsip(second_interval, n_components=3), 6)
0.381476
>>> round(first_interval.rmsip(last_interval, n_components=3), 6)
0.174782
See also
Expand Down Expand Up @@ -826,14 +826,14 @@ def rmsip(a, b, n_components=None):
>>> first_interval = pca.PCA(u, select="backbone").run(start=0, stop=25)
>>> second_interval = pca.PCA(u, select="backbone").run(start=25, stop=50)
>>> last_interval = pca.PCA(u, select="backbone").run(start=75)
>>> pca.rmsip(first_interval.results.p_components.T,
>>> round(pca.rmsip(first_interval.results.p_components.T,
... second_interval.results.p_components.T,
... n_components=3)
0.38147609331128324
>>> pca.rmsip(first_interval.results.p_components.T,
... n_components=3), 6)
0.381476
>>> round(pca.rmsip(first_interval.results.p_components.T,
... last_interval.results.p_components.T,
... n_components=3)
0.17478244043688052
... n_components=3), 6)
0.174782
.. versionadded:: 1.0.0
Expand Down

0 comments on commit 6ec838b

Please sign in to comment.