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, (-1, 15))
21 label = file.split(
'-')[0]
22 label = label[label.index(
'/') + 1:]
23 label +=
'-GPU' if 'gpu' in file
else '' 26 plt.plot(arr[:, 0], arr[:, 1],
27 linestyle=linestyles[i % len(linestyles)],
28 label=label, color=colorwheel[i % len(colorwheel)])
34 plt.title(
'H2/CO Constant Pressure Ignition')
36 plt.ylabel(
'Temerature (K)')
39 plt.savefig(
'h2ign.png', dpi=300, size=(5, 3))