简体   繁体   中英

Visualization of Standard Deviation in an array

As a python newbie I need a little help. I have an array with 100 rows and 100 columns. Each position stands for a temperature value. I now want to calculate the mean of the whole array (I have that so far) and then create a new array with the same dimension like the first one and with the standrard deviation at each positions. At the end I want to get an array with the deviation from the mean at each postion, so I want to know, how far each value spreads from the mean. I hope you understand what I mean? For better understanding: the array is an infrared thermography image of a house. With the calulation of standard deviation I want to get the best reactive/sensitive pixels in the image. Maybe someone has done something like this before. In the end I want to export the file, so that I get an image that is similar looking to the infrared image. But not with the raw temperatures but the standard deviation temperatures.

Importing the file and calculating the mean like this:

data_mean = []

my_array = np.genfromtxt((line.replace(',','.') for line in data),skip_header=9,delimiter=";")

data_mean.append(np.nanmean(my_array))

Then I need calculation the standard deviation of each position in the array.

Thank you so much in advance for any help!

data_mean = np.mean(my_array) #gets you the mean of the whole array

return an array where every value is the mean of your data

meanArray = np.ones(my_array.shape)*data_mean 

variationFromMean = my_array - meanArray

Is this what you were looking for?

If you are keeping the data in an array format here is a solution:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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