Skip to content

Commit f5728a1

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into memory-reader-repr
2 parents 1e8d2eb + c4ffb7e commit f5728a1

File tree

7 files changed

+43
-11
lines changed

7 files changed

+43
-11
lines changed

.github/actions/build-src/action.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ runs:
6363
which python
6464
which pip
6565
pip list
66-
conda info
67-
conda list
66+
micromamba info
67+
micromamba list
6868
6969
- name: build_mda_main
7070
shell: bash -l {0}

.github/workflows/deploy.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
- [ubuntu-22.04, manylinux_x86_64, x86_64]
4141
- [macos-11, macosx_*, x86_64]
4242
- [windows-2019, win_amd64, AMD64]
43+
- [macos-14, macosx_*, arm64]
4344
python: ["cp39", "cp310", "cp311", "cp312"]
4445
defaults:
4546
run:
@@ -50,7 +51,7 @@ jobs:
5051
fetch-depth: 0
5152

5253
- name: Build wheels
53-
uses: pypa/cibuildwheel@v2.16.2
54+
uses: pypa/cibuildwheel@v2.16.5
5455
with:
5556
package-dir: package
5657
env:

.github/workflows/gh-ci-cron.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ jobs:
224224
fail-fast: false
225225
matrix:
226226
os: [ubuntu, macos]
227-
python-version: ["3.9", "3.10", "3.11"]
227+
python-version: ["3.9", "3.10", "3.11", "3.12"]
228228
steps:
229229
- uses: actions/checkout@v4
230230

@@ -264,14 +264,17 @@ jobs:
264264
pypi-latest-release:
265265
# A set of runner to check that the latest conda release works as expected
266266
if: "github.repository == 'MDAnalysis/mdanalysis'"
267-
runs-on: ${{ matrix.os }}-latest
267+
runs-on: ${{ matrix.os }}
268268
timeout-minutes: 60
269269
strategy:
270270
fail-fast: false
271271
matrix:
272-
os: [ubuntu, macos, windows]
273-
python-version: ["3.9", "3.10", "3.11"]
272+
os: [ubuntu-latest, macos-latest, macos-14, windows-latest]
273+
python-version: ["3.9", "3.10", "3.11", "3.12"]
274274
wheels: ['true', 'false']
275+
exclude:
276+
- os: "macos-14"
277+
python-version: "3.9"
275278
steps:
276279
# Checkout to have access to local actions (i.e. setup-os)
277280
- uses: actions/checkout@v4

.github/workflows/gh-ci.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@ jobs:
3434
include:
3535
- name: macOS_monterey_py311
3636
os: macOS-12
37-
python-version: "3.11"
37+
python-version: "3.12"
3838
full-deps: true
3939
codecov: true
40+
- name: macOS_14_arm64_py312
41+
os: macOS-14
42+
python-version: "3.12"
43+
full-deps: false
44+
codecov: true
4045
- name: numpy_min
4146
os: ubuntu-latest
4247
python-version: 3.9

package/CHANGELOG

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,24 @@ The rules for this file:
1414

1515

1616
-------------------------------------------------------------------------------
17-
??/??/?? IAlibay, HeetVekariya, marinegor, lilyminium, ljwoods2
17+
??/??/?? IAlibay, HeetVekariya, marinegor, lilyminium, RMeli,
18+
ljwoods2
1819

1920
* 2.8.0
2021

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

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

3336
Changes
3437
* As per NEP29, the minimum version of numpy has been raised to 1.23.

package/MDAnalysis/analysis/contacts.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,13 @@ def __init__(self, u, select, refgroup, method="hard_cut", radius=4.5,
405405
Show detailed progress of the calculation if set to ``True``; the
406406
default is ``False``.
407407
408+
Attributes
409+
----------
410+
n_initial_contacts : int
411+
Total number of initial contacts.
412+
r0 : list[numpy.ndarray]
413+
List of distance arrays between reference groups.
414+
408415
Notes
409416
-----
410417
@@ -455,6 +462,9 @@ def __init__(self, u, select, refgroup, method="hard_cut", radius=4.5,
455462
box=self._get_box(refA.universe)))
456463
self.initial_contacts.append(contact_matrix(self.r0[-1], radius))
457464

465+
self.n_initial_contacts = self.initial_contacts[0].sum()
466+
467+
458468
@staticmethod
459469
def _get_atomgroup(u, sel):
460470
select_error_message = ("selection must be either string or a "

testsuite/MDAnalysisTests/analysis/test_contacts.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,16 @@ def test_warn_deprecated_attr(self, universe):
375375
with pytest.warns(DeprecationWarning, match=wmsg):
376376
assert_equal(CA1.timeseries, CA1.results.timeseries)
377377

378+
@pytest.mark.parametrize("datafiles, expected", [((PSF, DCD), 0),
379+
([TPR, XTC], 41814)])
380+
def test_n_initial_contacts(self, datafiles, expected):
381+
"""Test for n_initial_contacts attribute"""
382+
u = mda.Universe(*datafiles)
383+
select = ('protein', 'not protein')
384+
refgroup = (u.select_atoms('protein'), u.select_atoms('not protein'))
385+
386+
r = contacts.Contacts(u, select=select, refgroup=refgroup)
387+
assert_equal(r.n_initial_contacts, expected)
378388

379389
def test_q1q2():
380390
u = mda.Universe(PSF, DCD)

0 commit comments

Comments
 (0)