Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
067b6b7
coverage test
charnley Jan 31, 2021
78c5ef1
better testing
charnley Jan 31, 2021
25cfb99
add mypy
charnley Jul 9, 2021
f0637d2
first mypy init
charnley Jul 16, 2021
861032d
ignore env
charnley Dec 16, 2021
eafdda8
added ndarray type
charnley Dec 16, 2021
2db9ca5
type iteration
charnley Dec 26, 2021
f76e3d1
iteration mypy
charnley Dec 26, 2021
14ff956
mypy iteration
charnley Dec 27, 2021
d234944
mypy iteration
charnley Dec 27, 2021
310ac5e
mypy iteration
charnley Dec 27, 2021
3abe12b
mypy iteration
charnley Dec 27, 2021
7392998
mypy iteration
charnley Dec 27, 2021
58e77aa
mypy iteration
charnley Dec 27, 2021
c09018c
mypy iteration
charnley Dec 27, 2021
87d354a
mypy iteration
charnley Dec 27, 2021
57e309f
mypy iteration
charnley Dec 27, 2021
f329108
mypy iteration
charnley Dec 27, 2021
2fb77b4
mypy iteration
charnley Dec 27, 2021
936d735
using conda for development environment
charnley Dec 27, 2021
dc61768
switch to conda
charnley Jan 1, 2022
df57f93
setup conda env
charnley Jan 1, 2022
f12c809
use conda
charnley Jan 1, 2022
c063a4f
remove strict for now
charnley Jan 1, 2022
1504e09
debug pytest
charnley Jan 1, 2022
3283256
gh action iteration
charnley Jan 1, 2022
e84ba7a
iteration actions
charnley Jan 1, 2022
0d83720
iteration
charnley Jan 1, 2022
fbb827b
iteration
charnley Jan 1, 2022
b3d6bf0
iteration
charnley Jan 1, 2022
dd6c5e3
iteration
charnley Jan 1, 2022
ae98afe
iteration
charnley Jan 1, 2022
75f7af8
iteration
charnley Jan 1, 2022
5e67774
iteation
charnley Jan 1, 2022
344d59f
remove debug statements
charnley Jan 23, 2022
20987e6
coverage test
charnley Jan 31, 2021
3750add
better testing
charnley Jan 31, 2021
1167453
add mypy
charnley Jul 9, 2021
449ec1d
first mypy init
charnley Jul 16, 2021
fc6b2a2
ignore env
charnley Dec 16, 2021
8e81bc0
added ndarray type
charnley Dec 16, 2021
356c840
Merge branch 'master' into charnley/types
charnley May 29, 2022
3464b84
Merge noob here
charnley May 29, 2022
3e80055
More merge noob
charnley May 29, 2022
d71f755
Fixed clear typing for inertia
charnley Jun 2, 2022
482bdd8
Added bad format XYZ file
charnley Jun 2, 2022
8c3bc2e
Fixed types for atom indicies
charnley Jun 6, 2022
84761a5
Ignore where
charnley Jun 6, 2022
904316f
Added qml to test env
charnley Jun 6, 2022
3af77d6
Fixed qml test (xyz reader returns int)
charnley Jun 6, 2022
ad6c02e
Remove numpy version for backward compatibility
charnley Jun 6, 2022
7a481ad
Updated Python versions
charnley Jun 18, 2022
264e58b
Correct versions
charnley Jun 18, 2022
5db98eb
Added testing to --print output (#78) (#90)
charnley Jun 18, 2022
4b4d9f0
Added cover statements
charnley Jun 18, 2022
f952934
Better test coverage
charnley Jun 19, 2022
37944d8
Remove qml from main test (not always intsalled)
charnley Jul 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ name: Test Python package
on:
push:
branches:
- 'master'
- 'dev'
- '**'
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
test:
name: Testing
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if test -f requirements.txt; then pip install -r requirements.txt; fi
if test -f requirements.dev.txt; then pip install -r requirements.dev.txt; fi
python -m pip install git+https://github.com/qmlcode/qml@develop
python -m pip install pre-commit
- name: Test format
run: |
pre-commit run --all-files
- name: Test with pytest
run: |
make test
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: rmsd-dev
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
- run: |
pip install git+https://github.com/qmlcode/qml@develop
- run: |
ls
pwd
which python
conda info
- run: |
make test
- run: |
pre-commit run --all-files
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# dev
.vim
env

*.py[cod]

# Test coverage
htmlcov
*,cover

# setup.py output
files.txt

Expand Down
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ repos:
# - id: mypy
# args: [--ignore-missing-imports]

- repo: local
hooks:
- id: mypy
name: Checking types
entry: mypy
language: system
types: [ python ]


- repo: local
hooks:

Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
python = python

env:
conda env create -f ./environment.yml -p ./env --quiet

test:
${python} -m pytest -vrs tests
python -m pytest -vrs tests

test-cov-html:
python -m pytest -vrs --cov=rmsd --cov-report html tests
13 changes: 13 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: rmsd-dev
channels:
- defaults
- conda-forge
dependencies:
- matplotlib
- mypy
- numpy
- pre-commit
- pylint
- pytest
- pytest-cov
- scipy
20 changes: 9 additions & 11 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env python

from __future__ import print_function
from pathlib import Path

import matplotlib.pyplot as plt
import matplotlib.pyplot as plt # type: ignore
import numpy as np
from numpy import ndarray

import rmsd


def rotation_matrix(sigma):
def rotation_matrix(sigma: float) -> ndarray:
"""

https://en.wikipedia.org/wiki/Rotation_matrix
Expand All @@ -27,7 +28,7 @@ def rotation_matrix(sigma):
return R


def save_plot(A, B, filename):
def save_plot(A: ndarray, B: ndarray, filename: Path) -> None:

Ax = A[:, 0]
Ay = A[:, 1]
Expand All @@ -42,12 +43,9 @@ def save_plot(A, B, filename):
plt.xlim([-2.5, 2.5])
plt.grid(True)
plt.tick_params(labelsize=15)
plt.savefig(filename + ".png")

plt.savefig(filename.with_suffix(".png"))
plt.clf()

return


A = np.array([[1.0, 1.0], [1.0, 2.0], [2.0, 1.5]])

Expand All @@ -63,17 +61,17 @@ def save_plot(A, B, filename):
B = np.dot(B, rotation_matrix(90))

print("Normal RMSD", rmsd.rmsd(A, B))
save_plot(A, B, "plot_beginning")
save_plot(A, B, Path("plot_beginning"))

# Manipulate
A -= rmsd.centroid(A)
B -= rmsd.centroid(B)

print("Translated RMSD", rmsd.rmsd(A, B))
save_plot(A, B, "plot_translated")
save_plot(A, B, Path("plot_translated"))

U = rmsd.kabsch(A, B)
A = np.dot(A, U)

print("Rotated RMSD", rmsd.rmsd(A, B))
save_plot(A, B, "plot_rotated")
save_plot(A, B, Path("plot_rotated"))
2 changes: 0 additions & 2 deletions requirements.dev.txt

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scipy
numpy
scipy
7 changes: 6 additions & 1 deletion rmsd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@
"get_coordinates_pdb",
"get_coordinates_xyz",
"hungarian",
"int_atom",
"kabsch",
"kabsch_rmsd",
"kabsch_rotate",
"kabsch_fit",
"quaternion_rmsd",
"quaternion_rotate",
"quaternion_transform",
"reorder_brute",
"reorder_distance",
"reorder_hungarian",
"reorder_inertia_hungarian",
"reorder_similarity",
"rmsd",
"set_coordinates",
"str_atom",
]

if __name__ == "__main__":
calculate_rmsd.main()
calculate_rmsd.main() # pragma: no cover
Loading