Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4.  
  5. protocols = {}
  6.  
  7.  
  8. types = {"data1": "data1.csv"}
  9.  
  10.  
  11. for protname, fname in types.items():
  12. col_time,col_window = np.loadtxt(fname,delimiter=',').T
  13. trailing_window = col_window[:-1] # "past" values at a given index
  14. leading_window = col_window[1:] # "current values at a given index
  15. decreasing_inds = np.where(leading_window < trailing_window)[0]
  16. value = leading_window[decreasing_inds]/trailing_window[decreasing_inds]
  17. time = col_time[decreasing_inds]
  18.  
  19.  
  20.  
  21. protocols[protname] = {
  22. "col_time": col_time,
  23. "col_window": col_window,
  24. "time": time,
  25. "value": value,
  26. }
  27. plt.figure(); plt.clf()
  28. plt.plot(time,value, ".", label=protname, color="blue")
  29. plt.ylim(0, 1.0001)
  30. plt.title(protname)
  31. plt.xlabel("time")
  32. plt.ylabel("value")
  33. plt.legend()
  34. plt.show()
  35.  
  36. b_r=min(col_time)
  37. expected=col_window/b_r
  38. actual=col_window/col_time
  39. diff=expected-actual
  40. plt.plot(value, diff)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement