Examples#

The examples below are organized into galleries that mirror the functional areas of the Plot3d API. Each gallery is self-contained; to run the complete suite of examples, it is recommended to install the optional dependencies, viz.:

pip install "psi-pyvisual[tracing,data]"

See also

Overview

Conceptual introduction to the coordinate conventions and class hierarchy used throughout pyvisual.

Installation

Installation instructions for pyvisual, along with a list of its optional dependencies.

API Reference

Full API reference for all public classes and functions (including a variety of additional examples).

Data Access#

Examples that use Predictive Science Inc’s MAS model data call fetch_datasets(), which downloads a small set of data files from the PSI asset server on first run and caches them under ~/.cache/psi/ (or $PYVISUAL_CACHE if set). Examples that use only NumPy arrays run without any network access.

MHDweb#

These data-fetching routines (pyvisual.utils.data) are designed to provide ready access to a sample MAS run for testing and demonstration purposes.

For access to the full catalogue of Predictive Science Inc’s publically available MAS (Magnetodydrodynamic Algorithm outside a Sphere) model solutions – over 2100 runs spanning nearly 5 decades – please visit MHDweb.

This web-based data-visualization suite includes a wide variety of highly customizable data products which can be downloaded directly through the web interface (e.g. Spacecraft Mapping, White Light Imagers, EUV & X-Ray Emissions) or programmatically accessed through the MHDweb API.

Getting Started#

Introductory examples covering the basics of Plot3d: instantiating the plotter, adding geometry to the scene, and controlling actor visibility.

Instantiating a Plot3d Object

Instantiating a Plot3d Object

Longitudinal and Latitudinal Lines

Longitudinal and Latitudinal Lines

Loading and Plotting MHD Data

Loading and Plotting MHD Data

Stack Mesh Mixin#

Examples demonstrating StackMeshMixin — the mixin that renders geometry from stacked N-D coordinate arrays, where every element of r, t, and p shares the same array shape and corresponds to a single spatial location.

Plotting Points and Splines

Plotting Points and Splines

Reconstructing Surfaces

Reconstructing Surfaces

Plotting Magnetic Fieldlines

Plotting Magnetic Fieldlines

Grid Mesh Mixin#

Examples demonstrating GridMeshMixin — the mixin that renders structured-grid data from independent 1-D axis arrays or pre-broadcast 3-D arrays, including fieldline tracing with mapflpy.

1-D Line Slices

1-D Line Slices

2-D Surface Slices

2-D Surface Slices

Isosurface Contours

Isosurface Contours

Observer Mixin#

Examples demonstrating ObserverMixin — the mixin that positions and orients the camera in spherical coordinates, controls the field of view, and provides a live camera-state text overlay.

Saving and Restoring Camera Views

Saving and Restoring Camera Views

Camera Orbit Animation

Camera Orbit Animation

Line-of-Sight and Field-of-View Control

Line-of-Sight and Field-of-View Control

Geometry Mixin#

Examples demonstrating GeometryMixin — the mixin that adds solar geometry primitives to the scene: the Sun sphere, concentric shells, planar discs, the Thomson sphere, and structured spline grid lines.

Shells and Discs

Shells and Discs

The Thomson Sphere

The Thomson Sphere

Structured Spline Grids

Structured Spline Grids

SphericalMesh#

Examples demonstrating the SphericalMesh class — the primary data container for structured \((r, \theta, \phi)\) grids. Topics include construction from NumPy arrays, arithmetic and NumPy ufunc support, and the filter methods for radial scaling and coordinate remapping.

Constructing a SphericalMesh

Constructing a SphericalMesh

Arithmetic and NumPy Ufunc Support

Arithmetic and NumPy Ufunc Support

SphericalMesh Filter Methods

SphericalMesh Filter Methods

CartesianMesh#

Examples demonstrating the CartesianMesh class — the Cartesian-frame counterpart to SphericalMesh. Topics include construction from NumPy arrays, coordinate-frame conversion from a SphericalMesh, and direct rendering via Plot3d.

Constructing a CartesianMesh

Constructing a CartesianMesh

Arithmetic and NumPy Ufunc Support

Arithmetic and NumPy Ufunc Support

CartesianMesh Filter Methods

CartesianMesh Filter Methods

Advanced Examples#

More complex examples combining multiple elements of the Plot3d API: multi-domain fieldline tracing, interactive point picking with callbacks, and combined slice/contour/fieldline scenes.

Combining Slices, Contours, and Fieldlines

Combining Slices, Contours, and Fieldlines

Polarity-Inversion-Line Seeded Fieldlines

Polarity-Inversion-Line Seeded Fieldlines

Interactive Fieldline Tracer

Interactive Fieldline Tracer

Faux Volume Rendering

Faux Volume Rendering

MHDweb Integration Part I

MHDweb Integration Part I

MHDweb Integration Part II

MHDweb Integration Part II

Gallery generated by Sphinx-Gallery