Guest User

Untitled

a guest
Feb 15th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. 0.086206438,10
  2. 0.086425551,12
  3. 0.089227066,20
  4. 0.089262508,24
  5. 0.089744425,30
  6. 0.090036815,40
  7. 0.090054172,28
  8. 0.090377569,28
  9. 0.090514071,28
  10. 0.090762872,28
  11. 0.090912691,27
  12.  
  13. import numpy as np
  14. import pandas as pd
  15. import csv
  16. import numpy as np
  17. import scipy.stats
  18. import matplotlib.pyplot as plt
  19. import seaborn as sns
  20. from scipy.stats import norm
  21. from statsmodels.graphics.tsaplots import plot_acf, acf
  22.  
  23.  
  24. protocols = {}
  25.  
  26.  
  27. types = {"data1": "data1.csv", "data2": "data2.csv", "data3": "data3.csv"}
  28.  
  29. for protname, fname in types.items():
  30. arr = []
  31. arr1 = []
  32. with open(fname, mode='r', encoding='utf-8-sig') as f:
  33. reader = csv.reader(f, delimiter=",")
  34. for i in reader:
  35. arr.append(int(i[1]))
  36. arr1.append(float(i[0]))
  37.  
  38. arr, arr1 = np.array(arr), np.array(arr1)
  39. diffs = np.diff(arr)
  40. diffs1 = np.diff(arr1)
  41. diffs1 = diffs1[diffs > 0]
  42. diffs = diffs[diffs > 0] # To keep only the increased values
  43. protocols[protname] = {
  44. "rtime": np.array(arr1),
  45. "rdata": np.array(arr),
  46. "data": diffs,
  47. "timediff": diffs,
  48. }
  49.  
  50. ## change in time
  51. for protname, values in protocols.items():
  52. d = values["rdata"]
  53. t = values["rtime"]
  54. d = np.diff(d, 1) #/ d[:-1]
  55. t = np.diff(t, 1)
  56. plt.plot(t[d < 0], d[d < 0], ".", label=protname, alpha=0.5)
  57. plt.xlabel("Changes in time")
  58. plt.ylabel("differences")
  59. plt.legend()
  60. plt.show()
Add Comment
Please, Sign In to add comment