[英]Visualization of Standard Deviation in an array
作为python新手,我需要一些帮助。 我有一个包含100行和100列的数组。 每个位置代表一个温度值。 现在,我想计算整个数组的均值(到目前为止,我已经知道了),然后创建一个尺寸与第一个数组相同的新数组,并且每个位置的标准偏差都相同。 最后,我想获得一个数组,每个数组的均值均偏离平均值,因此我想知道每个值与均值的差值。 我希望你明白我的意思吗? 为了更好地理解:该阵列是房屋的红外热像图。 通过标准偏差的计算,我希望获得图像中最佳的反应性/敏感像素。 也许以前有人做过这样的事情。 最后,我要导出文件,以便获得与红外图像相似的图像。 但不是原始温度,而是标准差温度。
导入文件并计算平均值,如下所示:
data_mean = []
my_array = np.genfromtxt((line.replace(',','.') for line in data),skip_header=9,delimiter=";")
data_mean.append(np.nanmean(my_array))
然后,我需要计算数组中每个位置的标准偏差。
提前非常感谢您的帮助!
data_mean = np.mean(my_array) #gets you the mean of the whole array
返回一个数组,其中每个值都是数据的平均值
meanArray = np.ones(my_array.shape)*data_mean
variationFromMean = my_array - meanArray
这是您要找的东西吗?
如果将数据保留为数组格式,则可以采用以下解决方案:
import numpy as np
#Find the mean of the array data values
mean_value = np.mean(data_mean)
#Find the standard deviation of the array data values
standard_deviation = np.std(data_mean)
#create an array consisting of the standard deviations from the mean
array = data_mean/standard_deviation
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.