代码之家  ›  专栏  ›  技术社区  ›  Artur Müller Romanov

如何封装非周期信号?

  •  0
  • Artur Müller Romanov  · 技术社区  · 7 年前

    我想分析一个trc示波器文件,找到脉冲并封装它们。最后我想画出信封。

    数据文件(trc): https://ufile.io/z4m4d

    代码:

    import matplotlib.pyplot as plt
    import pandas as pd
    import readTrc
    import numpy as np
    from scipy.signal import hilbert
    
    #Read trc file
    datX, datY, m = readTrc.readTrc('C220180104_ch2_UHF00014.trc')
    srx, sry = pd.Series(datX * 1000), pd.Series(datY * 1000)
    df = pd.concat([srx, sry], axis = 1)
    df.set_index(0, inplace = True)
    
    #Impulse location
    x1 = df[1].idxmax() - 0.0005        #numeric used to show area before impulse
    x2 = df[1].idxmax() + 0.003         #numeric used to show area after impulse
    df2 = df.loc[x1:x2]
    
    #Locate Maximum
    print('Maximum at:', round(df[1].idxmax(), 6), 'ms')
    
    #Plot Impulse (abs)
    df3 = df2.abs().interpolate()
    df3.plot.area(grid = 1,
                  linewidth = 0.5)
    
    #Envelope
    signal = hilbert(df2)
    envelope = np.abs(signal)
    df4 = pd.DataFrame(envelope)
    df4.plot(color = 'red')
    
    plt.xlabel('Zeit / ms')
    plt.ylabel('UHF-Signal / mV')
    
    ##plt.savefig('UHF_plot.png', dpi = 600)
    plt.show()
    
    print('done')
    

    输出看起来不像信封。

    情节:

    enter image description here

    信封:

    enter image description here

    编辑:

    这是我想要的近似值。

    enter image description here

    1 回复  |  直到 7 年前
        1
  •  0
  •   Gideon Kogan    7 年前

    包络解调需要在希尔伯特变换之前进行带通。对于你的情况,我相信低通你的“包络信号”将使你达到所需的结果。 还可以使用创建半封套 find_peaks 但我想这不是你的本意。