# How to envelope a non periodic Impulse signal?

I want to analyse a trc oscilloscope file, find impulses and envelope them. In the end I want to plot the envelope.

data file (trc): https://ufile.io/z4m4d

Code: (Python)

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from scipy.signal import hilbert

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')


The Output does not look like an envelope.

Plot:

The hilbert function produces this (it does not look like an envelope):

How would I get something like this:

• Have you tried low-pass filtering the signal? It seems that you have high-frequency components in your signal. These will not magically dissapear because you have used the Hilbert transform. – Ben Dec 3 '18 at 18:41
• The data file is approximately 190MB of a download, in a format (.trc) that requires external (to MATLAB) code to be installed. Would it be possible to provide a little bit more information about your problem (e.g. sampling frequency (?), what is the signal we are looking at? Where is it coming from, what conditions, what experiment?) or simply isolate the vector you are are trying to recover the envelope from and provide a link to THAT download only please? – A_A Dec 4 '18 at 10:16