Scene

class pydy.viz.scene.Scene(reference_frame, origin, *visualization_frames, **kwargs)[source]

The Scene class generates all of the data required for animating a set of visualization frames.

clear_trajectories()[source]

Sets the ‘system’, ‘times’, ‘constants’, ‘states_symbols’, and ‘states_trajectories’ to None.

create_static_html(overwrite=False, silent=False, prefix=None)[source]

Creates a directory named pydy-visualization in the current working directory which contains all of the HTML, CSS, Javascript, and json files required to run the vizualization application. To run the application, navigate into the pydy-visualization directory and start a webserver from that directory, e.g.:

$ python -m SimpleHTTPServer

Now, in a WebGL compliant browser, navigate to:

http://127.0.0.1:8000

to view and interact with the visualization.

This method can also be used to output files for embedding the visualizations in static webpages. Simply copy the contents of static directory in the relevant directory for embedding in a static website.

Parameters
overwriteboolean, optional, default=False

If True, the directory named pydy-visualization in the current working directory will be overwritten.

silentboolean, optional, default=False

If True, no messages will be displayed to STDOUT.

prefixstring, optional

An optional prefix for the json data files.

display()[source]

Displays the scene in the default web browser.

display_ipython()[source]

Displays the scene using an IPython widget inside an IPython notebook cell.

Notes

IPython widgets are only supported by IPython versions >= 3.0.0.

display_jupyter(window_size=(800, 600), axes_arrow_length=None)[source]

Returns a PyThreeJS Renderer and AnimationAction for displaying and animating the scene inside a Jupyter notebook.

Parameters
window_size2-tuple of integers

2-tuple containing the width and height of the renderer window in pixels.

axes_arrow_lengthfloat

If a positive value is supplied a red (x), green (y), and blue (z) arrows of the supplied length will be displayed as arrows for the global axes.

Returns
vboxwidgets.VBox

A vertical box containing the action (pythreejs.AnimationAction) and renderer (pythreejs.Renderer).

generate_visualization_json_system(system, **kwargs)[source]

Creates the visualization JSON files for the provided system.

Parameters
systempydy.system.System

A fully developed PyDy system that is prepared for the .integrate() method.

fpsint, optional, default=30

Frames per second at which animation should be displayed. Please not that this should not exceed the hardware limit of the display device to be used. Default is 30fps.

outfile_prefixstr, optional, default=None

A prefix for the JSON files. The files will be named as outfile_prefix_scene_desc.json and outfile_prefix_simulation_data.json. If not specified a timestamp shall be used as the prefix.

Notes

The optional keyword arguments are the same as those in the generate_visualization_json method.

property name

Returns the name of the scene.

property origin

Returns the origin point of the scene.

property reference_frame

Returns the base reference frame of the scene.

remove_static_html(force=False)[source]

Removes the static directory from the current working directory.

Parameters
forceboolean, optional, default=False

If true, no warning is issued before the removal of the directory.