Skip to content

Commit

Permalink
Updated the tests and preparing the package for PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
thomgrand committed Jun 3, 2021
1 parent d66cc05 commit a60ecf0
Show file tree
Hide file tree
Showing 11 changed files with 248 additions and 120 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@ jobs:
cd tests
python -m pytest .
test_lib_pip_ubuntu:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7]

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 with pip
run: |
pip install -e .[tests]
python tests/generate_test_data.py
- name: Test with pytest
run: |
cd tests
python -m pytest .
test_lib_windows:

runs-on: windows-latest
Expand Down Expand Up @@ -84,3 +107,49 @@ jobs:
python setup.py install
cd tests
python -m pytest .
test_lib_pip_windows:

runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7]

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 with pip
run: |
pip install -e .[tests]
python tests/generate_test_data.py
- name: Test with pytest
run: |
cd tests
python -m pytest .
# test_lib_gpu:
#
# runs-on: [gpu]
# strategy:
# fail-fast: false
# matrix:
# python-version: [3.7]
#
# 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 with pip
# run: |
# pip install -e .[gpu,tests]
# python tests/generate_test_data.py
# - name: Test with pytest
# run: |
# cd tests
# python -m pytest .
24 changes: 24 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF
#formats:
# - pdf

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: docs/requirements_docs.txt
- method: pip
path: .
extra_requirements:
- docs
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ for given boundary conditions

For a given anisotropic velocity, this can calculate the geodesic distance between a set of ![$\mathbf{x}_0$](https://latex.codecogs.com/svg.latex?\Large\mathbf{x}_0) and all points on the domain like shown in the figure.

![Preview](docs/figs/usage_example.jpg)
![Preview Image](docs/figs/usage_example.jpg)

Note that when using multiple ![$\mathbf{x}_0$](https://latex.codecogs.com/svg.latex?\Large\mathbf{x}_0), they are not guaranteed to be in the final solution if they are not a valid viscosity solution. A recommended read for more details on the subject is:
Evans, Lawrence C. "Partial differential equations." *Graduate studies in mathematics* 19.2 (1998).
Expand All @@ -25,13 +25,13 @@ Evans, Lawrence C. "Partial differential equations." *Graduate studies in mathem

The easiest way to install the library is using pip
```bash
pip install fimpy[cupy] #GPU version
pip install fim-python[gpu] #GPU version
```

If you don't have a compatible CUDA GPU, you can install the CPU only version to test the library, but the performance won't be comparable to the GPU version (see [Benchmark](#Benchmark)).

```bash
pip install fimpy #CPU version
pip install fim-python #CPU version
```

# Usage
Expand All @@ -54,6 +54,9 @@ fim_cp_al = FIMCupy(points, triangs, D, precision=np.float32) #GPU w. active lis
result_cp_al = fim_cp.comp_fim(x0, x0_vals)
```

# Documentation

[https://fim-python.readthedocs.io/en/latest](https://fim-python.readthedocs.io/en/latest)

# Benchmark

Expand All @@ -71,7 +74,3 @@ The library works for an arbitrary number of dimensions (manifolds in N-D), but

This library is licensed under the [GNU Affero General Public License](LICENSE).
If you need the library issued under another license for commercial use, you can contact me via e-mail [tomdev (at) gmx.net](mailto:[email protected]).

# TODOs
- Finish documentation
- More explanation on the benchmark?
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('../'))
#sys.path.insert(0, os.path.abspath('../')) #Only for local usage. Incompatible with readthedocs
import fimpy


# -- Project information -----------------------------------------------------
Expand All @@ -22,7 +23,7 @@
author = 'Thomas Grandits'

# The full version, including alpha/beta/rc tags
release = '0.1'
release = fimpy.__version__


# -- General configuration ---------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions docs/detailed_description.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Detailed Description
====================

- General description
- Jacobi method
- Active List method
15 changes: 15 additions & 0 deletions docs/interface.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Interface Methods
=================
All different solvers can be generated using the interface class.
Note that if you specify the gpu interface, but your system does not support it (or you did not install it), you will only get a cpu solver.

.. automethod:: fimpy.solver.FIMPY.create_fim_solver

Computing the anisotropic eikonal equation can be easily achieved by calling :meth:`fimpy.fim_base.FIMBase.comp_fim` on the returned solver.

.. automethod:: fimpy.fim_base.FIMBase.comp_fim

.. toctree::
:maxdepth: 2
:caption: Contents:
5 changes: 5 additions & 0 deletions docs/requirements_docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
numpy
numba
cython
sphinx
pydata_sphinx_theme
2 changes: 1 addition & 1 deletion fimpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#TODO: Import all symbols and methods here
from .solver import FIMPY

__version__ = "0.1.0"
__version__ = "1.0.0"
__author__ = "Thomas Grandits"
#__all__ = ["FIMPY"]
Loading

0 comments on commit a60ecf0

Please sign in to comment.