Skip to main content

spline_basis

Template

A python library to generate spline basis functions. Check out examples in the notebooks.

Installation:

From PyPi: pip install spline-basis

NumPy is the default backend. To use the splines with PyTorch tensors or JAX arrays, install the optional extras: pip install "spline-basis[torch]", pip install "spline-basis[jax]" (or both: "spline-basis[torch,jax]").

Backends:

Every class accepts NumPy arrays (or lists), PyTorch tensors and JAX arrays, and returns results on the same backend, dtype and device as its inputs:

import torch
from splinebasis import Isplines, ISplineBasis

isplines = Isplines(order=3, lower=0, upper=1, num_knots=10)
x = torch.linspace(0, 1, 100, requires_grad=True)
values = isplines.evaluate_all(x)  # (100, isplines.n) tensor, differentiable w.r.t. x

basis = ISplineBasis(order=3, num_basis=10, lower=0, upper=1, n_grid=100)
weights = torch.rand(10, requires_grad=True)
curve = basis(weights)  # torch tensor, differentiable w.r.t. weights

ISplineBasis/MSplineBasis compute their basis on the backend of grid (NumPy by default; backend="torch" or "jax" overrides it). JAX evaluation works inside jax.jit, jax.grad and jax.vmap.

Currently supported basis functions:

  1. $\mathrm{M}$-Splines: Non-negative spline functions which integrate to 1 over the support of the basis function.
  2. $\mathrm{I}$-Splines: Monotone spline functions defined as the integral of M-splines.

Notes:

  1. The M/I splines are based on Ramsay (1988) and the Praat manual. The API follows the implementation in the dms_variants python package (dms_variants Source Code), but the splines are evaluated with a vectorized form of de Boor's recursion, written once for all backends: at each point only the order non-zero B-splines are computed, so the cost hardly grows with the number of basis functions.

maintainer: Biprateep Dey contact: biprateep@pitt.edu

Metadata

Release files for spline-basis 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spline-basis 0.2
File Size Uploaded Provenance Actions
spline_basis-0.2.tar.gz 24.6 kB Without provenance Details for spline_basis-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spline-basis 0.2
File Interpreter ABI Platform Actions
spline_basis-0.2-py3-none-any.whl Python 3 none any Details for spline_basis-0.2-py3-none-any.whl

Total release size: 40.8 kB

Release files / spline_basis-0.2.tar.gz

Download URL spline_basis-0.2.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3e8dc7f6a4dc101a2ad17a20573507283927654cfab638a8c3b44f6612d5cf76
BLAKE2b-256 checksum
How to use checksums
787d18f09d5f7d3ff9d1e5149d62a005523ac986b8eaf058b1e60f4fc9697d9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / spline_basis-0.2-py3-none-any.whl

Download URL spline_basis-0.2-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60cd5f3154f28ca0b0dbae489772c1f904aaea3589fd03da2800fcf1f8af8596
BLAKE2b-256 checksum
How to use checksums
d74b9522cc45218f58520e0aa479e4e182d2a495a0564edadbd939100fa93e2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for spline-basis 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page