windeval.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:POWER 作者: pennelise 项目源码 文件源码
def save_total_power(data,times,SCADA_faults,filename):
    total_power = np.array([])
    new_times = np.array([])
    percent_active = np.array([])    
    for time in np.unique(times):
        state_fault = SCADA_faults[times == time]
        fault_mask = [state_fault == 2,state_fault == 1]
        fault_mask = reduce(np.logical_or,fault_mask)

        total_power = np.append(total_power,np.sum(data[times == time]))
        new_times = np.append(new_times,time)
        percent_active = np.append(percent_active,float(np.sum(fault_mask))/float(len(fault_mask)))


    total_dictionary = {}
    total_dictionary['total_power'] = total_power
    total_dictionary['time'] = new_times
    total_dictionary['percent_active'] = percent_active

    file_path = os.path.normpath('%s/FormattedData/%s' % (os.getcwd(),filename))
    np.savez(file_path,**total_dictionary)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号