def _add_noise(v, amplitude):
"""Add noise to an array v in the following way:.
noisy_v = (1+h) * v
where h is a random noise with specified standard deviation. The noise h is trimmed to
be zero close to both boundaries.
Inputs:
v input to add noise to (array)
ampltitude specified standard deviation of noise (scalar)
tac autocorrelation time measured in discrete samples (scalar)
Outputs:
noisy_v v with noise
"""
# generate noise that is constant throughout space
h = np.random.normal(scale=amplitude) * np.ones_like(v)
# damped the sides of the noise close to the boundaries
h = dampen_sides(h)
noisy_v = (1 + h) * v
return noisy_v
评论列表
文章目录