Exemple #1
0
 def eemd_decompose(a, t):
     eemd = EEMD(trials=200, noise_width=0.4)(a)
     eimfs, res = eemd[:-1], eemd[-1]  #这的参数有问题!!!!!!!!!!!!!!!!!!!!!
     vis = Visualisation()
     vis.plot_imfs(imfs=eimfs, residue=res, t=t, include_residue=True)
     vis.plot_instant_freq(t, imfs=eimfs)  #
     vis.show()
     return eimfs, res
Exemple #2
0
def Inst_freq(peeled_seq, fs=4000):
    t = np.arange(0, 1, 1 / fs)
    # print(len(t))
    emd = EMD()
    emd.emd(peeled_seq)
    imfs, res = emd.get_imfs_and_residue()
    vis = Visualisation(emd)
    imfs_inst_freqs = vis._calc_inst_freq(imfs, t, order=False, alpha=None)
    return imfs_inst_freqs
Exemple #3
0
 def emd_decompose(a, t):
     emd = EMD()
     emd.emd(a)
     imfs, res = emd.get_imfs_and_residue()
     plt.plot(t, a)
     plt.title('origin sequence')
     vis = Visualisation(emd)
     vis.plot_imfs(t=t)
     vis.plot_instant_freq(t)
     vis.show()
     plt.show()
     return imfs, res
Exemple #4
0
def Visualing(peeled_seq, fs=4000):
    t = np.arange(0, 1, 1 / fs)
    # print(len(t))
    emd = EMD()
    emd.emd(peeled_seq)
    imfs, res = emd.get_imfs_and_residue()
    vis = Visualisation(emd)
    # Create a plot with all IMFs and residue
    vis.plot_imfs(imfs=imfs, residue=res, t=t, include_residue=True)
    # Create a plot with instantaneous frequency of all IMFs
    vis.plot_instant_freq(t, imfs=imfs)
    # Show both plots
    vis.show()
Exemple #5
0
def hes2(args):
    n = 10000
    t = np.arange(0, n/args.fs, 1/args.fs)
    S = args.singled_out[-1, 0:n]
    args.temp_add = 'emd_raw'
    show_signal(S, args)
    emd = EMD()
    emd.emd(S)
    imfs, res = emd.get_imfs_and_residue()

    # In general:
    # components = EEMD()(S)
    # imfs, res = components[:-1], components[-1]

    vis = Visualisation()
    vis.plot_imfs(imfs=imfs, residue=res, t=t, include_residue=True)
    vis.plot_instant_freq(t, imfs=imfs)

    vis.show()
    return 0
Exemple #6
0
def get_IMFset(data):

    print("start ensemble decompose")

    imfs_set = []
    ceemdan = CEEMDAN()

    for decon_time in range(data.shape[0]):

        series = np.reshape(data[decon_time], (data.shape[1], ))
        imfs = ceemdan(series)
        imf, res = imfs[:-1], imfs[-1]
        imfs_set.append(imfs)

        print("processing No.", decon_time, "series")

    vis = Visualisation()
    vis.plot_imfs(imfs=imf, residue=res, include_residue=True)
    vis.show()

    return imfs_set
Exemple #7
0
imfs, res = emd.get_imfs_and_residue()

fig = plt.figure(figsize=(12, 16))
ax_main = fig.add_subplot(len(imfs) + 1, 1, 1)
ax_main.set_title(title)
ax_main.plot(t, d)

rec_b = []
for i in imfs:
    rec_b.append(d - i)
    d -= i

for i, y in enumerate(rec_b):
    ax = fig.add_subplot(len(rec_b) + 1, 2, 3 + i * 2)
    ax.plot(t, y, 'r')

    ax.set_ylabel("A%d" % (i + 1))

for i, y in enumerate(imfs):
    ax = fig.add_subplot(len(imfs) + 1, 2, 4 + i * 2)
    ax.plot(t, y, 'g')
    ax.set_ylabel("D%d" % (i + 1))

# In general:
#components = EEMD()(S)
#imfs, res = components[:-1], components[-1]

vis = Visualisation()
vis.plot_imfs(imfs=imfs, residue=res, t=t, include_residue=True)
vis.plot_instant_freq(f, imfs=imfs)
vis.show()
Exemple #8
0
 def __init__(self, damage):
     self.damage = damage
     self.signals = self.extract_signals()
     self.vis = Visualisation()