def psfeatureTime(data): #均值 df_mean=data.mean() df_var=data.var()
df_std=data.std() #均方根 df_rms=np.sqrt(pow(df_mean,2) + pow(df_std,2)) #峰峰值
fengfengzhi = max(data)-min(data) #偏度 df_skew=pd.Series(data).skew() #峰度
df_kurt=pd.Series(data).kurt() sum=0 for i in range(len(data)):
sum+=np.sqrt(abs(data[i])) #波形因子 df_boxing=df_rms / (abs(data).mean()) #峰值因子
df_fengzhi=(max(data)) / df_rms #脉冲因子 df_maichong=(max(data)) /
(abs(data).mean()) #裕度因子 df_yudu=max(data)/ pow(sum/(len(data)),2) #峭度
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 = math.sqrt(sum([x
** 2 for x in records]) / len(records)) """峰峰值""" peak_to_peak =
max(records)-min(records) """峰值指标""" crest_factor = max(records)/root_mean
"""波形指标""" shape_factor = root_mean/abs(sum([x for x in records]) /
len(records)) """脉冲指标""" impulse_factor = max(records)/abs(sum([x for x in
records]) / len(records)) """裕度指标""" clarance =
max(records)/pow(abs((sum(sqrt([abs(x) for x in records]))/len(records))),2)
"""峭度指标""" 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] # 均方根 rms1 = get_rms(records1) # 4.08 rms2 = get_rms(records2) # 4.32
rms1
 

技术
©2019-2020 Toolsou All rights reserved,
一个名叫“讨火车”的小村子 终于把火车讨来了运营商 网站访客手机号码抓取hive压缩&&hdfs合并小文件精准手机号抓取,运营商大数据函数基本定义和使用‘未完待续Spring Boot教程十六:SpringBoot注入类实现多线程基于神经网络的车辆牌照字符识别技术MyBatis 新增数据 成功 返回 自增主键ID值json反斜杠问题接错水管喝了三年软水?软水和软水机究竟有何用