Skip to main content

Arbitrarily long streams of power law noise using NumPy and SciPy.

Project description

Warning

This package is no longer maintained. Compatibility with recent versions of Python, NumPy or SciPy cannot be guaranteed.

pyplnoise

Python power law noise generates arbitrarily long streams of power law noise using NumPy and SciPy.

The noise is generated with shaping filters and the methodology closely follows Stephane Plaszczynski, Fluct. Noise Lett. 7: R–R13, 2007. You can also find the article on arXiv:astro-ph/0510081.

pyplnoise consists of a single module providing classes implementing the following noise sources:

  • general 1/fα power law noise with upper and lower frequency limits (class AlphaNoise),
  • a fast red (Brownian) noise generator with a lower frequency limit (class RedNoise),
  • a convenience alias for pink noise (aka 1/f noise; class PinkNoise),
  • and of course white noise (class WhiteNoise).

Quick example

The interface is very simple: just instantiate one of the above classes and run get_sample() to retrieve a single sample or get_series(npts) to retrieve an array of npts samples. Detailed interface documentation is available in the code.

import pyplnoise
import numpy as np

fs = 10. # sampling frequency in Hz

# instantiate a noise source with lower frequency limit 1e-3 Hz,
# upper frequency limit 5 Hz and 1/f^1.5 power spectrum
noisegen = pyplnoise.AlphaNoise(fs, 1e-3, fs/2., alpha=1.5, seed=42)

one_sample = noisegen.get_sample()
many_samples = noisegen.get_series(100000)

Detailed examples

Jupyter notebooks are provided in the /examples directory:

  1. Overview of the noise sources and their properties
  2. Application example: modeling the random signal errors of a gyroscope (Allan variance of synthetic noise)

Installation

Dependencies

  • NumPy ≥ 1.17 (see NEP 19)
  • SciPy ≥ 1.3

Installing from PyPI

pip install pyplnoise

Installing directly from GitHub

Download the release tarball and run

python setup.py install

Because everything is contained in the module pyplnoise, you can alternatively just copy the module and the LICENSE file into your project.

You may find pyplnoise useful, if...

  • ...you're looking to generate 1/fα noise with very long correlation times (frequencies ≪ 10-7 Hz); particularly if your machine has limited memory resources.
  • ...you like to superimpose many colored noise sources, possibly sampled at different frequencies and possessing different bandwidths.

You may not find pyplnoise useful, if...

Project details


Release history Release notifications | RSS feed

This version

1.4

Download files

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

Source Distribution

pyplnoise-1.4.tar.gz (751.0 kB view details)

Uploaded Source

Built Distribution

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

pyplnoise-1.4-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file pyplnoise-1.4.tar.gz.

File metadata

  • Download URL: pyplnoise-1.4.tar.gz
  • Upload date:
  • Size: 751.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for pyplnoise-1.4.tar.gz
Algorithm Hash digest
SHA256 eeaad5f44b8d80e329ec8531dad348e0d66c74fb1653bffd65cf065c0908e9f0
MD5 008b1ddc20a831998fb69eabb05dd3c9
BLAKE2b-256 d1dbb01af04ce8ffdf9f32c3f0875e61c1189d4442f364d20465a782bea58bc5

See more details on using hashes here.

File details

Details for the file pyplnoise-1.4-py3-none-any.whl.

File metadata

  • Download URL: pyplnoise-1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for pyplnoise-1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a9ee2f1b529be4acfcfc7c3dd808fa9d848c7a28984ee8526502944788a53817
MD5 c5b93c3549d02085129b1278853adb7c
BLAKE2b-256 93c90eefa8a79653518a439070ace9ac850556316519969575dd5f036e5c03f0

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