It uses numpy and scipy, so please import it first.
import
import numpy as np
import scipy.stats
max,min
#Maximum value
np.max(data)
#minimum value
np.min(data)
median
#Median
np.median(data)
When the variance and standard deviation are calculated using Numpy, the unbiased variance and unbiased standard deviation are returned by default.
mean,var,std
#average
np.mean(data)
#Distributed
np.var(data)
#standard deviation
np.std(data)
skew,kurt
#skewness
scipy.stats.skew(data)
#kurtosis
scipy.stats.kurtosis(data)
rms
#Root mean square
np.sqrt(np.square(data).mean())
ent
# FFT
fft_data = np.fft.fft(data)
#Power spectrum
power_data = abs(fft_data)**2
#Power spectrum ratio
p = power_data / sum(power_data)
#Frequency domain entropy
ent(data)
def ent(data):
ent = 0
for i in range(data_size):
ent += data[i]*np.log2(data[i])
return -ent
Recommended Posts