Python Forum
Defining x and y axes in Spectrogram Function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Defining x and y axes in Spectrogram Function
#1
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:


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.
Reply


Messages In This Thread
Defining x and y axes in Spectrogram Function - by amy5678 - Nov-28-2020, 01:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I set the figure title and axes labels font size in Matplotlib? anouar2002 1 1,730 Nov-03-2020, 05:31 PM
Last Post: ndc85430
  Plotting axes help StillAnotherDave 11 3,867 Jan-24-2020, 04:29 PM
Last Post: StillAnotherDave
  defining a function to see if a list is sorted Siylo 14 7,353 Nov-29-2018, 05:25 PM
Last Post: wavic
  python 3.4.3 Question a defining function student8 1 4,410 Oct-02-2017, 07:59 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020