Skip to main content

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.

Documentation Status License BSD-3 PyPI Python Version tests codecov DOI

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

splinebox-0.2.1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

splinebox-0.2.1-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file splinebox-0.2.1.tar.gz.

File metadata

  • Download URL: splinebox-0.2.1.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for splinebox-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0d1f6d18a37f57cd2f2d09c3f2d2b191386bb7a3d81f09830d96322946c0dcc1
MD5 91af7611f84edad8522bdc21a2ace90a
BLAKE2b-256 67e9a685b1fe97f2cdd39ad895387b89bb071084b6b609b3c159c90b530d2d30

See more details on using hashes here.

File details

Details for the file splinebox-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: splinebox-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for splinebox-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 826df2f04536166191d7fd2af5f6a87e9d0c4d87bed5e8fac47f23cdcfedf02b
MD5 2edec235975dcb05b891ed1d0d20d714
BLAKE2b-256 7ec6d52eb2774b8a1281ace836e8345971102f8c587b0b233828d09eff8288f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page