Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python implementation refactor, numba kernel optimizations, some GPU implementations #8

Open
wants to merge 60 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
03fab69
started python implementation
din14970 Apr 28, 2021
29e0e57
changed zero to empty
din14970 Apr 28, 2021
00604dd
added gradient function
din14970 May 4, 2021
a14952c
fixed initialization of an array
berkels Jan 3, 2022
c479bfd
added a main to show that the registration energy and its gradient do…
berkels Jan 3, 2022
c1642e1
typo fixes
berkels Jan 3, 2022
80051ad
group some variables into arrays
berkels Jan 3, 2022
8b02d6a
formatting with "black -l 120"
berkels Jan 3, 2022
34849d7
changed the implementation of the gradient to make it easier to reuse…
berkels Jan 3, 2022
b920ad9
iterate over cells instead of nodes, which gets rid off all "if"s in …
berkels Jan 3, 2022
9bd9018
formatting with "black -l 120"
berkels Jan 3, 2022
f5b696e
replaced the image interpolation code with an implementation I had at…
berkels Jan 4, 2022
410f24c
added a residual function as preparation to reformulate the minimizat…
berkels Jan 4, 2022
ee6803b
minor change to make some variable names more accurate
berkels Jan 4, 2022
30356de
added the gradient of the residual function and reformulated the mini…
berkels Jan 5, 2022
5d0212d
precompute the constant matrix that corresponds to the gradient of th…
berkels Jan 5, 2022
f06dee2
the regularizer part of the residual itself is now implemented as ma…
berkels Jan 5, 2022
7e811f5
minor simplifications
berkels Jan 6, 2022
06c7e57
started to organize the code from main into a class
berkels Jan 6, 2022
31b0330
continued to organize the code from main into a class
berkels Jan 6, 2022
4c783c6
continued to organize the code from main into a class
berkels Jan 6, 2022
884507b
continued to organize the code from main into a class
berkels Jan 6, 2022
6ae36f4
finished to organize the code from main into a class
berkels Jan 6, 2022
32e67ad
the degrees of freedom are now the displacement instead of the deform…
berkels Jan 6, 2022
5271fe9
small improvements
berkels Jan 6, 2022
55b36a0
normalize the integration domain so that its longest axis has length …
berkels Jan 6, 2022
8ca6828
the degrees of freedom of the displacement are now relative to the no…
berkels Jan 6, 2022
946bbb6
implemented multi level optimization in main
berkels Jan 7, 2022
8c43e07
increased resolution of the example images
berkels Jan 7, 2022
a2556e3
fixed a deprecation warning
berkels Jan 7, 2022
b0fd895
added a custom non-linear least squares solver based on sparseqr
berkels Jan 7, 2022
447afb2
use CHOLMOD to solve the sparse normal equations instead of sparseqr …
berkels Jan 9, 2022
48f6c00
Merge pull request #4 from berkels/testing
din14970 Jan 9, 2022
f8662de
updated gitignore
din14970 Jan 9, 2022
5b37620
update example
din14970 Jan 9, 2022
a942cac
small changes
din14970 Jun 5, 2022
c917f39
black formating
din14970 Jun 5, 2022
35cc230
refactoring implementation
din14970 Jun 23, 2022
8085c80
moved solver to own module
din14970 Nov 27, 2022
212f134
implemented fast interpolation
din14970 Dec 19, 2022
5e28965
minor modification interpolation parameters
din14970 Dec 19, 2022
c9f1a95
functioning evaluation and pd evaluation kernels cpu gpu
din14970 Dec 27, 2022
e172ac7
fixed up quadrature and objective functions
din14970 Dec 28, 2022
ef62db8
registrationobjectivefunction appears to work
din14970 Dec 29, 2022
cee216e
working tests quadrature
din14970 Dec 30, 2022
7d7b6da
added test data and tests for objective functions
din14970 Dec 30, 2022
df0fc59
added basic test for solver
din14970 Dec 30, 2022
e81798a
added gpu test for solver
din14970 Dec 30, 2022
c1dba19
updated implementation, gave shape to jnnr class
din14970 Jan 1, 2023
9900260
functioning tests and first version of implementation user interface
din14970 Jan 2, 2023
e5fe05d
code quality/deployment stuff
din14970 Jan 2, 2023
2ffbb25
updated python versions
din14970 Jan 3, 2023
edd38d1
small edit
din14970 Jan 3, 2023
1981361
fixed setup.py
din14970 Jan 3, 2023
a273e35
updating install dependencies in build.yml
din14970 Jan 3, 2023
c3edaf7
updated test command
din14970 Jan 3, 2023
e55129b
fixing typing and test issues
din14970 Jan 3, 2023
182630e
additional fixes
din14970 Jan 3, 2023
82b18e7
fixing issues with jit
din14970 Jan 3, 2023
e137abb
fixing jit decorator issues
din14970 Jan 3, 2023
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
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
max-complexity = 10
max-line-length = 88
extend-ignore = E203
exclude =
__pycache__
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7, 3.8]
python-version: ["3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -37,9 +37,9 @@ jobs:
run: conda --version
- name: Install depedencies and package
shell: bash
run: pip install -U -e .'[tests]'; conda install match-series
run: pip install -U -e .'[dev]'; conda install match-series
- name: Run tests
run: pytest --cov=pymatchseries --pyargs pymatchseries
run: pytest --cov=pymatchseries -vv
- name: Generate line coverage
if: ${{ matrix.os == 'ubuntu-latest' }}
run: coverage report --show-missing
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Exclude
tags
examples/data/**
examples/sample_data_HAADF
Expand Down
87 changes: 87 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.PHONY: clean clean-build clean-pyc clean-test coverage dist docs help install lint lint/flake8 lint/black
.DEFAULT_GOAL := help

define BROWSER_PYSCRIPT
import os, webbrowser, sys

from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT

define PRINT_HELP_PYSCRIPT
import re, sys

for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT

BROWSER := python -c "$$BROWSER_PYSCRIPT"

help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

check: lint test

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache

lint:
black .
isort .
mypy ./pymatchseries
flake8 ./pymatchseries

test: ## run tests quickly with the default Python
pytest -vv

coverage: ## check code coverage quickly with the default Python
coverage run --source pymatchseries -m pytest
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/pymatchseries.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ pymatchseries
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html

servedocs: docs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .

release: dist ## package and upload a release
twine upload dist/*

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist

install: clean ## install the package to the active Python's site-packages
python setup.py install
11 changes: 11 additions & 0 deletions dev-requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sphinx>=3.0.2
sphinx-rtd-theme>=0.4.3
pytest>=5.4
pytest-cov>=2.8.1
coverage>=5.0
black>=19.3b0
pre-commit>=1.16
flake8>=3.9.2
mypy>=0.990
mypy-extensions>=0.4.2
isort>=5.10.1
9 changes: 9 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: pyMatchSeries
channels:
- conda-forge
dependencies:
- hyperspy
- cupy
- match-series
- numba
- pydantic
Loading