Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxuanzhuang committed Sep 20, 2024
2 parents a7c7624 + 4fafd51 commit 2a2da73
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 14 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ jobs:
with:
micromamba: true
full-deps: ${{ matrix.full-deps }}
# disable GSD because it occasionally introduce hanging in testing #4209
gsd: ''
# in most cases will just default to empty, i.e. pick up max version from other deps
numpy: ${{ matrix.numpy }}
extra-pip-deps: ${{ matrix.extra-pip-deps }}
Expand Down Expand Up @@ -113,7 +115,7 @@ jobs:
PYTEST_FLAGS="${PYTEST_FLAGS} --cov-config=.coveragerc --cov=MDAnalysis --cov-report=xml"
fi
echo $PYTEST_FLAGS
pytest -n auto --timeout=200 testsuite/MDAnalysisTests $PYTEST_FLAGS
pytest -n logical --timeout=200 testsuite/MDAnalysisTests $PYTEST_FLAGS
- name: run_asv
if: contains(matrix.name, 'asv_check')
Expand Down Expand Up @@ -161,6 +163,7 @@ jobs:
with:
micromamba: true
full-deps: true
gsd: ''
extra-pip-deps: "docutils sphinx-sitemap sphinxcontrib-bibtex pybtex pybtex-docutils"
extra-conda-deps: "mdanalysis-sphinx-theme>=1.3.0"

Expand Down Expand Up @@ -281,4 +284,4 @@ jobs:

- name: run tests
working-directory: ./dist
run: python -m pytest --timeout=200 -n auto --pyargs MDAnalysisTests
run: python -m pytest --timeout=200 -n logical --pyargs MDAnalysisTests
5 changes: 3 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ jobs:
biopython
"chemfiles>=0.10,<0.10.4"
duecredit
"gsd>3.0.0"
joblib
GridDataFormats
mmtf-python
Expand All @@ -114,6 +113,8 @@ jobs:
pytng>=0.2.3
rdkit>=2020.03.1
tidynamics>=1.0.0
# remove from azure to avoid test hanging #4707
# "gsd>3.0.0"
displayName: 'Install additional dependencies for 64-bit tests'
condition: and(succeeded(), eq(variables['PYTHON_ARCH'], 'x64'))
- script: >-
Expand All @@ -128,7 +129,7 @@ jobs:
displayName: 'Check installed packages'
- powershell: |
cd testsuite
pytest MDAnalysisTests --disable-pytest-warnings -n auto --timeout=200 -rsx --cov=MDAnalysis
pytest MDAnalysisTests --disable-pytest-warnings -n logical --timeout=200 -rsx --cov=MDAnalysis
displayName: 'Run MDAnalysis Test Suite'
- script: |
curl -s https://codecov.io/bash | bash
Expand Down
1 change: 1 addition & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Enhancements
(Issue #4158, PR #4304)
* Enables parallelization for analysis.gnm.GNMAnalysis (Issue #4672)
* explicitly mark `analysis.pca.PCA` as not parallelizable (Issue #4680)
* enables parallelization for analysis.bat.BAT (Issue #4663)
* Improve error message for `AtomGroup.unwrap()` when bonds are not present.(Issue #4436, PR #4642)
* Add `analysis.DSSP` module for protein secondary structure assignment, based on [pydssp](https://github.com/ShintaroMinami/PyDSSP)
* Added a tqdm progress bar for `MDAnalysis.analysis.pca.PCA.transform()`
Expand Down
29 changes: 25 additions & 4 deletions package/MDAnalysis/analysis/bat.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class to calculate dihedral angles for a given set of atoms or residues
import copy

import MDAnalysis as mda
from .base import AnalysisBase
from .base import AnalysisBase, ResultsGroup

from MDAnalysis.lib.distances import calc_bonds, calc_angles, calc_dihedrals
from MDAnalysis.lib.mdamath import make_whole
Expand Down Expand Up @@ -253,10 +253,28 @@ class BAT(AnalysisBase):
Bond-Angle-Torsions (BAT) internal coordinates will be computed for
the group of atoms and all frame in the trajectory belonging to `ag`.
.. versionchanged:: 2.8.0
Enabled **parallel execution** with the ``multiprocessing`` and ``dask``
backends; use the new method :meth:`get_supported_backends` to see all
supported backends.
"""
@due.dcite(Doi("10.1002/jcc.26036"),
description="Bond-Angle-Torsions Coordinate Transformation",
path="MDAnalysis.analysis.bat.BAT")
_analysis_algorithm_is_parallelizable = True

@classmethod
def get_supported_backends(cls):
return (
"serial",
"multiprocessing",
"dask",
)

@due.dcite(
Doi("10.1002/jcc.26036"),
description="Bond-Angle-Torsions Coordinate Transformation",
path="MDAnalysis.analysis.bat.BAT",
)

def __init__(self, ag, initial_atom=None, filename=None, **kwargs):
r"""Parameters
----------
Expand Down Expand Up @@ -558,3 +576,6 @@ def Cartesian(self, bat_frame):
def atoms(self):
"""The atomgroup for which BAT are computed (read-only property)"""
return self._ag

def _get_aggregator(self):
return ResultsGroup(lookup={'bat': ResultsGroup.ndarray_vstack})
6 changes: 6 additions & 0 deletions testsuite/MDAnalysisTests/analysis/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
OldAPIAnalysis,
)
from MDAnalysis.analysis.rms import RMSD, RMSF
from MDAnalysis.analysis.bat import BAT
from MDAnalysis.lib.util import is_installed
from MDAnalysis.analysis.gnm import GNMAnalysis

Expand Down Expand Up @@ -93,3 +94,8 @@ def client_RMSF(request):
@pytest.fixture(scope='module', params=params_for_cls(GNMAnalysis))
def client_GNMAnalysis(request):
return request.param


@pytest.fixture(scope='module', params=params_for_cls(BAT))
def client_BAT(request):
return request.param
12 changes: 6 additions & 6 deletions testsuite/MDAnalysisTests/analysis/test_bat.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ def selected_residues(self):
return ag

@pytest.fixture()
def bat(self, selected_residues):
def bat(self, selected_residues, client_BAT):
R = BAT(selected_residues)
R.run()
R.run(**client_BAT)
return R.results.bat

@pytest.fixture
def bat_npz(self, tmpdir, selected_residues):
def bat_npz(self, tmpdir, selected_residues, client_BAT):
filename = str(tmpdir / 'test_bat_IO.npy')
R = BAT(selected_residues)
R.run()
R.run(**client_BAT)
R.save(filename)
return filename

Expand All @@ -73,8 +73,8 @@ def test_bat_coordinates(self, bat):
atol=1.5e-5,
err_msg="error: BAT coordinates should match test values")

def test_bat_coordinates_single_frame(self, selected_residues):
bat = BAT(selected_residues).run(start=1, stop=2).results.bat
def test_bat_coordinates_single_frame(self, selected_residues, client_BAT):
bat = BAT(selected_residues).run(start=1, stop=2, **client_BAT).results.bat
test_bat = [np.load(BATArray)[1]]
assert_allclose(
bat,
Expand Down

0 comments on commit 2a2da73

Please sign in to comment.