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 thepydy-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: overwrite : boolean, optional, default=False
If True, the directory named
pydy-visualization
in the current working directory will be overwritten.silent : boolean, optional, default=False
If True, no messages will be displayed to STDOUT.
prefix : string, optional
An optional prefix for the json data files.
-
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.
-
generate_visualization_json
(dynamic_variables, constant_variables, dynamic_values, constant_values, fps=30, outfile_prefix=None)[source]¶ Creates two JSON files in the current working directory. One contains the scene information and one contains the simulation data.
Parameters: dynamic_variables : sequence of SymPy functions of time, len(m)
The variables representing the state of the system. They should be in the same order as
dynamic_values
.constant_variables : sequence of SymPy symbols, len(p)
The variables representing the constants in the system. They should be in the same order as
constant_variables
.dynamic_values : ndarray, shape(n, m)
The trajectories of the states.
constant_values : ndarray, shape(p,)
The numerical values of the constants.
fps : int, 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_prefix : str, 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.
-
generate_visualization_json_system
(system, **kwargs)[source]¶ Creates the visualization JSON files for the provided system.
Parameters: system : pydy.system.System
A fully developed PyDy system that is prepared for the
.integrate()
method.Notes
The optional keyword arguments are the same as those in the
generate_visualization_json
method.
-
name
¶ Returns the name of the scene.
-
origin
¶ Returns the origin point of the scene.
-
reference_frame
¶ Returns the base reference frame of the scene.
-