Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.
/ pyplnoise Public archive

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

License

Notifications You must be signed in to change notification settings

janwaldmann/pyplnoise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages