As part of my Astronomy Homework, I've to produce a Time vs Frequency Spectrogram of some data. The data I have is 2 columns - the first of which is the time (seconds) and the second column is the gravitational wave strain. I also have a single value for the Frequency. This is the example code I have been provided with:
If someone could guide me in the right direction I'd greatly appreciate it.
from scipy.signal import spectrogram spec_f, spec_t, spec = spectrogram(ht, fs) plt.pcolormesh(spec_t, spec_f, spec, shading='gouraud') plt.ylabel('Frequency [Hz]') plt.xlabel('Time [sec]') plt.show()No matter what I have done, I can't seem to get it to work - I mainly get that 'ht' is not defined. I have tried to define it but I'm not sure what the proper syntax would be for it. (ht is the timeseries and fs is the sampling Frequency).
If someone could guide me in the right direction I'd greatly appreciate it.