Getting Frequency Information from Q-transform plot


I am trying to get the frequency information from a q-transform plot shown below.

I am using the following code snippet to get that information, but I see that the following code prints the frequency values for the complete q-transform plot.

hq = strain.q_transform(outseg=(t0-dt, t0+dt))
freq = hq.frequencies

What I want is only the frequency values that are associated with the classic hockey stick pattern(places where normalized energy is greater than ~80) waveform in the q-transform plot.

Thanks for the help.

Hi @anshul21

Thank you for the question! You could try something like this:

import numpy as np
loud = np.where(hq>80)
loud_freq = hq.yindex[loud[1]]

For me, that gave an output that looked like this:

[ 73.25395  73.75395  74.25395 ... 217.75395 218.25395 218.75395] Hz

with the array of frequencies stored in loud_freq.

1 Like

Hi @jonah

Thank you for the reply.