Skip to content

Instantly share code, notes, and snippets.

@DomiDre
Last active August 8, 2019 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DomiDre/adabee37ddd4846fc27d7da2954bae36 to your computer and use it in GitHub Desktop.
Save DomiDre/adabee37ddd4846fc27d7da2954bae36 to your computer and use it in GitHub Desktop.
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