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 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.
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.0.5a3.tar.gz
.
File metadata
- Download URL: splinebox-0.0.5a3.tar.gz
- Upload date:
- Size: 252.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c509060b941e3d45eb2a65d0b8f7de84ed2f0b7d3ec134c5cd83de5f452326c6 |
|
MD5 | 565a3fa7c3b2aa0428353e5fb642530d |
|
BLAKE2b-256 | 493299d5738fafaeb6eacfe60cd36286718c0421451a32de6a864a5cf2616a30 |
File details
Details for the file splinebox-0.0.5a3-py3-none-any.whl
.
File metadata
- Download URL: splinebox-0.0.5a3-py3-none-any.whl
- Upload date:
- Size: 17.5 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 | 779abf8333df9e80caf74e87d6efffad468d62a4a8f34c95bf05cb3d9d2bc2c9 |
|
MD5 | 1fc460b0503cf26a798064b50419ca50 |
|
BLAKE2b-256 | 10d79f2945882050e47973786893e764fd0a5372c6eaf58eba18737066987be4 |