fdars – Functional Data Analysis for Python
High-performance Functional Data Analysis for Python, powered by a Rust backend (fdars-core).
The Fdata Class
The central object in fdars is Fdata — a functional data container that bundles
observation data, evaluation grid, identifiers, and metadata into a single object
(mirroring the R package's fdata class).
import numpy as np
import pandas as pd
from fdars import Fdata
# Create functional data: 30 sine curves on [0, 1]
t = np.linspace(0, 1, 100)
X = np.array([np.sin(2 * np.pi * t + p) + np.random.normal(0, 0.1, 100)
for p in np.random.uniform(0, np.pi, 30)])
# Attach metadata as a pandas DataFrame
meta = pd.DataFrame({"group": ["A"] * 15 + ["B"] * 15,
"score": np.random.randn(30)})
fd = Fdata(X, argvals=t, metadata=meta)
fd
# Fdata (1D) – 30 obs × 100 points – range [0.0, 1.0] – metadata: group, score
# Subset — metadata DataFrame and IDs are preserved
fd_sub = fd[0:10]
fd_sub.metadata # DataFrame with 10 rows
# Methods delegate to the Rust backend
mu = fd.mean() # pointwise mean
fd_c = fd.center() # centered Fdata
d1 = fd.deriv(nderiv=1) # first derivative (returns Fdata)
norms = fd.norm(p=2.0) # L2 norms per curve
depths = fd.depth("fraiman_muniz") # depth values
D = fd.distance(method="lp") # self-distance matrix
# 2D surfaces work the same way
surfaces = np.random.randn(5, 8, 10) # 5 surfaces on 8×10 grid
fd2d = Fdata(surfaces, argvals=(np.arange(8), np.arange(10)))
You can still call low-level functions directly with raw NumPy arrays:
from fdars.depth import fraiman_muniz_1d
from fdars.metric import lp_self_1d
from fdars.clustering import kmeans_fd
depths = fraiman_muniz_1d(X, X)
D = lp_self_1d(X, t, p=2.0)
result = kmeans_fd(X, t, k=3, seed=42)
Modules
| Module | Description |
|---|---|
fdars.Fdata |
Functional data container (1D curves, 2D surfaces) with metadata |
fdars.fdata |
Low-level functional data operations (mean, derivatives, norms, centering) |
fdars.depth |
Depth functions (Fraiman-Muniz, modal, band, random projection, …) |
fdars.metric |
Distance metrics (Lp, Hausdorff, DTW, soft-DTW, Fourier, h-shift) |
fdars.basis |
Basis representations (B-splines, P-splines, Fourier) |
fdars.smoothing |
Nonparametric smoothing (Nadaraya-Watson, local polynomial, k-NN) |
fdars.clustering |
Clustering (k-means, fuzzy c-means, GMM) |
fdars.regression |
Regression (FPC linear, PLS, nonparametric, robust, FOSR, FANOVA) |
fdars.alignment |
Elastic alignment (SRSF, Karcher mean, elastic FPCA) |
fdars.outliers |
Outlier detection (LRT, outliergram, magnitude-shape) |
fdars.seasonal |
Seasonal analysis (SAZED, autoperiod, STL, peak detection) |
fdars.spm |
Statistical process monitoring (Phase I/II, EWMA, CUSUM) |
fdars.classification |
Classification (LDA, QDA, k-NN, kernel with cross-validation) |
fdars.tolerance |
Tolerance bands (FPCA, conformal, Degras SCB) |
fdars.conformal |
Conformal prediction (split, jackknife+) |
fdars.simulation |
Simulation (Karhunen-Loève, Gaussian processes) |
fdars.explain |
Explainability (SHAP, PDP, permutation importance, significant regions) |
Quick Start
git clone https://github.com/sipemu/pyfda.git
cd pyfda
python -m venv .venv && source .venv/bin/activate
pip install maturin numpy
maturin develop --release
The package exposes 16 submodules wrapping 130+ functions with zero-copy NumPy conversion. Requires Python >= 3.9.
Development
# Install dev dependencies
pip install maturin numpy pytest matplotlib
# Build in development mode
maturin develop
# Run tests
pytest tests/
# Build documentation
pip install mkdocs-material
mkdocs serve
MSRV
The minimum supported Rust version is 1.83.
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fdars-0.2.0.tar.gz.
File metadata
- Download URL: fdars-0.2.0.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce4b9dbbf1d0918b5fe1d5bc36d0655d25661c39d13704fe5f35edec64695fec
|
|
| MD5 |
621bb8f0185396910e633b37e6261e10
|
|
| BLAKE2b-256 |
64719af49949327580d0ed905f326a44e5edfdafa761f984e7fdf1aa2591a87d
|
File details
Details for the file fdars-0.2.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: fdars-0.2.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d295a2a090a68dedc98c8939167d6a68825be0862cdd981d5df3096ebed1ebd5
|
|
| MD5 |
5312f4dbae3e384a71980f2d2b5fbbb7
|
|
| BLAKE2b-256 |
9efe8846ef407b60e6472182ca7540d5d2e000f76386eba499c8e3091d908ce6
|
File details
Details for the file fdars-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: fdars-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97cced23371038a8ca02d8c1f887d39ffadc91192437fe2c9f6f47816202c735
|
|
| MD5 |
da182d6bfd67cb8eaf488403fa6827e0
|
|
| BLAKE2b-256 |
88218a5401e8454cc3e634e94bfdf607dbe5607ad278f46259ebe352eff19d10
|
File details
Details for the file fdars-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: fdars-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f25f6f0c07cda5abc66126175cfb18964649c00b3a2bd134dd00441ba1f58c6
|
|
| MD5 |
517c1d1795e83265b3a2cc839f6c6a50
|
|
| BLAKE2b-256 |
28bc66a0dfc2e72c0a041a19e82216623b2d43b2f842a1d7fe0265221cd43607
|
File details
Details for the file fdars-0.2.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: fdars-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f505f41d592fa9b55d1d62f2441901ab00bda3106245ded558859478a5091eb
|
|
| MD5 |
2f420d82fde95811517ce6ede85d37fa
|
|
| BLAKE2b-256 |
3e6eb852d54e06a276ca5cedce9e48ca4f82b8b33c554d8abc965b8d58f4a823
|
File details
Details for the file fdars-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: fdars-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11250b18bc7e2a4355bc12e360a1df2088efd078dbfa4741e4e8e4e9ca4b9706
|
|
| MD5 |
d361d7954b39782f0c6665c57eae1948
|
|
| BLAKE2b-256 |
5084c9a0314b77c71f9eaf65c32ca3bca95f0eb46b623d7cd5c0fa98b1b36252
|