generate-corr-sequence

The simulation of stationary time-series (discrete-time random process) with a specific autocorrelation function (ACF) and continuous probability distribution.

https://github.com/bykhov/generate_corr_sequence

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (4.2%) to scientific vocabulary

Keywords

autocorrelation autocovariance python random-process simulation time-series wss
Last synced: 6 months ago · JSON representation ·

Repository

The simulation of stationary time-series (discrete-time random process) with a specific autocorrelation function (ACF) and continuous probability distribution.

Basic Info
  • Host: GitHub
  • Owner: bykhov
  • License: other
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 14.1 MB
Statistics
  • Stars: 21
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Topics
autocorrelation autocovariance python random-process simulation time-series wss
Created almost 3 years ago · Last pushed about 2 years ago
Metadata Files
Readme License Citation

readme.md

drawing

Generate stationary correlated time-series

Summary

This Python function creates a time-series (discrete-time random process) with a specific autocorrelation function (ACF) and continuous probability distribution, e.g with predefined probability density function (PDF).

Usage:

python from generate_corr_sequence import gen_corr_sequence gen_corr_sequence(dist_obj=uniform, target_acf=1 - np.minimum(np.arange(0, 100), 100) / 100, L: int = 2 ** 20, seed=None, debug: bool = False, plot_figures_name: str = None)

Arguments

  • dist_obj - A continuous distribution object from scipy.stats, default is uniform
  • target_acf - A required ACF function, default is a linear function
  • L - Number of required samples
  • seed - Seed of the random number generator
  • debug - Plots PDF and ACF graphs
  • plot_figures_name - Filename of the debug figure to be saved, only when debug is True. In no extension is provided, the default is png.

Returns:

  • A random sequence with pre-defined ACF and distribution with type numpy.ndarray.

Examples

Default settings with uniform distribution and linear ACF

The example below shows the default settings of the function from the examples/default_settings_example.ipynb file.

```python

Example usage of the function with default settings

sequence = gencorrsequence(debug=True) ```

Debug figure

Nakagami distribution with Bessel function ACF

The example below is from the examples/nakagami_example.ipynb file.

```python

Example usage of the function with Nakagami distribution and an autocorrelation function

from generatecorrsequence import gencorrsequence import numpy as np from scipy.stats import nakagami from scipy.special import j0

%%

m = np.arange(0, 100) signal = gencorrsequence( distobj=nakagami(nu=1), targetacf=np.array(j0(0.1 * np.pi * abs(m))), debug=True) ```

Debug figure Autocorrelation function

Notes

  1. There is no responsibility for the correctness of the results. It may work and it may not - use debug option to check the results.
  2. Examples for different distributions (uniform, exponential, Laplace, Rayleigh, triangle, gamma, lognormal, Nakagami) and four different ACFs are provided in the examples/evaluation/ folder. The evaluate_PDFs.ipynb file used for generation of all the ACF figures in the directory.
  3. It takes about 2-3 seconds to generate a single default-length sequence.
  4. The example of code repeatability is provided in the examples/nakagami_example.ipynb notebook as extension of Nakagami distribution example. The sequence is generated 20 times with ACFs as follows.

Autocorrelation function

Installation

Use: pip install generate_corr_sequence

References

The algorithm is mainly based on the following papers:

  1. Filho, José Cândido Silveira Santos, and Michael Daoud Yacoub. "Coloring Non-Gaussian Sequences." IEEE Transactions on Signal Processing, vol. 56, no. 12, 2008, p. 6.
  2. Liu, Bede, et al. "Generation of a Random Sequence Having a Jointly Specified Marginal Distribution and Autocovariance." IEEE Transactions on Acoustics, Speech, and Signal Processing, vol. ASSP-30, no. 6, 1982, p. 11.

Contributors

Dima Bykhovsky, Netanel Tochilovsky, Alexander Rudyak

License

This project is licensed under the MIT license.

Todo

  • custom (non-scipy) distributions support
  • higher-speed algorithm for Gaussian distributions
  • fix lognormal distribution problem for oscillatory ACFs

Owner

  • Name: Dima Bykhovsky
  • Login: bykhov
  • Kind: user

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: Generate stationary correlated time-series
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Dima
    family-names: Bykhovsky
    orcid: 'https://orcid.org/0000-0003-4468-7791'
  - given-names: Netanel
    family-names: Tochilovsky
  - given-names: Alexander
    family-names: Rudyak
    orcid: 'https://orcid.org/0009-0005-0985-3434'
repository-code: 'https://github.com/bykhov/generate_corr_sequence'
abstract: >-
  This Python function creates a time-series (discrete-time
  random process) with a specific autocorrelation function
  (ACF) and continuous probability distribution, e.g with
  predefined probability density function (PDF).
keywords:
  - Python
  - time-series
  - simulation
  - wss
  - autocorrelation
  - random-process
  - autocovariance
license: MIT
preferred-citation:
  type: conference-paper
  authors:
  - family-names: "Bykhovsky"
    given-names: "Dima"
  - family-names: "Tochilovsky"
    given-names: "Netanel"
  - family-names: "Rudyak"
    given-names: "Alexander"
  doi: "10.1109/ICECET58911.2023.10389427"
  journal: "2023 International Conference on Electrical, Computer and Energy Technologies (ICECET)"
  month: 11
  start: 1 # First page number
  end: 6 # Last page number
  title: "Python-Based Simulation of Non-Gaussian Stationary Random Process with Arbitrary Auto-Correlation Function"
  year: 2023

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 13 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 3
pypi.org: generate-corr-sequence

Generate correlated random samples

  • Homepage: https://github.com/bykhov/generate_corr_sequence
  • Documentation: https://generate-corr-sequence.readthedocs.io/
  • License: Copyright (c) 2023 The Python Packaging Authority Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.1.1
    published almost 3 years ago
  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 13 Last month
Rankings
Dependent packages count: 6.6%
Average: 18.7%
Downloads: 18.8%
Dependent repos count: 30.6%
Maintainers (3)
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • matplotlib *
  • numpy *
  • scipy *
  • statsmodels *