A python package for fitting splines.
Project description
splinebox
A python package for fitting splines. Developed by the EPFL Center for Imaging as part of a collaboration with the Uhlmann Group at EMBL-EBI in Feb 2024.
Features
- Flexible spline fitting for various applications.
- Support for many spline types in any dimesnionality.
- High-perfomance implementation in Python
- Extensive documentation with examples
Installation
You can install splinebox
via pip:
pip install splinebox
Usage
Here is a minimal example of a cubic B-spline in 2D with 3 knots.
import splinebox
import numpy as np
import matplotlib.pyplot as plt
n_knots = 4
spline = splinebox.spline_curves.Spline(M=n_knots, basis_function=splinebox.basis_functions.B3(), closed=True)
spline.knots = np.array([[1, 2], [3, 2], [4, 3], [1, 1]])
t = np.linspace(0, n_knots, 100)
vals = spline.eval(t, derivative=0)
plt.scatter(spline.knots[:, 0], spline.knots[:, 1])
plt.plot(vals[:, 0], vals[:, 1])
plt.show()
Support
If you encounter any problems, please file and issue describing the issue and include minimal example to reproduce the issue.
Contributing
We welcome contributions! Before you submit a pull request, please ensure that the tests are passing. You can run the tests with pytest. If you are unsure how to implement something, feel free to open an issue to discuss.
Citing splinebox
If you use splinebox in the context of scientific publication, please cite it as follows. Note, that you will have to fill in the version yourself. If you are unsure what version you are running, you can find out by running
import splinebox
print(splinbox.__version__)`
BibTeX:
@misc{splinebox,
author = {Aymanns, Florian and Andò, Edward and Uhlmann, Virginie},
title = {{S}pline{B}ox},
url = {https://pypi.org/project/splinebox/},
doi = {10.5281/zenodo.13358354},
note = {{V}ersion V.V.Vb1},
year = 2024,
}
License
This is an open source project licensed under the BSD-3-Clause License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file splinebox-0.1.1.tar.gz
.
File metadata
- Download URL: splinebox-0.1.1.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49d6610bcd15e0d3c8c2ec67c077a261e888ec11c7a8d463a0181d9d6168427f |
|
MD5 | 36052d2e2e76070b78088363b6c9069e |
|
BLAKE2b-256 | 02eca5b452bd2cf60167b04ca6e33198bad1f918649cfee353a7b50290cfe8e6 |
File details
Details for the file splinebox-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: splinebox-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aacf1e9edb6397ad274f69a95f4cb52cc0c776ab6aa985a00a420af3e7ff5e3e |
|
MD5 | f7045b895055e9d5935e4c45ef5f2fa7 |
|
BLAKE2b-256 | 1bb57ed871572fb9af6798ef18f4902c522e40b876df61ad1145026bb2070def |