Barak 0.3.2 documentation

barak.utilities.addnoise

«  barak.utilities.Gaussian   ::   Contents   ::   barak.utilities.autocorr  »

barak.utilities.addnoise

barak.utilities.addnoise(nflux, nsigma, minsig=None, seed=None)[source]

Add noise to a normalised flux array.

Either gaussian, or a combination of poisson and gaussian noise is added to the flux array, depending on the keyword minsig.

Parameters :

nflux : array of floats, shape (N,)

Array of normalised flux values.

nsigma : float

Total desired noise at the continuum (flux=1). Note the signal-to-noise ratio (SNR) = 1 / nsigma.

minsig : float, optional

By default minsig is None, which means gaussian noise with standard deviation nsigma is added to the flux. If minsig is given, a combination of poisson and gaussian noise is added to the flux to give an error of sigma at the continuum. In this case the gaussian noise component has st. dev. of minsig, which must be less than nsigma.

seed : int, optional

If seed is given, it is used to seed the random number generator. By default the seed is not reset.

Returns :

flux, error : arrays of floats, shape (N,)

Normalised flux with noise added, one sigma error array.

«  barak.utilities.Gaussian   ::   Contents   ::   barak.utilities.autocorr  »