So when applying wavelet transform, we get a 2d plot. Each point in that 2d plot has a color, showing intensity of something. But I cannot understand if it is an amplitude or power?


A standard continuous wavelet transformation (the one that produce a 2D scale/shift map) is a linear operator. It produces real or complex coefficients that are related to the amplitude on "how a given wavelet at specific shift and scale matches the signal". These coefficients are (most generally) homogeneous with the signal's amplitude.

This being said, depending on the application, it is interesting to display complex or positive/negative wavelet coefficients as images. Thus, they are modified, using

  • absolute values,
  • squared norms (energy),
  • logarithmic transformations (and other shrinkage-type functions, like thresholded power-laws),
  • or more complicated "colormaps" (which are many, often field dependent),

that turn values into colors, to better exhibit subtle details and trends.


How does that make a difference? Intensity and Power are linked by a strictly monotonous function (the very complicated p(i)=i²); since colors aren't "linear" by any means, the only difference between plotting the power and the amplitude would be a relabeling of the color bar.

In fact, that's why we often use decibel, so that the scale is identical in power and amplitude.

Now, we don't know your plotting tool; as a general rule, in image processing I'd say intensity is more of an amplitude thing, whereas in physics it's more of a power thing, but if you want to be sure, simply feed in an array that is filled with value 0.1 on one half, and 0.2 on the other. That would instantly answer your question with 100% certainty.

  • $\begingroup$ Color mapping is linear with respect to the color mapping; a simple change of min and max will not remap amplitude to power. The distinction is relevant in time-frequency analysis. $\endgroup$ Jul 16 at 10:00
  • $\begingroup$ @OverLordGoldDragon I've seen dozens of different color schemes, and I'm not even sure how you can assign a number to a color. How could all color mappings (we don't know which Kadaj13 is using) be linear – in what color space? what Color mapping? A lot of research goes into color schemes, and my takeaway is "linear is never appropriate, because neither is human brightness perception in any way linear, nor is our interpretation of composite colors in any way linear": I really contest that notion that "color is linear to value". $\endgroup$ Jul 16 at 10:12
  • $\begingroup$ This question isn't about nuances of color mappings. Every value maps to one color (in some color maps, including one I used), and this mapping is transformed non-linearly when going from amplitude to power, thus a change of interpretation is due. Your answer misleads to this end and ignores the actual question, which is about wavelet transforms. $\endgroup$ Jul 16 at 10:19
  • $\begingroup$ The original question literally is "But I cannot understand if it is an amplitude or power?", not about the wavelet transform. $\endgroup$ Jul 16 at 10:33
  • $\begingroup$ "when applying the wavelet transform" isn't about wavelet transform? An amplitude plot would preserve higher frequency audio (and especially) EEG tones that would otherwise visibly vanish in a power plot under inverse power law scaling. The L2 wavelet norm further attenuates higher frequencies. Your answer claims indifference to these critical factors. $\endgroup$ Jul 16 at 10:36

Its absolute value is amplitude. Squared is power. But if it's a plot you've come across, it's not possible to tell without units, as it could be log-transformed (decibels), which nullifies the distinction between amplitude and power (amp: $\log(x)$ -- pow: $\log(x^2) = 2 \log(x)$, all intensities double and colors don't change if autoscaled). However, for interpreting wavelet coefficients, untransformed gives the most accurate representation and should be preferred when learning / debugging; transforms are useful as post-processing steps in applied settings.

I recommend this tutorial. Interactive learning is also fun; tinker with x below and see how it affects CWT.

import numpy as np
from ssqueezepy import cwt, Wavelet, TestSignals
from ssqueezepy.visuals import plot, imshow

# configure
N = 4096
ts = TestSignals(N=N)
tmin, tmax, f = 0, 1, 64
fs = N / (tmax - tmin)

# generate signal
x = ts.make_signals(('am-cosine', dict(f=f, tmin=tmin, tmax=tmax)))
t = np.linspace(tmin, tmax, N, 0)  # ^ corresponds to TestSignals
# simpler:
# x = np.cos(2*np.pi * f * t)

# take CWT
wavelet = Wavelet(('morlet', {'mu': 5}))
Wx, scales = cwt(x, wavelet)

# find (peak) center frequencies as fraction of sampling rate (N)
psih = np.abs(wavelet.Psih())
freqs = np.round(np.array([np.argmax(p) for p in psih])/2).astype(int) * (fs / N)

# plot
plot(x, title="signal", xticks=t, xlabel="time [sec]", show=1)
kw = dict(abs=1, xlabel="time [sec]", ylabel="frequencies [Hz]",
          xticks=t, yticks=freqs)
imshow(Wx, title="abs(CWT)", **kw)
imshow(np.abs(Wx)**2, title="abs(CWT)^2", **kw)

print("Try these for `signal` like `x = ts.make_signals(signal)` "
      "(or feed your own):\n%s" % '\n'.join(ts.SUPPORTED))
  • $\begingroup$ .. in your current color scheme, using your plotting tools. $\endgroup$ Jul 16 at 10:13
  • 1
    $\begingroup$ i didn't think this was worthy of a downvote (which i neutralized). $\endgroup$ Jul 20 at 1:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.