Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 0.086206438,10
- 0.086425551,12
- 0.089227066,20
- 0.089262508,24
- 0.089744425,30
- 0.090036815,40
- 0.090054172,28
- 0.090377569,28
- 0.090514071,28
- 0.090762872,28
- 0.090912691,27
- import numpy as np
- import pandas as pd
- import csv
- import numpy as np
- import scipy.stats
- import matplotlib.pyplot as plt
- import seaborn as sns
- from scipy.stats import norm
- from statsmodels.graphics.tsaplots import plot_acf, acf
- protocols = {}
- types = {"data1": "data1.csv", "data2": "data2.csv", "data3": "data3.csv"}
- for protname, fname in types.items():
- arr = []
- arr1 = []
- with open(fname, mode='r', encoding='utf-8-sig') as f:
- reader = csv.reader(f, delimiter=",")
- for i in reader:
- arr.append(int(i[1]))
- arr1.append(float(i[0]))
- arr, arr1 = np.array(arr), np.array(arr1)
- diffs = np.diff(arr)
- diffs1 = np.diff(arr1)
- diffs1 = diffs1[diffs > 0]
- diffs = diffs[diffs > 0] # To keep only the increased values
- protocols[protname] = {
- "rtime": np.array(arr1),
- "rdata": np.array(arr),
- "data": diffs,
- "timediff": diffs,
- }
- ## change in time
- for protname, values in protocols.items():
- d = values["rdata"]
- t = values["rtime"]
- d = np.diff(d, 1) #/ d[:-1]
- t = np.diff(t, 1)
- plt.plot(t[d < 0], d[d < 0], ".", label=protname, alpha=0.5)
- plt.xlabel("Changes in time")
- plt.ylabel("differences")
- plt.legend()
- plt.show()
Add Comment
Please, Sign In to add comment