Python Forum
Value Error when Trying to Plot Filtered Waveforms
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Value Error when Trying to Plot Filtered Waveforms
#2
The error message is pretty clear.
Error:
ValueError: x and y must have same first dimension, but have shapes (7461,) and (7460,)
The line that raises this error is.
plt.plot(t, tr.data)
So it looks like t and tr.data are not the same size. That points to this line being wrong.
t = np.arange(0, tr.stats.npts / tr.stats.sampling_rate, tr.stats.delta)
I would expect this to be:
t = np.arange(0, tr.stats.npts * tr.stats.delta, tr.stats.delta)
Print out the values for tr.stats.delta and tr.stats.sampling_rate. I don't think tr.stats.delta * tr.stats.sampling_rate == 1. The error is in your data, and a bad assumption in your program. Another, less likely possibility is that tr.stats.npts != len(tr.data).
Reply


Messages In This Thread
RE: Value Error when Trying to Plot Filtered Waveforms - by deanhystad - May-09-2024, 05:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to capture live running waveforms in an oscilloscope using python? Girishbabu_27 4 2,081 Jul-29-2023, 06:05 AM
Last Post: Girishbabu_27
  Likert survey data plot error Andrzej_Andrzej 6 3,226 Jul-16-2023, 10:11 PM
Last Post: deanhystad
  Error when animating 3D plot Tee 4 2,226 Jul-03-2023, 08:49 PM
Last Post: Tee
  How to plot intraday data of several days in one plot mistermister 3 3,949 Dec-15-2020, 07:43 PM
Last Post: deanhystad
  Filtered Row Count RookToday 1 13,081 Jul-18-2020, 09:13 PM
Last Post: RookToday
  How to plot vertically stacked plot with same x-axis and SriMekala 0 2,471 Jun-12-2019, 03:31 PM
Last Post: SriMekala
  scatter plot error - possibly data type - TypeError: nan is not a string chudson 1 7,301 Mar-24-2019, 11:48 AM
Last Post: chudson

Forum Jump:

User Panel Messages

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