2 import matplotlib.pyplot
as plt
7 files = [os.path.join(
'log', file)
for file
in os.listdir(
'./log/')
8 if file.endswith(
'.bin')]
9 files = [file
for file
in files
if os.path.isfile(file)]
11 linestyles = [
'-',
'--',
'-.']
12 colorwheel = [
'r', 'g', 'b', 'k']
15 for i, file
in enumerate(files):
16 arr = np.fromfile(file)
18 arr = np.reshape(arr, (2001, 3))
21 label = file.split(
'-')[0]
22 label = label[label.index(
'/') + 1:]
23 label +=
'-GPU' if 'gpu' in file
else '' 26 plt.plot(arr[:, 0][::10], arr[:, 1][::10],
27 linestyle=linestyles[i % len(linestyles)],
28 label=label, color=colorwheel[i % len(colorwheel)])
34 plt.title(
'van der Pol equation')
39 plt.savefig(
'van_der_pol.png', dpi=300, size=(5, 3))