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 DataPlot(data)[source]

Bases: object

Base class for all plotting related classes.

class EvalData(input_data, output_data, name='')[source]

Bases: object

Convenience wrapper for function evaluation. Contains the input data that was used for evaluation and the results.

interpolation_handle(desired_coordinates)[source]
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.PgDataPlot

Get 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.DataPlot

Plot 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.PgDataPlot

Wrapper 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
class PgDataPlot(data)[source]

Bases: pyinduct.visualization.DataPlot, PyQt4.QtCore.QObject

Base class for all pyqtgraph plotting related classes.

class PgLinePlot3d(data, n=50, scale=1)[source]

Bases: pyinduct.visualization.PgDataPlot

Ulots 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.PgDataPlot

Plot selected slice of given DataSets.

class PgSurfacePlot(data, grid_height=None, title='')[source]

Bases: pyinduct.visualization.PgDataPlot

Plot 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.

mpl_activate_latex()[source]

Activate full (label, ticks, ...) latex printing in matplotlib plots.

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