0
$\begingroup$

I want to get the Marginal Hilbert Spectrum in Python using the emd package.

You can estimate the Marginal Hilbert Spectrum as

enter image description here

where, enter image description here

and A(ω,t) is the time-dependent amplitude modulation and ω the time-dependent instantaneous frequency.

The code I am using:

### create a random array of 3600 dates for MRE ###
np.random.seed(0)
rng = pd.date_range('2015-02-24', periods=3600, freq='s')
df  = pd.DataFrame({ 'DateTime': rng, 'B': np.random.randn(len(rng)) }) 
df  = df.set_index('DateTime')

### Get the IMF's ###

dt     = (df.index[1]-df.index[0])/np.timedelta64(1,'s')   #
T      = 3600
start1 = 0

### By doing this you get the IMF's ###
imf = emd.sift.sift(df.B.values, max_imfs=50)

## This gives you the 1) instantaneous phase IP
##                    2) instantaneous frecuency IP
##                    3) instantaneous amplitude
IP, IF, IA = emd.spectra.frequency_transform(imf, dt, 'nht')



H = IA**2

spec = [ ]
for i in range(len(IF)):
    spec.append((1/T)*np.nansum(H[i][:])*dt)
    

plt.plot(np.sort(IF[:, 0]),spec)

The result I am getting is totaly wrong, any help?

The paper I am reading to understand the Hilbert-Huang transform is this one:

https://www.mdpi.com/2218-1997/6/8/116/htm

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.