pterasoftware.animate()

pterasoftware.animate(
unsteady_solver: UnsteadyRingVortexLatticeMethodSolver,
/,
*,
scalar_type: str | None = None,
show_wake_vortices: bool | np.bool = False,
show_mujoco_geometry: bool | np.bool = False,
window_size: Sequence[int] = (1024, 768),
save: bool | np.bool = False,
path: str | Path = 'animate.webp',
quality: int | float = 75.0,
speed: int | float | None = None,
testing: bool | np.bool = False,
cameraPosition_D_Do: np.ndarray | Sequence[float | int] | None = None,
cameraFocalPoint_D_Do: np.ndarray | Sequence[float | int] | None = None,
cameraViewUp_D: np.ndarray | Sequence[float | int] | None = None,
camera_parallel_scale: int | float | None = None,
return_camera_state: bool | np.bool = False,
) → dict[str, Any] | None

Animates the Airplane(s) of an UnsteadyRingVortexLatticeMethodSolver or one of its subclasses (the aeroelastic or free flight solver).

For a FreeFlightUnsteadyRingVortexLatticeMethodSolver, each time step's geometry is rendered in Earth axes at its true position and orientation, so the body flies through the scene along its trajectory rather than staying fixed while the wake streams behind it. The camera frames the whole trajectory.

Parameters:
  • unsteady_solver -- The UnsteadyRingVortexLatticeMethodSolver whose Airplane(s) will be animated. Its subclasses, the AeroelasticUnsteadyRingVortexLatticeMethodSolver and the FreeFlightUnsteadyRingVortexLatticeMethodSolver, are also accepted.

  • scalar_type -- Determines how to color the Panels. Setting this to None colors the Panels uniformly. If the solver has been run, it can also be "induced drag", "crosswind force", or "lift", which respectively use each Panel's induced drag, crosswind force, and lift coefficient. The default is None.

  • show_wake_vortices -- Set this to True to show any wake ring vortices. If True, the solver must have already been run. Can be a bool or a numpy bool and will be converted internally to a bool. The default is False.

  • show_mujoco_geometry -- Set this to True to show the MuJoCo geometry that extra_xml and mujoco_assets inject into the solver's model, with body geoms re- posed every time step and worldbody geoms static in Earth axes. If True, the unsteady_solver must be a FreeFlightUnsteadyRingVortexLatticeMethodSolver. Can be a bool or a numpy bool and will be converted internally to a bool. The default is False.

  • window_size -- The width and height, in pixels, of the render window. This also sets the resolution of the saved WebP. It must be a sequence of two positive ints. The text and line widths scale with it, so a larger or smaller window is legible rather than being drawn with the same pixel counts as the default. When rendering on screen, a window_size that does not fit in the area the window manager grants is shown scaled down to fit, keeping its aspect ratio, with its text and line widths scaled down to match, while a saved WebP keeps the requested size. The default is (1024, 768).

  • save -- Set this to True to save the animation as an animated WebP. Once the view is oriented, the window closes and the frames are rendered separately, off screen, at window_size and from the view the window ended with, while a progress bar reports the rendering's progress. Resizing the window therefore does not change the saved frames' size or styling. However, a window resized to a different aspect ratio shows more or less of the scene horizontally than the saved frames do. If False, the animation plays in the window instead. It can be a bool or a numpy bool and will be converted internally to a bool. The default is False.

  • path -- The file path to save the animation to. It can be a str or a Path, must end with ".webp", and its directory must already exist. This has no effect unless save is True. The default is "animate.webp".

  • quality -- The quality of the saved WebP, where 0.0 is the smallest file with the most compression artifacts and 100.0 is the largest file with the fewest. It can be an int or a float and will be converted internally to a float. This has no effect unless save is True. The default is 75.0.

  • speed -- The playback speed of the saved animation, as a multiple of real time, where 1.0 plays the simulation at true speed and 0.5 plays it at half speed. Setting this to None plays at true speed, slowing the animation down only when true speed would need more than 50.0 frames per second, which is the fastest some programs will render a WebP. Any speed that would need more than 50.0 frames per second is instead reached by saving only every Nth frame, which trades the animation's temporal resolution for its speed. It can be an int or a float, must be positive, and will be converted internally to a float. A speed so slow that the animation would save fewer than one frame per second of playback, or so fast that it would save fewer than two frames in total, is rejected. This has no effect unless save is True. The default is None.

  • testing -- Set this to True to start the animation after one second, which is useful for running test suites. It can be a bool or a numpy bool and will be converted internally to a bool. The default is False.

  • cameraPosition_D_Do -- None, or an array-like object of 3 numbers (int or float) representing the camera's position (in diagram axes, relative to the diagram origin). The diagram axes and diagram origin are the first Airplane's geometry axes and CG, or Earth axes and the Earth origin for a free flight solver. Can be a tuple, list, or ndarray. Values are converted to floats internally. The units are in meters. When omitted, the mode's default camera position is used.

  • cameraFocalPoint_D_Do -- None, or an array-like object of 3 numbers (int or float) representing the camera's focal point (in diagram axes, relative to the diagram origin). See cameraPosition_D_Do for the diagram axes and diagram origin. Can be a tuple, list, or ndarray. Values are converted to floats internally. The units are in meters. When omitted, the mode's default focal point is used.

  • cameraViewUp_D -- None, or an array-like object of 3 numbers (int or float) representing the camera's view up direction (in diagram axes). See cameraPosition_D_Do for the diagram axes. It must not be parallel or antiparallel to the view direction. Can be a tuple, list, or ndarray. Values are converted to floats internally. When omitted, the mode's default view up direction is used.

  • camera_parallel_scale -- Optional positive parallel-projection scale. When omitted alongside any camera override, the scale is fitted to the relevant geometry for the effective camera direction.

  • return_camera_state -- If True, return the final camera position, focal point, view up direction, and parallel scale after the preview interaction. The returned dictionary can be unpacked as keyword arguments into a later call to reuse the view. The default is False.

Returns:

If return_camera_state is True, a dictionary of the final camera state, whose keys are cameraPosition_D_Do, cameraFocalPoint_D_Do, and cameraViewUp_D (each a tuple of 3 floats) and camera_parallel_scale (a float). Otherwise None.