Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A quick generation of a Gaussian data with small noise
import numpy as np
x = np.linspace(0, 10, 51)
A = 42
mu = 4.2
sigma = 0.666
c = 10
sig_y = 3*np.ones(len(x)) #np.sqrt(y)
y = np.round(
np.random.normal(A * np.exp(-0.5*((x-mu)/sigma)**2) + c, sig_y)
)
np.savetxt('gaussianData.xye', np.c_[x, y, sig_y],
header='x\ty\tsy',
delimiter='\t',
fmt='%10.5f'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.