Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- protocols = {}
- types = {"data1": "data1.csv"}
- for protname, fname in types.items():
- col_time,col_window = np.loadtxt(fname,delimiter=',').T
- trailing_window = col_window[:-1] # "past" values at a given index
- leading_window = col_window[1:] # "current values at a given index
- decreasing_inds = np.where(leading_window < trailing_window)[0]
- value = leading_window[decreasing_inds]/trailing_window[decreasing_inds]
- time = col_time[decreasing_inds]
- protocols[protname] = {
- "col_time": col_time,
- "col_window": col_window,
- "time": time,
- "value": value,
- }
- plt.figure(); plt.clf()
- plt.plot(time,value, ".", label=protname, color="blue")
- plt.ylim(0, 1.0001)
- plt.title(protname)
- plt.xlabel("time")
- plt.ylabel("value")
- plt.legend()
- plt.show()
- b_r=min(col_time)
- expected=col_window/b_r
- actual=col_window/col_time
- diff=expected-actual
- plt.plot(value, diff)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement