Skip to main content

Simulation and analysis of multifractal fields

Project description

scaleinvariance

Simulation and analysis tools for scale-invariant processes and multifractal fields.

Documentation

Current Features

Hurst Exponent Estimation

  • Haar fluctuation method: haar_fluctuation_hurst()
  • Structure function method: structure_function_hurst()
  • Spectral method: spectral_hurst()

All methods support multi-dimensional arrays, averaging over dimensions that are orthogonal to the specified dimension along which spectra are calculated (specified by axis. Plotting data and fit line may be returned with return_fit=True.

Simulation

pytorch is leveraged for parallel and efficient simulation.

  • 1D fractional Brownian motion: acausal_fBm_1D() - Spectral synthesis method
  • 2D fractional Brownian motion: acausal_fBm_2D() - Isotropic 2D fields with proper frequency normalization
  • 1D fractionally integrated flux (FIF): FIF_1D() - Multifractal cascade simulation; causal/acausal
  • 2D fractionally integrated flux (FIF): FIF_2D() - Isotropic 2D multifractals

Installation

pip install scaleinvariance

Basic Usage

from scaleinvariance import acausal_fBm_1D, acausal_fBm_2D, FIF_1D, haar_fluctuation_hurst

# Generate 1D fractional Brownian motion
fBm_1d = acausal_fBm_1D(1024, H=0.7)

# Generate 2D fractional Brownian motion  
fBm_2d = acausal_fBm_2D((512, 1024), H=0.7)

# Generate multifractal FIF timeseries
fif = FIF_1D(2**16, H=0.3, C1=0.1)

# Estimate Hurst exponent
H_est, H_err = haar_fluctuation_hurst(fBm_1d)
print(f"Estimated H = {H_est:.3f} ± {H_err:.3f}")

Testing

# Test 1D fBm generation and Hurst estimation
python tests/test_acausal_fBm_hurst_estimation.py 0.7

# Test 2D fBm with isotropy validation
python tests/test_2d_fbm.py 0.7

Examples

See the examples/ directory for comprehensive demonstrations:

  • fif_comparison_demo.py: Compare Hurst estimation methods on multifractal FIF simulations with different intermittency parameters
  • multi_dataset_haar_analysis.py: Real-world data analysis using Haar fluctuation method

Run examples:

python examples/fif_comparison_demo.py

Data source for LGMR: https://www.ncei.noaa.gov/access/paleo-search/study/33112

Planned Features

  • Advanced multifractal analysis tools
  • Comprehensive documentation

Requirements

  • Python ≥ 3.8
  • NumPy, SciPy, PyTorch, Matplotlib

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scaleinvariance-0.3.2.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

scaleinvariance-0.3.2-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file scaleinvariance-0.3.2.tar.gz.

File metadata

  • Download URL: scaleinvariance-0.3.2.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for scaleinvariance-0.3.2.tar.gz
Algorithm Hash digest
SHA256 f0611908bbee631588a2f6ae022420027885a3a3b51ef7ce310d800c10d708b8
MD5 568cd64392886d08ff03792905caec99
BLAKE2b-256 3b2270a9b5d8f70d6675f05abc9f09413bb2d4619c99b5b3aa40efbb5f840e8c

See more details on using hashes here.

File details

Details for the file scaleinvariance-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for scaleinvariance-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d996f5397cee7654be7715309896555ac76df3b92638f91226b37750d6f8c04b
MD5 666fb31546c09a301bdc0550a78b9899
BLAKE2b-256 70c1a24b0c9b2f0cc2e7e2092665f4e138b08956ff833cdaf5abe3e68dbebae7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page