Açıklama Yok
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

visualize_data.py 957B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env python
  2. import matplotlib.pyplot as plt
  3. import numpy as np
  4. import sys
  5. import math
  6. if len(sys.argv) < 2:
  7. print("Usage:")
  8. print(" " + sys.argv[0] + " filename")
  9. sys.exit(0)
  10. fig, axes = plt.subplots(6, 1, figsize=(5, 15))
  11. data = []
  12. lines_heading = []
  13. with open(sys.argv[1]) as f:
  14. lines = f.readlines()
  15. lines_heading = lines[0].split(',')
  16. lines_data = lines[1:]
  17. for line in lines_data:
  18. nums = line.split(',')
  19. line_data = []
  20. for r in nums:
  21. line_data.append(int(r))
  22. data.append(line_data)
  23. start_time = data[0][0]
  24. for i in range(0, len(data)):
  25. data[i][0] = (data[i][0] - start_time) / 1000.0 / 1000.0
  26. print("samples: " + str(len(data)))
  27. x = [ r[0] for r in data ]
  28. for n in range(3, 9):
  29. y = [ r[n] for r in data ]
  30. im = axes[n - 3].plot(x, y)
  31. axes[n - 3].set_title(lines_heading[n])
  32. plt.suptitle(sys.argv[1], fontsize=18)
  33. plt.tight_layout()
  34. plt.show()