data(PortFosterEvent)
trials <- 10
nimf <- 10
noise.amp <- 6.4e-07
trials.dir <- "test"
set.seed(628)
#Run EEMD (this may take some time)
if (FALSE) EEMD(sig, tt, noise.amp, trials, nimf, trials.dir = trials.dir)
#Compile the results
if (FALSE) EEMD.result <- EEMDCompile(trials.dir, trials, nimf)
#Calculate spectrogram
dt <- 0.1
dfreq <- 0.1
if (FALSE) hgram <- HHRender(EEMD.result, dt, dfreq)
#Plot spectrogram
time.span <- c(4, 10)
freq.span <- c(0, 25)
if (FALSE) HHGramImage(hgram, time.span, freq.span,
pretty = TRUE, img.x.format = "%.1f", img.y.format = "%.0f",
main = "Port Foster event - ensemble Hilbert spectrogram")
#Plot intersections
if (FALSE) HHGramImage(hgram, time.span, freq.span, amp.span = c(1, 5),
clustergram = TRUE, pretty = TRUE, img.x.format = "%.1f", colorbar.format = "%.0f",
img.y.format = "%.0f", main = "Port Foster event - signal stability")
#Decluster
#show only areas with stable signal
#i.e. each pixel has data from at least 3 EEMD trials
if (FALSE) HHGramImage(hgram, time.span = time.span, freq.span = freq.span,
cluster.span = c(, 10), pretty = TRUE, img.x.format = "%.1f",
img.y.format = "%.0f",
main = "Port Foster event - ensemble Hilbert spectrogram")
#Log amplitude plot
if (FALSE) HHGramImage(hgram, time.span = time.span, freq.span = freq.span,
scaling = "log", pretty = TRUE, img.x.format = "%.1f", img.y.format = "%.0f",
main = "Port Foster event - ensemble Hilbert spectrogram with log amplitude")
#Log frequency plot
dfreq <- 0.001
if (FALSE) hgram=HHRender(EEMD.result, dt, dfreq, scaling = "log")
if (FALSE) HHGramImage(hgram, time.span, freq.span = c(0, 2),
pretty = TRUE, img.x.format = "%.1f", img.y.format = "%.2f",
img.y.lab = "log frequency",
main = "Port Foster event - ensemble Hilbert spectrogram with log frequency")
#Only show IMF 1
dfreq <- 0.1
if (FALSE) hgram=HHRender(EEMD.result, dt, dfreq, combine.imfs = FALSE)
if (FALSE) HHGramImage(hgram, time.span, freq.span, imf.list = 1,
pretty = TRUE, img.x.format = "%.1f", img.y.format = "%.0f",
main = "Port Foster event - ensemble Hilbert spectrogram of IMF 1")
Run the code above in your browser using DataLab