fdatools
Functional data analysis for Python. fdatools is a clean-room Python rewrite of
R's fda package (Ramsay, Hooker &
Graves): basis expansions, penalised smoothing, functional PCA and CCA,
functional regression, curve registration and principal differential analysis.
- Same numbers as R. Every public function is tested against golden output
from R
fda6.3.0 atrtol = 1e-8(1e-5for iterative fits). See the parity report. - About 40 symbols instead of 515 functions. Curves are callable (
fd(t)), arithmetic is plain Python (fd1 + fd2,fd1 @ fd2), and there is onesmooth(), oneregister(), one.plot(). - Fits the Python stack. scikit-learn estimators, NumPy or PyTorch arrays through the Array API (gradients flow), pandas and xarray I/O.
Install
pip install fdatools
Optional extras: fdatools[plot] (matplotlib), fdatools[pandas] (pandas + xarray),
fdatools[io] (read R .rds files), fdatools[torch] (PyTorch). Python 3.10 to 3.13.
Quickstart
import numpy as np
import fdatools as fdt
growth = fdt.datasets.load_growth() # Berkeley growth study, ships with fdatools
basis = fdt.BSpline(domain=(1.0, 18.0), n_basis=12) # cubic B-splines on ages 1-18
coefs, *_ = np.linalg.lstsq(basis(growth.age), growth.hgtf, rcond=None)
girls = fdt.FData(coefs, basis) # 54 height curves in one object
speed = girls.derivative() # growth speed in cm/year, exact
print(speed.mean()(np.array([5.0, 12.0]))) # curves are callable: evaluate anywhere
print(fdt.inprod(girls[0], girls[0])) # L2 inner product of one curve
Next steps: penalised smoothing with automatic λ (smooth), functional PCA
(FPCA) and more in the quickstart guide.
Coming from R? The migration table
maps every fda function to its fdatools equivalent.
Documentation
Full documentation, API reference and tutorials: https://hameddavodi.github.io/fdatools.
Citing
If you use fdatools in published work, please cite it together with Ramsay &
Silverman (2005); see CITATION.cff.
License
BSD 3-Clause. fdatools is a clean-room implementation written from the published
mathematics (Ramsay & Silverman 2005; Ramsay, Hooker & Graves 2009) and the
public behaviour of R fda; it contains no R source code.
Metadata
Release files for fdatools 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fdatools-1.1.0.tar.gz | 212.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fdatools-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 433.2 kB
Release files / fdatools-1.1.0.tar.gz
| Download URL | fdatools-1.1.0.tar.gz |
|---|---|
| Size | 212.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0db3ad4fa87988320946e71175bd8e6f598950277960f54546800b0ec4b1dd6b
|
|
BLAKE2b-256 checksum How to use checksums |
10a330e0d1d8c4fc13ad56ea155a6d281bd769c5bd8d228efebf5f82f192bea5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / fdatools-1.1.0-py3-none-any.whl
| Download URL | fdatools-1.1.0-py3-none-any.whl |
|---|---|
| Size | 220.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97a2f77eb067fadeb1462794b22938d6dce96c819164f7806268c0944098afae
|
|
BLAKE2b-256 checksum How to use checksums |
2881d7ebc4ba494feebb244501cc1c953ba7f8ea7980b59a009e46c8867f9324
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|