def psfeatureTime(data): # mean value df_mean=data.mean() df_var=data.var()
df_std=data.std() # Root mean square df_rms=np.sqrt(pow(df_mean,2) + pow(df_std,2)) # Peak value
fengfengzhi = max(data)-min(data) # skewness df_skew=pd.Series(data).skew() # kurtosis
df_kurt=pd.Series(data).kurt() sum=0 for i in range(len(data)):
sum+=np.sqrt(abs(data[i])) # Waveform factor df_boxing=df_rms / (abs(data).mean()) # Peak factor
df_fengzhi=(max(data)) / df_rms # Impulse factor df_maichong=(max(data)) /
(abs(data).mean()) # clearance factor df_yudu=max(data)/ pow(sum/(len(data)),2) # Kurtosis
df_qiaodu =(np.sum([x**4 for x in data])/len(data)) / pow(df_rms,4)
featuretime_list =
[round(df_rms,3),round(fengfengzhi,3),round(df_fengzhi,3),round(df_boxing,3),round(df_maichong,3),round(df_yudu,3),round(df_qiaodu,3)]
return featuretime_list if __name__ == '__main__': p1 = psfeatureTime(records1)
p1 def get_rms(records): """ Root mean square value It reflects the effective value rather than the average value """ root_mean = math.sqrt(sum([x
** 2 for x in records]) / len(records)) """ Peak value """ peak_to_peak =
max(records)-min(records) """ Peak index """ crest_factor = max(records)/root_mean
""" Waveform index """ shape_factor = root_mean/abs(sum([x for x in records]) /
len(records)) """ Pulse index """ impulse_factor = max(records)/abs(sum([x for x in
records]) / len(records)) """ clearance factor """ clarance =
max(records)/pow(abs((sum(sqrt([abs(x) for x in records]))/len(records))),2)
""" kurtosis value """ kur = (sum([x**4 for x in records])/len(records))/pow(root_mean,4)
pstf =
[round(root_mean,3),round(peak_to_peak,3),round(crest_factor,3),round(shape_factor,3),round(impulse_factor,3),round(clarance,3),round(kur,3)]
return pstf if __name__ == '__main__': records1 = [1, 2, 3, 4, 5, 6] records2 =
[2, 4, 6] # Root mean square rms1 = get_rms(records1) # 4.08 rms2 = get_rms(records2) # 4.32
rms1

Technology
Daily Recommendation
views 2