Skip to content

Commit

Permalink
Update requirements, minor fixes
Browse files Browse the repository at this point in the history
* Minor differences in ITIM results due to changes in depedencies
* Version bump
  • Loading branch information
Marcello-Sega committed Aug 7, 2024
1 parent 38acc8d commit e975d76
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
# The executor is the environment in which the steps below will be executed - below will use a python 3.8 container
# Change the version below to your required version of python
docker:
- image: cimg/python:3.8
- image: cimg/python:3.9
# Checkout the code as the first step. This is a dedicated CircleCI step.
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
Expand All @@ -35,10 +35,10 @@ jobs:
# pip-dependency-file: test-requirements.txt # if you have a different name for your requirements file, maybe one that combines your runtime and test requirements.
- run:
name: Install pytim
command: pip install -r requirements.txt -r requirements.testing.txt -e .
command: pip install --upgrade -r requirements.txt -r requirements.testing.txt -e .
- run:
name: Run tests
command: python setup.py test
command: pytest pytim/*py pytim/observables/*py pytim/datafiles/*py --doctest-modules
# - run:
#name: Coverage
# # This assumes pytest is installed via the install-package step above
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.11"]
python-version: ["3.9", "3.11"]
include:
- python-version: "3.9"
numpy-version: "1.26.4"
Expand All @@ -31,7 +31,7 @@ jobs:
python -m pip install flake8 pytest
python -m pip install mdtraj
python -m pip install .
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements.txt ]; then pip install --upgrade -r requirements.txt; fi
#- name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
Expand All @@ -40,5 +40,5 @@ jobs:
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest pytim/*py pytim/observables/*py pytim/datafiles/*py --doctest-modules
pytest pytim/ --doctest-modules
2 changes: 1 addition & 1 deletion pytim/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _define_cluster_group(self):
labels = np.array(labels)

# counts is not necessarily ordered by size of cluster.
sorting = np.argsort(counts)[::-1]
sorting = np.argsort(counts,kind='stable')[::-1]
# labels for atoms in each cluster starting from the largest
unique_labels = np.sort(np.unique(labels[labels > -1]))
# by default, all elements of the cluster_group are in
Expand Down
14 changes: 7 additions & 7 deletions pytim/itim.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ class ITIM(Interface):
>>> print (interface.layers)
[[<AtomGroup with 786 atoms> <AtomGroup with 681 atoms>
<AtomGroup with 663 atoms> <AtomGroup with 651 atoms>]
[<AtomGroup with 786 atoms> <AtomGroup with 702 atoms>
<AtomGroup with 666 atoms> <AtomGroup with 636 atoms>]]
[<AtomGroup with 786 atoms> <AtomGroup with 699 atoms>
<AtomGroup with 669 atoms> <AtomGroup with 636 atoms>]]
>>> interface.layers[0,0] # upper side, first layer
<AtomGroup with 786 atoms>
>>> interface.layers[1,2] # lower side, third layer
<AtomGroup with 666 atoms>
<AtomGroup with 669 atoms>
>>> # or as a whole AtomGroup. This can include all atoms in all layers
>>> interface.atoms
Expand Down Expand Up @@ -170,12 +170,12 @@ def layers(self):
>>> print(interface.layers[:,0:3]) # 1st - 3rd layer (0:3), on both sides
[[<AtomGroup with 786 atoms> <AtomGroup with 681 atoms>
<AtomGroup with 663 atoms>]
[<AtomGroup with 786 atoms> <AtomGroup with 702 atoms>
<AtomGroup with 666 atoms>]]
[<AtomGroup with 786 atoms> <AtomGroup with 699 atoms>
<AtomGroup with 669 atoms>]]
>>> print(interface.layers[1,0:4:2]) # side 1, layers 1-4 & stride 2 (0:4:2)
[<AtomGroup with 786 atoms> <AtomGroup with 666 atoms>]
[<AtomGroup with 786 atoms> <AtomGroup with 669 atoms>]
"""

Expand Down Expand Up @@ -380,7 +380,7 @@ def _assign_layers(self):
_y = utilities.get_y(self.cluster_group, self.normal)
_z = utilities.get_z(self.cluster_group, self.normal)

sort = np.argsort(_z + _radius * np.sign(_z))
sort = np.argsort(_z + _radius * np.sign(_z),kind='stable')
# NOTE: np.argsort returns the sorted *indices*

if self.multiproc and ('win' not in self.system.lower()):
Expand Down
4 changes: 2 additions & 2 deletions pytim/observables/contactangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def _fit_ellipse_fitzgibbon(x, y):
C = np.zeros((6, 6), dtype=float)
C[0, 2], C[2, 0], C[1, 1] = 2, 2, -1
eigval, eigvec = np.linalg.eig(np.linalg.solve(S, C))
sort = np.argsort(eigval)
sort = np.argsort(eigval,kind='stable')
eigval, eigvec = eigval[sort], eigvec[sort]
lam = np.nonzero(np.logical_and(
eigval > 0, np.isfinite(eigval)))[0][-1]
Expand All @@ -515,7 +515,7 @@ def _fit_ellipse_flusser(x, y):
C = np.array(((0, 0, 2), (0, -1, 0), (2, 0, 0)), dtype=float)
M = np.linalg.solve(C, M)
eigval, eigvec = np.linalg.eig(M)
sort = np.argsort(eigval)[::-1]
sort = np.argsort(eigval,kind='stable')[::-1]
eigval, eigvec = eigval[sort], eigvec[sort]
con = 4 * eigvec[0] * eigvec[2] - eigvec[1]**2 > 0
ak = eigvec[:, np.nonzero(con)[0]]
Expand Down
14 changes: 6 additions & 8 deletions pytim/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,15 @@ def correlate(a1, a2=None, _normalize=True):
... size.append(len(inter.layers[0,0]))
>>>
>>> # we need to subtract the average value
>>> np.set_printoptions(precision=3,threshold=1000)
>>> np.set_printoptions(precision=3,threshold=1000,suppress=True)
>>> corr = pytim.utilities.correlate(size-np.mean(size))
>>> corr = corr/corr[0] # normalize to 1
>>> print (corr)
[ 1. 0.142 0.104 0.147 0.371 0.099 0.165 0.095 0.338 0.219
-0.021 0.087 0.245 -0.01 -0.193 0.103 0.029 -0.009 -0.11 0.012
-0.133 0.056 -0.283 -0.276 0.035 -0.012 -0.211 -0.429 -0.132 -0.263
0.072 -0.7 -0.236 0.136 -0.243 -0.878 -0.13 -0.329 -0.386 -0.652
-0.267 -0.188 -0.226 -0.79 -0.284 -0.02 -1.512 -1.316 -0.188 7.551]
>>> np.set_printoptions()
[ 1. 0.153 0.104 0.17 0.365 0.115 0.171 0.104 0.342 0.24
-0.021 0.097 0.265 0.004 -0.169 0.088 0.022 -0.008 -0.113 0.003
-0.139 0.051 -0.287 -0.279 0.027 -0.019 -0.223 -0.43 -0.157 -0.285
0.048 -0.704 -0.26 0.13 -0.31 -0.883 -0.12 -0.323 -0.388 -0.64
-0.295 -0.177 -0.165 -0.81 -0.321 -0.031 -1.557 -1.296 -0.305 6.974]
This will produce (sampling the whole trajectory), the following:
Expand Down
2 changes: 1 addition & 1 deletion pytim/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.0'
__version__ = '1.0.1'
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cython>=0.24.1
numpy>=1.16.0
numpy>=1.26.4,<2.0.0
scipy>=1.6.0
gsd<=3.2.1
MDAnalysis>=2.0
gsd>3.0.0
MDAnalysis>=2.7.0
PyWavelets>=0.5.2
scikit-image>=0.14.2
sphinx>=1.4.3
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def run_tests(self):
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=[
'numpy>=1.16', 'cython>=0.24.1','gsd<=3.2.1'
'numpy>=1.26.4,<2.0.0', 'cython>=0.24.1','gsd>=3.0.0','MDAnalysis>=2.7.0'
],

# List additional groups of dependencies here (e.g. development
Expand Down

0 comments on commit e975d76

Please sign in to comment.