18def plot_runtime_per_step(performance_data,label=None,xaxis=XAxis.RealTime):
28 while i<len(performance_data.get_time_step_real_time_stamps())
and i<len(performance_data.get_time_per_time_step()):
30 x_data.append(performance_data.get_time_step_real_time_stamps()[i])
31 y_data.append(performance_data.get_time_per_time_step()[i])
41 x_data = performance_data.get_time_step_real_time_stamps()
42 y_data = performance_data.get_time_per_time_step()
43 plt.plot( x_data, y_data, next_symbol(), markevery=next_markevery(performance_data.timesteps()), label=label )
45 if len(performance_data.plotting_time_stamp)>0:
46 max_time_per_time_step = max(performance_data.get_time_per_time_step())
47 min_time_per_time_step = min(performance_data.get_time_per_time_step())
48 for i
in performance_data.plotting_time_stamp:
49 plt.plot( [i,i], [min_time_per_time_step,max_time_per_time_step],
"--", color=
"#000000" )
50 plt.plot( [performance_data.plotting_time_stamp[0],performance_data.plotting_time_stamp[0]], [min_time_per_time_step,max_time_per_time_step],
"--", color=
"#000000", label=
"plot" )
52 plt.xlabel(
"Runtime [t]=s" )
53 plt.ylabel(
"Time per step [t]=s" )
56def plot_time_step_size_per_step(performance_data,label=None,xaxis=XAxis.RealTime):
60 if xaxis==XAxis.RealTime
and not performance_data.uses_local_timestepping():
61 if len(performance_data.get_time_step_real_time_stamps()) != len(performance_data.get_time_step_time_step_size()):
62 raise Exception(
"Size of fields do not match: " + str(len(performance_data.get_time_step_real_time_stamps())) +
" vs. " + str(len(performance_data.get_time_step_time_step_size())))
63 plt.plot( performance_data.get_time_step_real_time_stamps(), performance_data.get_time_step_time_step_size(), next_symbol(), markevery=next_markevery(performance_data.timesteps()), label=label )
64 plt.xlabel(
"Real time [t]=s" )
65 elif xaxis==XAxis.RealTime
and performance_data.uses_local_timestepping():
66 symbol = next_symbol()
67 x_data = performance_data.get_time_step_real_time_stamps()
68 y_data = performance_data.get_time_step_time_step_size()[0]
69 if len(x_data)>len(y_data):
70 print(
"WARNING: too many time stamps (does not fit to data points). Remove first entry")
72 plt.plot( x_data, y_data, symbol, markevery=next_markevery(len(y_data)), label=label )
73 y_data = performance_data.get_time_step_time_step_size()[1]
74 if len(x_data)>len(y_data):
75 print(
"WARNING: too many time stamps (does not fit to data points). Remove first entry")
77 plt.plot( x_data, y_data,
"-"+symbol, markevery=next_markevery(len(y_data)), label=label )
78 plt.xlabel(
"Real time [t]=s" )
79 elif xaxis==XAxis.Iterations
and not performance_data.uses_local_timestepping():
80 y_data = performance_data.get_time_step_time_step_size()
81 plt.plot( range(0,len(y_data)), y_data, next_symbol(), markevery=next_markevery(len(y_data)), label=label )
82 plt.xlabel(
"Simulation step" )
83 elif xaxis==XAxis.Iterations
and performance_data.uses_local_timestepping():
84 y_data = performance_data.get_time_step_time_step_size()[0]
85 symbol = next_symbol()
86 plt.plot( range(0,len(y_data)), y_data, symbol, markevery=next_markevery(len(y_data)), label=label )
87 y_data = performance_data.get_time_step_time_step_size()[1]
88 plt.plot( range(0,len(y_data)), y_data,
"-" + symbol, markevery=next_markevery(len(y_data)), label=label )
89 plt.xlabel(
"Simulation step" )
90 elif xaxis==XAxis.SimulatedTime
and not performance_data.uses_local_timestepping():
91 if len(performance_data.get_time_step_simulated_time_stamps()) != len(performance_data.get_time_step_time_step_size()):
92 raise Exception(
"Size of fields do not match: " + str(len(performance_data.get_time_step_simulated_time_stamps())) +
" vs. " + str(len(performance_data.get_time_step_time_step_size())))
93 plt.plot( performance_data.get_time_step_simulated_time_stamps(), performance_data.get_time_step_time_step_size(), next_symbol(), markevery=next_markevery(performance_data.timesteps()), label=label )
94 plt.xlabel(
"Simulated time" )
95 elif xaxis==XAxis.SimulatedTime
and performance_data.uses_local_timestepping():
96 if len(performance_data.get_time_step_simulated_time_stamps()) != len(performance_data.get_time_step_time_step_size()):
97 raise Exception(
"Size of fields do not match: " + str(len(performance_data.get_time_step_simulated_time_stamps())) +
" vs. " + str(len(performance_data.get_time_step_time_step_size())))
98 symbol = next_symbol()
99 x_data = performance_data.get_time_step_simulated_time_stamps()[0]
100 y_data = performance_data.get_time_step_time_step_size()[0]
101 x_data = x_data[len(x_data)-len(y_data):]
102 plt.plot( x_data, y_data, symbol, markevery=next_markevery(len(y_data)), label=label )
103 y_data = performance_data.get_time_step_time_step_size()[1]
104 plt.plot( x_data, y_data,
"-"+symbol, markevery=next_markevery(len(y_data)), label=label )
105 plt.xlabel(
"Simulated time $T$" )
107 raise Exception(
"enum value not supported" )
108 plt.ylabel(
"Time step size $\\Delta T$" )
112def plot_updates_per_step(performance_data,label=None,xaxis=XAxis.RealTime):
116 if xaxis==XAxis.RealTime:
117 plt.plot( performance_data.get_time_step_real_time_stamps(), performance_data.get_upates(), next_symbol(), markevery=next_markevery(performance_data.get_updates()), label=label )
118 plt.xlabel(
"Real time [t]=s" )
119 elif xaxis==XAxis.Iterations:
120 y_data = performance_data.get_updates()
121 plt.plot( range(0,len(y_data)), y_data, next_symbol(), markevery=next_markevery(len(y_data)), label=label )
122 plt.xlabel(
"Simulation step" )
123 elif xaxis==XAxis.SimulatedTime:
124 if performance_data.uses_local_timestepping():
125 x_data = performance_data.get_time_step_simulated_time_stamps()[0]
127 x_data = performance_data.get_time_step_simulated_time_stamps()
128 plt.plot( x_data, performance_data.get_updates(), next_symbol(), markevery=next_markevery(performance_data.timesteps()), label=label )
129 plt.xlabel(
"Simulated time" )
131 raise Exception(
"enum value not supported" )
132 plt.ylabel(
"Updates" )