This library allows to create and process long-term dependent datasets.
Project description
StatTools
This library allows to create and process long-term dependent datasets.
Installation
You can install FluctuationAnalysisTools from PyPI.
pip install FluctuationAnalysisTools
Or you can clone the repository and build it using the command
pip install .
Examples
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.
Basis usage
- To create a simple dataset with given Hurst parameter:
from StatTools.filters import FilteredArray
h = 0.8 # choose Hurst parameter
total_vectors = 1000 # total number of vectors in output
vectors_length = 1440 # each vector's length
t = 8 # threads in use during computation
correlated_vectors = Filter(h, vectors_length).generate(n_vectors=total_vectors,
threads=t, progress_bar=True)
Generators
- Example of sequence generation based on the Hurst exponent.
from StatTools.generators.hurst_generator import LBFBmGenerator
h = 0.8 # choose Hurst parameter
filter_len = 40 # length of the optimized filter
base = 1.2 # the basis for the filter optimization algorithm
target_len = 4000 # number of generation iterations
generator = LBFBmGenerator(h, filter_len, base)
signal = []
for value in islice(generator, target_len):
signal.append(value)
For more information and generator validation, see lbfbm_generator.ipynb.
It is also possible to use the method of generating increments with a given H using KasdinGenerator.
from StatTools.generators.kasdin_generator import KasdinGenerator
h = 0.8 # choose Hurst parameter
target_len = 4000 # number of generation iterations
generator = KasdinGenerator(h, length=target_len)
# the first option
signal = generator.get_full_sequence()
# the second option
signal_list = []
for sample in generator:
signal_list.append(sample)
For more information see Kasdin, N. J. (1995). Discrete simulation of colored noise and stochastic processes and 1/f/sup /spl alpha// power law noise generation. doi:10.1109/5.381848.
Fluctuational Analysis
- Example of Detrended Fluctuational Analysis (DFA)
from StatTools.generators.base_filter import Filter
from StatTools.analysis.dfa import DFA
h = 0.7 # choose Hurst parameter
length = 6000 # vector's length
target_std = 1.0
target_mean = 0.0
generator = Filter(h, length, set_mean=target_mean, set_std=target_std)
trajectory = generator.generate(n_vectors=1)
actual_mean = np.mean(trajectory)
actual_std = np.std(trajectory, ddof=1)
actual_h = DFA(trajectory).find_h()
print(actual_h) # Should print a value close to 0.7
Contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fluctuationanalysistools-1.9.0.tar.gz.
File metadata
- Download URL: fluctuationanalysistools-1.9.0.tar.gz
- Upload date:
- Size: 2.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67e8a1b98202afd29ed09add95dccf2f5f0aa7001d04ec75d33fe1a2bf7d91ae
|
|
| MD5 |
8fec6b353d66c9cd7310b3700957ce84
|
|
| BLAKE2b-256 |
be956234082c11a5c1f62b50d77afae2eec5ee7fc811a03d39d6c15c350a350d
|
File details
Details for the file fluctuationanalysistools-1.9.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: fluctuationanalysistools-1.9.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 55.0 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0ea0bd8dcf259e2494876429bbc24995f06f834cd6bf2322b51d7dd1b1274fa
|
|
| MD5 |
28a675fada429bba48969feee82f0fcc
|
|
| BLAKE2b-256 |
8017a3e040a0501f434209a8b5bc5adce8ce6bc49cde1f30b7233a90e9f5c37a
|
File details
Details for the file fluctuationanalysistools-1.9.0-cp311-cp311-macosx_10_9_universal2.whl.
File metadata
- Download URL: fluctuationanalysistools-1.9.0-cp311-cp311-macosx_10_9_universal2.whl
- Upload date:
- Size: 67.0 kB
- Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2989386725aa3e9af18fc1bc38f346e145f5f4aa15f0053807ed7b97d98b177
|
|
| MD5 |
c1aebc6c067ebf64ce425ccca3ffb9ff
|
|
| BLAKE2b-256 |
9a90ca9e3e9a618e52c0cfb68142520a3e89a404e207e8c72ca23f7f79cb6e57
|