deerlab.whitegaussnoise

whitegaussnoise(t, std, rescale=False, seed=None)[source]

Generates a vector of white Gaussian (normal) noise

The noise vector is generated by sampling from a Gaussian distribution with zero mean and standard deviation specified by the user.

Parameters:
tarray_like

Vector of times at which generate noise.

stdfloat scalar

Noise level, i.e. standard deviation of underlying Gaussian distribution.

rescaleboolean, optional

If True, rescales the noise vector such that its standard deviation is exactly equal to std. If False (default), the standard deviation of the noise vector can deviate slightly from std, particularly for short vectors.

seedinteger scalar, optional

If None (default), do not seed the random number generator. If an integer scalar is given (e.g. seed=137), seed the random number generator with this number.

Returns:
noisendarray

Noise vector.

Notes

The noise vector is generated using pseudo-random numbers generated with NumPy. Without seeding the random number generator, subsequent calls of whitegaussnoise return different realizations of the noise vector. To obtain a reproducible noise realization, seed the random number generator by using the seed kewyword arguement, or call numpy.random.seed(k) with some integer number k before calling whitegaussnoise.