Programmable real-time audio signal processing application
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

plot_presets.py 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import numpy as np
  2. from mpl_toolkits.mplot3d import Axes3D
  3. import matplotlib.pyplot as plt
  4. import csv
  5. plt.switch_backend('TkAgg')
  6. """
  7. def randrange(n, vmin, vmax):
  8. return (vmax - vmin)*np.random.rand(n) + vmin
  9. fig = plt.figure()
  10. ax = fig.add_subplot(111, projection='3d')
  11. n = 100
  12. for c, m, zl, zh in [('r', 'o', -50, -25), ('b', '^', -30, -5)]:
  13. xs = randrange(n, 23, 32)
  14. ys = randrange(n, 0, 100)
  15. zs = randrange(n, zl, zh)
  16. ax.scatter(xs, ys, zs, c=c, marker=m)
  17. ax.set_xlabel('X Label')
  18. ax.set_ylabel('Y Label')
  19. ax.set_zlabel('Z Label')
  20. plt.show()
  21. """
  22. fn = "preset.csv"
  23. fig = plt.figure()
  24. ax = fig.add_subplot(111, projection='3d')
  25. ax.set_xlabel('Threshold')
  26. ax.set_ylabel('Lower')
  27. ax.set_zlabel('Upper')
  28. with open(fn) as f:
  29. rd = csv.reader(f)
  30. rd.next()
  31. for x in rd:
  32. label = x[0]
  33. ch = x[1]
  34. mode = x[2]
  35. thresh= x[3]
  36. upr = x[4]
  37. lwr = x[5]
  38. offs = x[6]
  39. c = 'b'
  40. if float(mode)==4:
  41. c = 'g'
  42. if float(mode)==0:
  43. c = 'r'
  44. lbl = "%s-%s" % (label,ch)
  45. x = float(thresh)
  46. y = float(lwr)
  47. z = float(upr)
  48. ax.scatter(x,y,z,c=c)
  49. ax.text(x,y,z, '%s' % (lbl), size=10, zorder=1, color='k')
  50. plt.show()