Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into memory-reader-repr
Browse files Browse the repository at this point in the history
  • Loading branch information
ljwoods2 committed Feb 9, 2024
2 parents 1e8d2eb + c4ffb7e commit f5728a1
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/actions/build-src/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ runs:
which python
which pip
pip list
conda info
conda list
micromamba info
micromamba list
- name: build_mda_main
shell: bash -l {0}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- [ubuntu-22.04, manylinux_x86_64, x86_64]
- [macos-11, macosx_*, x86_64]
- [windows-2019, win_amd64, AMD64]
- [macos-14, macosx_*, arm64]
python: ["cp39", "cp310", "cp311", "cp312"]
defaults:
run:
Expand All @@ -50,7 +51,7 @@ jobs:
fetch-depth: 0

- name: Build wheels
uses: pypa/[email protected].2
uses: pypa/[email protected].5
with:
package-dir: package
env:
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/gh-ci-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, macos]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -264,14 +264,17 @@ jobs:
pypi-latest-release:
# A set of runner to check that the latest conda release works as expected
if: "github.repository == 'MDAnalysis/mdanalysis'"
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest, macos-14, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
wheels: ['true', 'false']
exclude:
- os: "macos-14"
python-version: "3.9"
steps:
# Checkout to have access to local actions (i.e. setup-os)
- uses: actions/checkout@v4
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ jobs:
include:
- name: macOS_monterey_py311
os: macOS-12
python-version: "3.11"
python-version: "3.12"
full-deps: true
codecov: true
- name: macOS_14_arm64_py312
os: macOS-14
python-version: "3.12"
full-deps: false
codecov: true
- name: numpy_min
os: ubuntu-latest
python-version: 3.9
Expand Down
9 changes: 6 additions & 3 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,24 @@ The rules for this file:


-------------------------------------------------------------------------------
??/??/?? IAlibay, HeetVekariya, marinegor, lilyminium, ljwoods2
??/??/?? IAlibay, HeetVekariya, marinegor, lilyminium, RMeli,
ljwoods2

* 2.8.0

Fixes
* Fix ChainReader `__repr__()` method when sub-reader is MemoryReader
(Issue #3349, PR #4407)
* Fix bug in PCA preventing use of `frames=...` syntax (PR #4423)
* Fix `analysis/diffusionmap.py` iteration through trajectory to iteration
over `self._sliced_trajectory`, hence supporting
`DistanceMatrix.run(frames=...)` (PR #4433)
* Fix doctest errors of lib/picklable_file_io.py (Issue #3925, PR #4371)
* Fix deploy action to use the correct version of the pypi upload action.
* Fix ChainReader `__repr__()` method when sub-reader is MemoryReader
(Issue #3349, PR #4407)

Enhancements
* Documented the r0 attribute in the `Contacts` class and added the
`n_initial_contacts` attribute, with documentation. (Issue #2604, PR #4415)

Changes
* As per NEP29, the minimum version of numpy has been raised to 1.23.
Expand Down
10 changes: 10 additions & 0 deletions package/MDAnalysis/analysis/contacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ def __init__(self, u, select, refgroup, method="hard_cut", radius=4.5,
Show detailed progress of the calculation if set to ``True``; the
default is ``False``.
Attributes
----------
n_initial_contacts : int
Total number of initial contacts.
r0 : list[numpy.ndarray]
List of distance arrays between reference groups.
Notes
-----
Expand Down Expand Up @@ -455,6 +462,9 @@ def __init__(self, u, select, refgroup, method="hard_cut", radius=4.5,
box=self._get_box(refA.universe)))
self.initial_contacts.append(contact_matrix(self.r0[-1], radius))

self.n_initial_contacts = self.initial_contacts[0].sum()


@staticmethod
def _get_atomgroup(u, sel):
select_error_message = ("selection must be either string or a "
Expand Down
10 changes: 10 additions & 0 deletions testsuite/MDAnalysisTests/analysis/test_contacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,16 @@ def test_warn_deprecated_attr(self, universe):
with pytest.warns(DeprecationWarning, match=wmsg):
assert_equal(CA1.timeseries, CA1.results.timeseries)

@pytest.mark.parametrize("datafiles, expected", [((PSF, DCD), 0),
([TPR, XTC], 41814)])
def test_n_initial_contacts(self, datafiles, expected):
"""Test for n_initial_contacts attribute"""
u = mda.Universe(*datafiles)
select = ('protein', 'not protein')
refgroup = (u.select_atoms('protein'), u.select_atoms('not protein'))

r = contacts.Contacts(u, select=select, refgroup=refgroup)
assert_equal(r.n_initial_contacts, expected)

def test_q1q2():
u = mda.Universe(PSF, DCD)
Expand Down

0 comments on commit f5728a1

Please sign in to comment.