2022-10-31 15:05:22 +08:00
|
|
|
import numpy as np
|
|
|
|
import pandas as pd
|
2023-01-18 22:21:22 +08:00
|
|
|
import matplotlib.pyplot as plt
|
2023-02-18 09:06:28 +08:00
|
|
|
from datetime import datetime
|
2022-10-31 15:05:22 +08:00
|
|
|
|
2023-02-18 09:06:28 +08:00
|
|
|
num_time_step = 501
|
2022-10-31 15:05:22 +08:00
|
|
|
num_iter = 10
|
|
|
|
|
2023-01-18 22:21:22 +08:00
|
|
|
env_data = pd.DataFrame(pd.read_excel('env_data.xlsx', engine='openpyxl', sheet_name=0))
|
2022-10-31 15:05:22 +08:00
|
|
|
|
2023-02-13 08:26:27 +08:00
|
|
|
assert env_data.shape[0] == num_iter * (num_time_step + 1), f"{env_data.shape[0]}, {num_iter * (num_time_step + 1)}"
|
2022-10-31 15:05:22 +08:00
|
|
|
|
|
|
|
lst_df = []
|
|
|
|
for i in range(num_iter):
|
|
|
|
df_tmp = env_data.iloc[i * (num_time_step + 1): (i + 1) * (num_time_step + 1), 1:]
|
|
|
|
lst_df.append(df_tmp)
|
|
|
|
|
2023-02-14 10:17:41 +08:00
|
|
|
lst_column = lst_df[0].columns
|
2023-01-18 22:21:22 +08:00
|
|
|
|
|
|
|
for str_col in lst_column:
|
|
|
|
x = np.arange(num_time_step+1)
|
|
|
|
for df in lst_df:
|
|
|
|
y = np.array(df[str_col]).flatten()
|
|
|
|
plt.xlabel('t')
|
|
|
|
plt.ylabel(str_col)
|
|
|
|
plt.plot(x, y)
|
|
|
|
# plt.show()
|
|
|
|
# plt.close()
|
2023-02-18 09:06:28 +08:00
|
|
|
plt.savefig(f"{str_col}-{datetime.today().strftime('%Y-%m-%d')}.pdf", bbox_inches="tight")
|
2023-01-31 14:04:45 +08:00
|
|
|
plt.close()
|