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.1.tar.gz (21.9 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.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scaleinvariance-0.3.1.tar.gz
  • Upload date:
  • Size: 21.9 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.1.tar.gz
Algorithm Hash digest
SHA256 985a7a70e0062257194160586a0ca99be0cd7f9ede461ed7bdc250693d6f3f9b
MD5 fbcf1c7171293754b15299ec5f4d5e5b
BLAKE2b-256 17a6acb8ed55e090d7cff4705561c415bd7a56369550cf7fe650633787d390be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scaleinvariance-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6883f41aa060c0e7daba2a0ac5cc3525a3b2689be965926478163bb50355a9e
MD5 3d38aa6f054274cab4c0374cc2e045c3
BLAKE2b-256 78b6bc1292dc4e84161fc1dab24431e774668175079b65c311df936c4fcb8bfb

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