Skip to main content

FluctuationAnalysisTools

GitHub Release GitHub Actions Workflow Status GitHub License PyPI - Downloads

A Python library for creating and processing long-term dependent datasets, with a focus on statistical analysis tools for fluctuation analysis, time series generation, and signal processing.

Table of Contents

Features

  • Synthetic Data Generation: Create datasets with controlled statistical properties (Hurst exponent, long-term dependencies) including:
    • Kasdin method for fractional Brownian noise (Kasdin, N. J. (1995). Discrete simulation of colored noise and stochastic processes and 1/f/sup /spl alpha// power law noise generation.).
    • FFT-based N-dimensional fractional Brownian motion (fBm) generator (Timmer, J., & Koenig, M. (1995). On generating power law noise).
  • Fluctuation Analysis: Perform various fluctuation analysis methods including:
    • Detrended Fluctuation Analysis (DFA)
    • Detrended Partial Cross-Correlation Analysis (DPCCA)
    • Standard Fluctuation Analysis (FA)
    • SVD-based DFA
    • Multidimensional DFA
    • Quantitative Signal Analysis (QSS)
  • Research Tools: Support scientific research in complex systems exhibiting long-range correlations
  • Performance Optimized: Multi-threaded implementations with C++ extensions for large datasets

Requirements

  • Python 3.8+
  • NumPy
  • SciPy
  • Matplotlib (for visualization)
  • C++ compiler (Mac and Windows packages contains precompiled binaries)

Installation

You can install FluctuationAnalysisTools from PyPI:

pip install FluctuationAnalysisTools

Or clone the repository and install locally:

git clone https://github.com/Digiratory/FluctuationAnalysisTools.git
cd StatTools
pip install .

Quick Start

You can find examples and published usages in the folder Research

If you used the project in your paper, you are welcome to ask us to add reference via a Pull Request or an Issue.

Generating Synthetic Data

from StatTools.generators import generate_fbn
import numpy as np

# Create a dataset with Hurst exponent H = 0.8 using the unified interface
hurst = 0.8
length = 1440

# Generate fractional Brownian noise using the default Kasdin method
fbn_series = generate_fbn(hurst=hurst, length=length)
print(f"Generated fBn series with shape: {fbn_series.shape}")

Analyzing Time Series

Detrended Fluctuation Analysis

from StatTools.generators import generate_fbn
from StatTools.analysis.dfa import dfa
from StatTools.analysis.utils import analyse_zero_cross_ff
import numpy as np

h = 0.7  # choose Hurst parameter
length = 6000  # vector's length

# Generate synthetic data using modern unified interface
trajectory = generate_fbn(hurst=h, length=length, method="kasdin").flatten()

# Analyze using functional-style DFA interface
s_vals, f2_vals = dfa(trajectory, degree=2)

# Calculate Hurst exponent from fluctuation function
f_vals = np.sqrt(f2_vals).reshape(1, -1)  # Convert F^2(s) to F(s) and reshape for analysis
s_vals_2d = s_vals.reshape(1, -1)  # Reshape scales to 2D array
hurst_result, _ = analyse_zero_cross_ff(f_vals, s_vals_2d)
hurst_exponent = hurst_result.slopes[0].value

print(f"Estimated H: {hurst_exponent:.3f} (Expected: {h:.3f})")

Support

For questions and discussions:

Research and Examples

Find comprehensive examples and published research in the research/ folder:

If you've used StatTools in your research, consider contributing your examples via a Pull Request or Issue.

Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • Setting up a development environment
  • Code style and standards
  • Testing guidelines
  • Submitting pull requests

License

This project is licensed under the terms specified in LICENSE.txt.

Citation

If you use FluctuationAnalysisTools in your research, please cite:

@article{bogachev2023understanding,
  title={Understanding the complex interplay of persistent and antipersistent regimes in animal movement trajectories as a prominent characteristic of their behavioral pattern profiles: Towards an automated and robust model based quantification of anxiety test data},
  author={Bogachev, Mikhail I and Lyanova, Asya I and Sinitca, Aleksandr M and Pyko, Svetlana A and Pyko, Nikita S and Kuzmenko, Alexander V and Romanov, Sergey A and Brikova, Olga I and Tsygankova, Margarita and Ivkin, Dmitry Y and others},
  journal={Biomedical signal processing and control},
  volume={81},
  pages={104409},
  year={2023},
  publisher={Elsevier}
}

and

@article{bogachev2023video,
  title={Video-based marker-free tracking and multi-scale analysis of mouse locomotor activity and behavioral aspects in an open field arena: a perspective approach to the quantification of complex gait disturbances associated with Alzheimer's disease},
  author={Bogachev, Mikhail and Sinitca, Aleksandr and Grigarevichius, Konstantin and Pyko, Nikita and Lyanova, Asya and Tsygankova, Margarita and Davletshin, Eldar and Petrov, Konstantin and Ageeva, Tatyana and Pyko, Svetlana and others},
  journal={Frontiers in Neuroinformatics},
  volume={17},
  pages={1101112},
  year={2023},
  publisher={Frontiers Media SA}
}

Changelog

See CHANGELOG.md for version history and updates.

Metadata

Release files for FluctuationAnalysisTools 1.11.0

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

Source distribution (sdist)

Source distribution for FluctuationAnalysisTools 1.11.0
File Size Uploaded
fluctuationanalysistools-1.11.0.tar.gz 9.7 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for FluctuationAnalysisTools 1.11.0
File Interpreter ABI Platform
fluctuationanalysistools-1.11.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
fluctuationanalysistools-1.11.0-cp311-cp311-macosx_10_14_universal2.whl CPython 3.11 CPython 3.11 macOS 10.14+ universal2 (ARM64, x86-64) Details

Total release size: 10.1 MB

Release files / fluctuationanalysistools-1.11.0.tar.gz

Download URL fluctuationanalysistools-1.11.0.tar.gz
Size 9.7 MB
Tags Source
SHA-256 checksum
How to use checksums
d2fa5e670caf9a773a7b7de766b22afde9bc3a239bee0d3f4abd4c1f955649fe
BLAKE2b-256 checksum
How to use checksums
773e5ca3497dee190007129ba3519ef3d7d125e7ab5c7a44c5a78bff82a62a70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / fluctuationanalysistools-1.11.0-cp311-cp311-win_amd64.whl

Download URL fluctuationanalysistools-1.11.0-cp311-cp311-win_amd64.whl
Size 193.6 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
e49dc24f9c54c4a3d55066d51d71841f6db2a9e517bd8df93bb17cacfb4424e5
BLAKE2b-256 checksum
How to use checksums
0d7aab2cbb72dce14f7124df2c0c354b3ffaba4eb162cee64ce7955dcd0a7c26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / fluctuationanalysistools-1.11.0-cp311-cp311-macosx_10_14_universal2.whl

Download URL fluctuationanalysistools-1.11.0-cp311-cp311-macosx_10_14_universal2.whl
Size 276.6 kB
Tags CPython 3.11 macOS 10.14+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
eda8bbd368de5064a89ebc510a917975f4eeb0d4c93a291a530a5e00b9785476
BLAKE2b-256 checksum
How to use checksums
e62b4415d0d7ea7a1ccb77ef0f886168be10ea9dac085863e51461896da81f4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14
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