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.6.0.tar.gz (3.0 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.6.0-cp39-abi3-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.9+Windows x86-64

fdars-0.6.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB view details)

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

fdars-0.6.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.9 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

fdars-0.6.0-cp39-abi3-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

fdars-0.6.0-cp39-abi3-macosx_10_12_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for fdars-0.6.0.tar.gz
Algorithm Hash digest
SHA256 bde1f6a43e196e3cff3e46edeccfa1a55bb84a29dfaa3cd3baca8ad8f59d5fc4
MD5 5a840b61a61d1663acd97f6439f4f08e
BLAKE2b-256 250fd55bd81c468c7ee296f8f0a3733c26dd0bf76c334bd72361f875f80e594d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fdars-0.6.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.9 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.6.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 58bf09389db70988e093eb3c9d07aee14b040bc1ef87c813a51c551660f111d7
MD5 1d9b3e631b1c1c2fdeda2bf18999bc7b
BLAKE2b-256 ef29a1f3721b2f5844392881316feaf645e247e1c2b426ba4334fb1333004dfb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fdars-0.6.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0462039703427c83bdf34d9468b87039745375882de56500ec5e3e7b64772d69
MD5 93a4fefab4e98fec017298b1ede806d4
BLAKE2b-256 5de3325c6d4962269e20eafa69d7d5148e9e5b6c30b17d9a81d6dbc749a1b0af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fdars-0.6.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 60399e54ca35bc3c80f8b6bb4106d234170f41521cb1d1ed006b6a5f2f9d07ac
MD5 228d59ff243d2f72e08bc979508f3189
BLAKE2b-256 171524228f7968d1020c178cd4980e83151646d4d8d464f9a1e21f7f1756c337

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fdars-0.6.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.7 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.6.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ffecd097c9394f2b13412a602f138bbde51d590c528587dd0d33fd0111e028e2
MD5 366ea1865c0aceee09d2a8dd754a6cc7
BLAKE2b-256 d9e33286809dea41b6c15634cff1079ea7305eda152821f5b9aa751004d007a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fdars-0.6.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 00bc6da89caf2a694f85afa6082f7eefdc63fa3675d1982e929cb42330f5d45b
MD5 8624a7381d00bebbf47dc5845975e874
BLAKE2b-256 898f8bbdfbcf37bb27b7eb53f16cdb68a969278fd898e8ed7388f61b0ff19cee

See more details on using hashes here.

Release history Release notifications | RSS feed

0.9.0

6 files

0.7.0

6 files

This release

0.6.0 This release

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