generate-corr-sequence


Namegenerate-corr-sequence JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryGenerate correlated random samples
upload_time2023-04-28 08:26:51
maintainer
docs_urlNone
authorDima Bykhovsky, Netanel Tochilovsky, Alexander Rudyak
requires_python>=3.7
licenseCopyright (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.
keywords autocorrelation distribution random process random variable simulation stationary time series
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            

<!--
![image](./logo/ourLogo.svg)

![image](https://img.shields.io/badge/Creators-D.%20Bykhovsky%2C%20A.%20Rudyak%2C%20N.%20Tochilvosky-blue?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDkxIiBoZWlnaHQ9IjQ5MSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgb3ZlcmZsb3c9ImhpZGRlbiI+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMCI+P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1pdGVybGltaXQ9IjgiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGQ9Ik01NyAyNzkuMjcxQzk3Ljg5MTYgMjkxLjkyNiAxMzguNzgzIDMwNC41ODEgMTcwLjEgMjc5Ljg2OSAyMDEuNDE3IDI1NS4xNTcgMjE5Ljg2OCAxMzEgMjQ0LjkwMiAxMzEgMjY5LjkzNSAxMzEgMjg4Ljc4NSAyNTQuODU4IDMyMC4zMDIgMjc5Ljg2OSAzNTEuODE4IDMwNC44OCA0MzQgMjgxLjA2NSA0MzQgMjgxLjA2NSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjcuOTk0NTciIHN0cm9rZS1taXRlcmxpbWl0PSI4IiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L2c+PC9zdmc+){.align-center}](https://pypi.org/project/generate-corr-sequence/)

[![image](https://img.shields.io/badge/License-MIT-lightgreen?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDkxIiBoZWlnaHQ9IjQ5MSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgb3ZlcmZsb3c9ImhpZGRlbiI+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMCI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjQ5MSIgaGVpZ2h0PSI0OTEiLz48L2NsaXBQYXRoPjwvZGVmcz48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDApIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNDkxIiBoZWlnaHQ9IjQ5MSIgZmlsbD0iI0ZGRkZGRiIgZmlsbC1vcGFjaXR5PSIwIi8+PHBhdGggZD0iTTU3LjUgMjQ2QzU3LjUgMTQxLjg5NCAxNDEuODk0IDU3LjUgMjQ2IDU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ODEgMTcwLjEgMjc5Ljg2OSAyMDEuNDE3IDI1NS4xNTcgMjE5Ljg2OCAxMzEgMjQ0LjkwMiAxMzEgMjY5LjkzNSAxMzEgMjg4Ljc4NSAyNTQuODU4IDMyMC4zMDIgMjc5Ljg2OSAzNTEuODE4IDMwNC44OCA0MzQgMjgxLjA2NSA0MzQgMjgxLjA2NSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjcuOTk0NTciIHN0cm9rZS1taXRlcmxpbWl0PSI4IiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L2c+PC9zdmc+){.align-center}](LICENSE.txt)
-->

# 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](https://docs.scipy.org/doc/scipy/reference/stats.html),
  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 = generate_corr_sequence(debug=True)
```

### 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 generate_corr_sequence import gen_corr_sequence
import numpy as np
from scipy.stats import nakagami
from scipy.special import j0
# %%
m = np.arange(0, 100)
signal = gen_corr_sequence(
    dist_obj=nakagami(nu=1),
    target_acf=np.array(j0(0.1 * np.pi * abs(m))),
    debug=True)
```


## 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.

## 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](https://github.com/bykhov), [Netanel Tochilovsky](https://github.com/Nati-Toch), [Alexander Rudyak](https://github.com/AlexRudyak)

## License

This project is licensed under the [MIT](./LICENSE.md) license.

## Todo

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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "generate-corr-sequence",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "autocorrelation,distribution,random process,random variable,simulation,stationary,time series",
    "author": "Dima Bykhovsky, Netanel Tochilovsky, Alexander Rudyak",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/62/56/fc8764746a6362d7f221d963fc55403ed2c2456d55d42a88a0ff7ca43bb7/generate_corr_sequence-0.1.1.tar.gz",
    "platform": null,
    "description": "\n\n<!--\n![image](./logo/ourLogo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gMjg5LjkwOCA5Mi4zOTc2IDI2OC4xOTYgMTA0LjIwNCAyNDMuOTE0IDExNi4wMTEgMjE5LjYzMSAxMTQuNjY2IDEyNS43MDMgMTMxLjM0MSAxMzEuNzgyIDE0OC4wMTUgMTM3Ljg2MSAxNTUuNTIzIDI1NS43MTkgMjA0LjI1MiAyODAuMzg5IDI1Mi45ODIgMzA1LjA2IDM0My43NDEgMjkyLjQzMyA0MzQuNSAyNzkuODA2IiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMi45OTc5NiIgc3Ryb2tlLW1pdGVybGltaXQ9IjgiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGQ9Ik01NyAyNzkuMjcxQzk3Ljg5MTYgMjkxLjkyNiAxMzguNzgzIDMwNC41ODEgMTcwLjEgMjc5Ljg2OSAyMDEuNDE3IDI1NS4xNTcgMjE5Ljg2OCAxMzEgMjQ0LjkwMiAxMzEgMjY5LjkzNSAxMzEgMjg4Ljc4NSAyNTQuODU4IDMyMC4zMDIgMjc5Ljg2OSAzNTEuODE4IDMwNC44OCA0MzQgMjgxLjA2NSA0MzQgMjgxLjA2NSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjcuOTk0NTciIHN0cm9rZS1taXRlcmxpbWl0PSI4IiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L2c+PC9zdmc+){.align-center}](https://pypi.org/project/generate-corr-sequence/)\n\n[![image](https://img.shields.io/badge/License-MIT-lightgreen?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDkxIiBoZWlnaHQ9IjQ5MSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgb3ZlcmZsb3c9ImhpZGRlbiI+PGRlZnM+PGNsaXBQYXRo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gMTM3Ljg2MSAxNTUuNTIzIDI1NS43MTkgMjA0LjI1MiAyODAuMzg5IDI1Mi45ODIgMzA1LjA2IDM0My43NDEgMjkyLjQzMyA0MzQuNSAyNzkuODA2IiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMi45OTc5NiIgc3Ryb2tlLW1pdGVybGltaXQ9IjgiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGQ9Ik01NyAyNzkuMjcxQzk3Ljg5MTYgMjkxLjkyNiAxMzguNzgzIDMwNC41ODEgMTcwLjEgMjc5Ljg2OSAyMDEuNDE3IDI1NS4xNTcgMjE5Ljg2OCAxMzEgMjQ0LjkwMiAxMzEgMjY5LjkzNSAxMzEgMjg4Ljc4NSAyNTQuODU4IDMyMC4zMDIgMjc5Ljg2OSAzNTEuODE4IDMwNC44OCA0MzQgMjgxLjA2NSA0MzQgMjgxLjA2NSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjcuOTk0NTciIHN0cm9rZS1taXRlcmxpbWl0PSI4IiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L2c+PC9zdmc+){.align-center}](LICENSE.txt)\n-->\n\n# Generate stationary correlated time-series\n\n## Summary\n\nThis Python function creates a time-series (discrete-time random process) with a specific\nautocorrelation function (ACF) and continuous probability distribution, e.g with predefined probability density function (PDF).\n\nUsage:\n\n```python\nfrom generate_corr_sequence import gen_corr_sequence\ngen_corr_sequence(dist_obj=uniform,\n                  target_acf=1 - np.minimum(np.arange(0, 100), 100) / 100,\n                  L: int = 2 ** 20,\n                  seed=None,\n                  debug: bool = False,\n                  plot_figures_name: str = None)\n```\n\n### Arguments\n\n- `dist_obj` - A continuous distribution object from\n  [scipy.stats](https://docs.scipy.org/doc/scipy/reference/stats.html),\n  default is `uniform`\n- `target_acf` - A required ACF function, default is a linear function\n- `L` - Number of required samples\n- `seed` - Seed of the random number generator\n- `debug` - Plots PDF and ACF graphs\n- `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`.\n\nReturns:\n\n- A random sequence with pre-defined ACF and distribution with type `numpy.ndarray`.\n\n## Examples\n\n### Default settings with uniform distribution and linear ACF\n\nThe example below shows the default settings of the function from the `examples/default_settings_example.ipynb` file.\n\n```python\n# Example usage of the function with default settings\nsequence = generate_corr_sequence(debug=True)\n```\n\n### Nakagami distribution with Bessel function ACF\n\nThe example below is from the `examples/nakagami_example.ipynb` file.\n\n```python\n# Example usage of the function with Nakagami distribution and an autocorrelation function\nfrom generate_corr_sequence import gen_corr_sequence\nimport numpy as np\nfrom scipy.stats import nakagami\nfrom scipy.special import j0\n# %%\nm = np.arange(0, 100)\nsignal = gen_corr_sequence(\n    dist_obj=nakagami(nu=1),\n    target_acf=np.array(j0(0.1 * np.pi * abs(m))),\n    debug=True)\n```\n\n\n## Notes\n\n1. There is no responsibility for the correctness of the results. It may work and it may not - use debug option to check the results.\n2. Examples for different distributions (uniform, exponential, Laplace, Rayleigh, triangle,\n   gamma, lognormal, Nakagami) and four different ACFs are provided in the `examples/evaluation/` folder.\n   The `evaluate_PDFs.ipynb` file used for generation of all the ACF figures in the directory.\n3. It takes about 2-3 seconds to generate a single default-length sequence.\n4. 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.\n\n## References\n\nThe algorithm is mainly based on the following papers:\n\n1. Filho, Jos\u00e9 C\u00e2ndido Silveira Santos, and Michael Daoud Yacoub.\n   \"Coloring Non-Gaussian Sequences.\" IEEE Transactions on Signal\n   Processing, vol. 56, no. 12, 2008, p. 6.\n2. Liu, Bede, et al. \"Generation of a Random Sequence Having a\n   Jointly Specified Marginal Distribution and Autocovariance.\" IEEE\n   Transactions on Acoustics, Speech, and Signal Processing, vol. ASSP-30,\n   no. 6, 1982, p. 11.\n\n## Contributors\n\n[Dima Bykhovsky](https://github.com/bykhov), [Netanel Tochilovsky](https://github.com/Nati-Toch), [Alexander Rudyak](https://github.com/AlexRudyak)\n\n## License\n\nThis project is licensed under the [MIT](./LICENSE.md) license.\n\n## Todo\n\n- custom (non-scipy) distributions support\n- higher-speed algorithm for Gaussian distributions\n- fix lognormal distribution problem for oscillatory ACFs\n",
    "bugtrack_url": null,
    "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.",
    "summary": "Generate correlated random samples",
    "version": "0.1.1",
    "split_keywords": [
        "autocorrelation",
        "distribution",
        "random process",
        "random variable",
        "simulation",
        "stationary",
        "time series"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b12acfdc00810a2a4fcc3e9219a3afa8a0a0c69bfae0870714a5ec5c313d8fef",
                "md5": "4764f8bc06c59f27ddc9a71402c43199",
                "sha256": "84fefeda13e2e5311e77e1d579fd4630193e384defd218b07eb653e1f3ce9847"
            },
            "downloads": -1,
            "filename": "generate_corr_sequence-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4764f8bc06c59f27ddc9a71402c43199",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9514,
            "upload_time": "2023-04-28T08:26:48",
            "upload_time_iso_8601": "2023-04-28T08:26:48.697993Z",
            "url": "https://files.pythonhosted.org/packages/b1/2a/cfdc00810a2a4fcc3e9219a3afa8a0a0c69bfae0870714a5ec5c313d8fef/generate_corr_sequence-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6256fc8764746a6362d7f221d963fc55403ed2c2456d55d42a88a0ff7ca43bb7",
                "md5": "8dca8c280859b50244613689fbb03012",
                "sha256": "c66a8701c55e69ce04974f13baa4dec89f04745ccf00af8841de3958d09daab6"
            },
            "downloads": -1,
            "filename": "generate_corr_sequence-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8dca8c280859b50244613689fbb03012",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 9963,
            "upload_time": "2023-04-28T08:26:51",
            "upload_time_iso_8601": "2023-04-28T08:26:51.601432Z",
            "url": "https://files.pythonhosted.org/packages/62/56/fc8764746a6362d7f221d963fc55403ed2c2456d55d42a88a0ff7ca43bb7/generate_corr_sequence-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-28 08:26:51",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "generate-corr-sequence"
}
        
Elapsed time: 0.67483s