1.数据集介绍
2.代码
import random
import matplotlib
matplotlib.use('Agg')
from scipy.io import loadmat
import numpy as np
def split(DATA):
step = 400;
size = 1024;
data = []
for i in range(1, len(DATA) - size, step):
data1 = DATA[i:i + size]
data.append(data1)
random.shuffle(data)
npy = data[:300]
npy = np.asarray(npy)
return npy
# 读取CWRU数据集
B007 = loadmat('12KHZ_Data/2HP/12k_Drive_End_B007_2_120.mat')['X120_DE_time'].ravel()
B007_npy = split(B007)
np.save('npy/2HP/B007_data.npy', B007_npy)
B014 = loadmat('12KHZ_Data/2HP/12k_Drive_End_B014_2_187.mat')['X187_DE_time'].ravel()
B014_npy = split(B014)
np.save('npy/2HP/B014_data.npy', B014_npy)
B021 = loadmat('12KHZ_Data/2HP/12k_Drive_End_B021_2_224.mat')['X224_DE_time'].ravel()
B021_npy = split(B021