Skip to main content

fdars – Functional Data Analysis for Python

CI PyPI MIT licensed Status: Experimental

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.

Documentation

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

fdars-0.7.0.tar.gz (3.3 MB view details)

Uploaded Source

Built Distributions

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

fdars-0.7.0-cp39-abi3-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

fdars-0.7.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

fdars-0.7.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.0 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

fdars-0.7.0-cp39-abi3-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

fdars-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file fdars-0.7.0.tar.gz.

File metadata

  • Download URL: fdars-0.7.0.tar.gz
  • Upload date:
  • Size: 3.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fdars-0.7.0.tar.gz
Algorithm Hash digest
SHA256 7e679a9f9731b3b4d863197ec8d909276c36d0e6123a7766dce1443a9f5d7b25
MD5 2c0e8637442c5890454981d6128f200a
BLAKE2b-256 6721a0b36ba0a2a74d5945256901f465c2edde13a2ca6a12c23e6b45dd2632c9

See more details on using hashes here.

File details

Details for the file fdars-0.7.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: fdars-0.7.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.1 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

Hashes for fdars-0.7.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 88e3315b5dec1f7575d9c43e9b773bc3ead5e2edb389fb2cf76ed88356818b70
MD5 00bd4e18f91f012d98c039d012b1257f
BLAKE2b-256 030f1326286c5445594ec37cb11a4e968a29a8c8c45770a9b2a428dbe96607b8

See more details on using hashes here.

File details

Details for the file fdars-0.7.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fdars-0.7.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5fa7d890a6c99a51088bc60ef23a01f8ebf25f7d38116723dbac41d816f7712
MD5 6be130e49e7bd87782ab9416a7c8dbae
BLAKE2b-256 163e1663f2a100f0ac51a4b4c8846956158d2338a09765b11a03c4363c5dfd14

See more details on using hashes here.

File details

Details for the file fdars-0.7.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fdars-0.7.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 82a7c6768f06cf8bd20f327b243eea381a1b7ddb627ccf5c6af39d8a7132705d
MD5 9632ef561d9b4bb4b1da252437719976
BLAKE2b-256 ff3dee37f267eec465cac8363891035725aa216ebe1018352c0b38611fab3b5c

See more details on using hashes here.

File details

Details for the file fdars-0.7.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fdars-0.7.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.9 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

Hashes for fdars-0.7.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f16e10e56a9d4342936b6c686220af18497fb314d1033dcb166108f6add1a9f5
MD5 286ecd162e7bc94375b8df3cadfb22ac
BLAKE2b-256 3aa3eaaa3b2d5d8d0b36eb3419ef5258d0238580e00d93f8f5a5ef7574bd8302

See more details on using hashes here.

File details

Details for the file fdars-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for fdars-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fd1d7747d01418c147c520539a78ce88f1a369323a043f07f18bae4541487c12
MD5 cfac70cae7530fec76ab53ac2d96982a
BLAKE2b-256 db2afeeafb53a6e976903e66db937c20c828928936ea1b7720cedb4deeb8579a

See more details on using hashes here.

Release history Release notifications | RSS feed

0.9.0

6 files

This release

0.7.0 This release

6 files

0.6.0

6 files

0.5.0

6 files

0.4.0

6 files

0.3.0

6 files

0.2.0

6 files

0.1.0

6 files

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