Visualization¶
Here are some frequently used plot types with the packages pyqtgraph and/or matplotlib implemented.
The respective pyinduct.visualization plotting function get an EvalData object whose definition
also placed in this module.
A EvalData-object in turn can easily generated from simulation data.
The function pyinduct.simulation.simulate_system() for example already provide the simulation result
as EvalData object.
-
class
EvalData(input_data, output_data, name='')[source]¶ Bases:
objectConvenience wrapper for function evaluation. Contains the input data that was used for evaluation and the results.
-
class
MplSlicePlot(eval_data_list, time_point=None, spatial_point=None, ylabel='', legend_label=None, legend_location=1, figure_size=(10, 6))[source]¶ Bases:
pyinduct.visualization.PgDataPlotGet list (eval_data_list) of ut.EvalData objects and plot the temporal/spatial slice, by spatial_point/time_point, from each ut.EvalData object, in one plot. For now: only ut.EvalData objects with len(input_data) == 2 supported
-
class
MplSurfacePlot(data, keep_aspect=False, fig_size=(12, 8), zlabel='$\quad x(z, t)$')[source]¶ Bases:
pyinduct.visualization.DataPlotPlot as 3d surface.
-
class
PgAnimatedPlot(data, title='', refresh_time=40, replay_gain=1, save_pics=False, create_video=False, labels=None)[source]¶ Bases:
pyinduct.visualization.PgDataPlotWrapper that shows an updating one dimensional plot of n-curves discretized in t time steps and z spatial steps It is assumed that time propagates along axis0 and and location along axis1 of values. values are therefore expected to be a array of shape (n, t, z)
Parameters: - data ((iterable of)
EvalData) – results to animate - title (basestring) – window title
- refresh_time (int) – time in msec to refresh the window must be greater than zero
- replay_gain (float) – values above 1 acc- and below 1 decelerate the playback process, must be greater than zero
- save_pics (bool) –
- labels –
??
Return:
-
exported_files¶
- data ((iterable of)
-
class
PgDataPlot(data)[source]¶ Bases:
pyinduct.visualization.DataPlot,PyQt4.QtCore.QObjectBase class for all pyqtgraph plotting related classes.
-
class
PgLinePlot3d(data, n=50, scale=1)[source]¶ Bases:
pyinduct.visualization.PgDataPlotUlots a series of n-lines of the systems state. Scaling in z-direction can be changed with the scale setting.
-
class
PgSlicePlot(data, title=None)[source]¶ Bases:
pyinduct.visualization.PgDataPlotPlot selected slice of given DataSets.
-
class
PgSurfacePlot(data, grid_height=None, title='')[source]¶ Bases:
pyinduct.visualization.PgDataPlotPlot as 3d surface.
-
create_colormap(cnt)[source]¶ Create a colormap containing cnt values.
Parameters: cnt (int) – Returns: Colormap ...
-
mpl_3d_remove_margins()[source]¶ Remove thin margins in matplotlib 3d plots. The Solution is from Stackoverflow.
-
save_2d_pg_plot(plot, filename)[source]¶ Save a given pyqtgraph plot in the folder <current path>.pictures_plot under the given filename
filename.Parameters: - plot (
pyqtgraph.plotItem) – Pyqtgraph plot. - filename (str) – Png picture filename.
Returns: Path with filename and path only.
Return type: tuple of 2 str’s
- plot (