简体   繁体   English

给定均值和标准差,生成高斯核

[英]Generate a Gaussian kernel given mean and standard deviation

This question here addresses how to generate a Gaussian kernel using numpy. 这里的问题解决了如何使用numpy生成高斯内核。 However I do not understand what the inputs used kernlen and nsig are and how they relate to the mean/standard deviation usually used to describe a Gaussian distribtion. 但是,我不了解kernlennsig所使用的输入是什么,以及它们与通常用于描述高斯分布的均值/标准差之间的关系。

How would I generate a 2d Gaussian kernel described by, say mean = (8, 10) and sigma = 3 ? 我将如何生成以mean = (8, 10)sigma = 3描述的2d高斯核? The ideal output would be a 2-dimensional array representing the Gaussian distribution. 理想的输出将是代表高斯分布的二维数组。

You could use astropy , especially the Gaussian2D model from the astropy.modeling.models module: 您可以使用astropy ,尤其是来自astropy.modeling.models模块的Gaussian2D模型:

from astropy.modeling.models import Gaussian2D

g2d = Gaussian2D(x_mean=8, y_mean=10, x_stddev=3, y_stddev=3)  # specify properties

g2d(*np.mgrid[0:100, 0:100])  # specify the grid for the array

在此处输入图片说明

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

相关问题 给定均值和标准差,生成二维正态分布 - Generate two-dimensional normal distribution given a mean and standard deviation 给定均值和标准差,如何按照高斯分布构成二维特征? - how to make up a 2D feature following a Gaussian distribution, given the mean and standard deviation? 如何生成平均值为50,标准差为5的2D高斯 - How do I generate a 2D Gaussian with a mean 50 and standard deviation of 5 计算高斯的标准差 - Calculate the standard deviation of a gaussian 带有标准偏差的随机高斯 - Random Gaussian with standard deviation 生成具有精确均值和标准差的样本数据 - Generate sample data with an exact Mean and Standard Deviation 如何从给定的计数、平均值、标准差、最小值、最大值等生成数据集? - How to generate dataset from given count, mean, standard deviation, min, max etc? Python:如何生成具有给定标准差且均值在 0-1 内的正数? - Python : How to Generate positive number with a given standard deviation and mean within 0-1? 给定均值和标准差,根据几何分布和二项分布生成随机数 - Given a mean and standard deviation generate random numbers based on a geometric distribution and binomial distribution 给定分布的名称和参数,求出均值和标准差 - Finding the mean and standard deviation of a distribution given its name and parameters
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM