简体   繁体   English

用高斯分布相加泊松噪声

[英]Adding Poisson noise with a Gaussian distribution

I managed to add poisson noise to my .fits image, but I need to add noise that is distributed like a gaussian with mean/median (mu_0) of 0 and an increasingly wider distribution (sigma). 我设法将泊松噪声添加到我的.fits图像中,但是我需要添加噪声,该噪声的分布像高斯分布,均值/中位数(mu_0)为0,并且分布越来越大(sigma)。 I couldn't find the syntax governing the adding of noise in this way, so can somebody please walk me through it? 我找不到以这种方式控制噪声添加的语法,所以有人可以帮我逐步解决吗? At the moment, the poisson noise I added is evenly distributed, which isn't what I want; 此刻,我添加的泊松噪声是均匀分布的,这不是我想要的。 I need the gaussian randomness. 我需要高斯随机性。

Here's the relevant bit of code: 这是相关的代码位:

    im = pf.open(name)
    isinstance(im,list)
    im0 = im[0]
    print im0.data.shape
    print np.var(im0.data)
    poissonNoise = np.random.poisson(poisson, im0.data.shape).astype(float)
    test = im0.data + poissonNoise
    print np.var(test)
    im0.data = test
    stringee = 'POISSON'
    pf.writeto(stringee+poisson+name, data=test, clobber=True, header=im0.header)
    check = pf.open(stringee+poisson+name)
    np.var(check[0].data)

For gaussian distributions (normal distributions) use np.random.normal . 对于高斯分布(正态分布),请使用np.random.normal

normalNoise = np.random.normal(center, scale, shape).astype(float)

See more here : NumPy Normal and more generally for all the types: NumPy Random 在此处查看更多: NumPy正常,并且在所有类型中更一般: NumPy随机

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM