def kernel_gaussian(size=<NUM_LIT:100>, sigma=None, forwardOnly=False):
if sigma is None:<EOL><INDENT>sigma=size/<NUM_LIT:10><EOL><DEDENT>size=int(size)<EOL>points=np.exp(-np.power(np.arange(size)-size/<NUM_LIT:2>,<NUM_LIT:2>)/(<NUM_LIT:2>*np.power(sigma,<NUM_LIT:2>)))<EOL>if forwardOnly:<EOL><INDENT>points[:int(len(points)/<NUM_LIT:2>)]=<NUM_LIT:0><EOL><DEDENT>return points/sum(points)<EOL>
return a 1d gassuan array of a given size and sigma.
If sigma isn't given, it will be 1/10 of the size, which is usually good.
Note that this is fully numpy, and doesn't use scipy.