# pyfmm
Python module implementing the Fast Marching Method, written in pure Python. Only dependency is numpy 1.8+.
The implementation uses mostly boolean arrays for accessing and updating values. Instead of accepting only the smallest value at each iteration (step 3, https://en.wikipedia.org/wiki/Fast_marching_method), one may accept an arbitrary number of values at each step. This can speed up the computations considerably, but may in some cases be inaccurate (especially if the speed varies alot).
## Installation
## Interface
There are two ways to compute the distances:
a) Using a boolean array that specifies the exact points that defines the boundary,
b) Using an array of known distances to the boundary, in addition to a boolean array marking which values are certain.
Method a)
```python
import pyfmm, numpy
my_boundary = numpy.array(..., dtype=numpy.bool) # All boundary points marked as "True"
solution = pyfmm.march(my_boundary)
```
Method b)
```python
import pyfmm, numpy
known_distances = np.array(...) # Unknown values could for instance be set to np.inf
solution = pyfmm.march(numpy.argwhere(known_distances != numpy.inf), known_distances))
```
The number of values that are accepted at each iteration can be set using `batch_size`, and an array of speeds can be given using `speed`.
## Examples
The examples illustrate the following:
* `circle.py`: Distance from a ring boundary in the upper left part of the image. `batch_size` is varied to see how it affects computation time and result. In this case, the difference between the results from `batch_size=1` and `batch_size=100` seems negligible.
* `race_to_middle.py`: Straight boundary on left and right hand side, and two different `speed` fields. The examples illustrates what might happen if care is not taken when choosing a `batch_size`.
* `irregular.py`: Simply a less regular boundary shape than the two above.
The example boundary defined by examples/irregular_boundary.png:

Python module implementing the Fast Marching Method, written in pure Python. Only dependency is numpy 1.8+.
The implementation uses mostly boolean arrays for accessing and updating values. Instead of accepting only the smallest value at each iteration (step 3, https://en.wikipedia.org/wiki/Fast_marching_method), one may accept an arbitrary number of values at each step. This can speed up the computations considerably, but may in some cases be inaccurate (especially if the speed varies alot).
## Installation
## Interface
There are two ways to compute the distances:
a) Using a boolean array that specifies the exact points that defines the boundary,
b) Using an array of known distances to the boundary, in addition to a boolean array marking which values are certain.
Method a)
```python
import pyfmm, numpy
my_boundary = numpy.array(..., dtype=numpy.bool) # All boundary points marked as "True"
solution = pyfmm.march(my_boundary)
```
Method b)
```python
import pyfmm, numpy
known_distances = np.array(...) # Unknown values could for instance be set to np.inf
solution = pyfmm.march(numpy.argwhere(known_distances != numpy.inf), known_distances))
```
The number of values that are accepted at each iteration can be set using `batch_size`, and an array of speeds can be given using `speed`.
## Examples
The examples illustrate the following:
* `circle.py`: Distance from a ring boundary in the upper left part of the image. `batch_size` is varied to see how it affects computation time and result. In this case, the difference between the results from `batch_size=1` and `batch_size=100` seems negligible.
* `race_to_middle.py`: Straight boundary on left and right hand side, and two different `speed` fields. The examples illustrates what might happen if care is not taken when choosing a `batch_size`.
* `irregular.py`: Simply a less regular boundary shape than the two above.
The example boundary defined by examples/irregular_boundary.png:

Release files for pyfmm 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distributions (sdists)
| File | Size | Uploaded | |
|---|---|---|---|
| pyfmm-0.3.zip | 5.5 kB | Details | |
| pyfmm-0.3.tar.gz | 4.2 kB | Details |
Release files / pyfmm-0.3.zip
| Download URL | pyfmm-0.3.zip |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f5495483a72d46e32e8cfc8f3871008dc74f301e83d134bb8270b7932058f1c
|
|
BLAKE2b-256 checksum How to use checksums |
f3fcfc3d4277bdc6451c5b7a33762afebf71e2457628c25f7dae51cb06bbc6b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pyfmm-0.3.tar.gz
| Download URL | pyfmm-0.3.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5744de41f5ace0180efa499e2e3deb3bb88c2e559340ed79a4e0af817725e4df
|
|
BLAKE2b-256 checksum How to use checksums |
6dd09da893cb1b488bf246325a1f847c975a62d8d2e9865718febba302622f1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |