Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

visualize_data.py 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env python
  2. #
  3. # Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # See <http://www.gnu.org/licenses/>.
  16. import matplotlib.pyplot as plt
  17. import numpy as np
  18. import sys
  19. import math
  20. if len(sys.argv) < 2:
  21. print("Usage:")
  22. print(" " + sys.argv[0] + " filename")
  23. sys.exit(0)
  24. fig, axes = plt.subplots(6, 1, figsize=(5, 15))
  25. data = []
  26. lines_heading = []
  27. with open(sys.argv[1]) as f:
  28. lines = f.readlines()
  29. lines_heading = lines[0].split(',')
  30. lines_data = lines[1:]
  31. for line in lines_data:
  32. nums = line.split(',')
  33. line_data = []
  34. for r in nums:
  35. line_data.append(int(r))
  36. data.append(line_data)
  37. start_time = data[0][0]
  38. for i in range(0, len(data)):
  39. data[i][0] = (data[i][0] - start_time) / 1000.0 / 1000.0
  40. print("samples: " + str(len(data)))
  41. x = [ r[0] for r in data ]
  42. for n in range(3, 9):
  43. y = [ r[n] for r in data ]
  44. im = axes[n - 3].plot(x, y)
  45. axes[n - 3].set_title(lines_heading[n])
  46. plt.suptitle(sys.argv[1], fontsize=18)
  47. plt.tight_layout()
  48. plt.show()