Skip to content

Commit 7698b2c

Browse files
DOC: Update numpy refs (that require :obj: rst ref)
1 parent 0e6e2ac commit 7698b2c

8 files changed

Lines changed: 61 additions & 70 deletions

File tree

examples/02_stack_mesh_mixin/p01_points.py

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
"""
2-
Plotting Points
3-
===============
2+
Plotting Points and Splines
3+
============================
44
5-
This example demonstrates :meth:`~pyvisual.core.mixins.StackMeshMixin.add_point`
6-
and :meth:`~pyvisual.core.mixins.StackMeshMixin.add_points` — the methods for
7-
rendering individual points and point clouds from spherical coordinate arrays.
5+
This example demonstrates :meth:`~pyvisual.core.mixins.StackMeshMixin.add_point`,
6+
:meth:`~pyvisual.core.mixins.StackMeshMixin.add_points`,
7+
:meth:`~pyvisual.core.mixins.StackMeshMixin.add_spline`, and
8+
:meth:`~pyvisual.core.mixins.StackMeshMixin.add_splines` — the methods for
9+
rendering individual points, point clouds, single polyline paths, and bundles
10+
of splines from spherical coordinate arrays.
811
"""
912

1013
import numpy as np
@@ -45,3 +48,48 @@
4548
plotter.add_sun()
4649
plotter.add_points(r, t, p, r, point_size=5)
4750
plotter.show()
51+
52+
# %%
53+
# Single Spline
54+
# -------------
55+
#
56+
# :meth:`~pyvisual.core.mixins.StackMeshMixin.add_spline` draws a single
57+
# line through a sequence of :math:`(r, \theta, \phi)` points. The example
58+
# below traces an equatorial Archimedean spiral: the longitude :math:`\phi`
59+
# increases uniformly as the radial distance :math:`r` grows from
60+
# :math:`1\,R_\odot` to :math:`30\,R_\odot`, approximating a Parker spiral
61+
# in the ecliptic plane. The spline is colored by :math:`r`.
62+
63+
r = np.linspace(1, 30, 100)
64+
t = np.repeat(np.pi / 2, 100)
65+
p = np.linspace(0, 2 * np.pi, 100)
66+
67+
plotter = Plot3d()
68+
plotter.show_axes()
69+
plotter.add_sun()
70+
plotter.add_spline(r, t, p, r, line_width=5)
71+
plotter.show()
72+
73+
# %%
74+
# Bundle of Splines
75+
# -----------------
76+
#
77+
# :meth:`~pyvisual.core.mixins.StackMeshMixin.add_splines` renders multiple
78+
# splines from N-D coordinate arrays. Here, 10 meridional arcs connect the
79+
# north and south poles at evenly spaced longitudes, tracing the surface of a
80+
# sphere of radius :math:`5\sin\theta\,R_\odot`. The coordinate arrays have
81+
# shape ``(10, 100)``; ``axis=1`` declares that axis 1 (length 100) traces
82+
# each individual spline path and axis 0 (length 10) enumerates the distinct
83+
# meridians. Each spline is colored by its index.
84+
85+
n_lines, n_pts = 10, 100
86+
r = np.tile(5 * np.sin(np.linspace(0, np.pi, n_pts)), (n_lines, 1))
87+
t = np.tile(np.linspace(0, np.pi, n_pts), (n_lines, 1))
88+
p = np.tile(np.linspace(0, 2 * np.pi, n_lines)[:, None], (1, n_pts))
89+
data = np.arange(n_lines)
90+
91+
plotter = Plot3d()
92+
plotter.show_axes()
93+
plotter.add_sun()
94+
plotter.add_splines(r, t, p, data, axis=1, show_scalar_bar=False)
95+
plotter.show()

examples/02_stack_mesh_mixin/p02_splines.py

Lines changed: 0 additions & 57 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

examples/06_spherical_grid_class/p02_arithmetic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
:class:`~pyvisual.core.mesh3d.CartesianMesh`) inherit a full arithmetic suite
77
from :class:`~pyvisual.core.mesh3d._BaseFrameMesh`. Standard Python
88
operators (``+``, ``-``, ``*``, ``/``, ``**``, etc.) and NumPy ufuncs such as
9-
:func:`numpy.log10` and :func:`numpy.sqrt` operate element-wise on the active
9+
:obj:`numpy.log10` and :obj:`numpy.sqrt` operate element-wise on the active
1010
scalar field and return a new mesh of the same type with the result as the
1111
active scalar. The coordinate arrays are never modified — only the data
1212
changes.
@@ -52,7 +52,7 @@
5252
#
5353
# The :meth:`~pyvisual.core.mesh3d._BaseFrameMesh.__array_ufunc__` hook lets
5454
# any single-output NumPy ufunc act directly on the mesh.
55-
# :func:`numpy.log10` applied to :math:`B_r r^2` converts the field to a
55+
# :obj:`numpy.log10` applied to :math:`B_r r^2` converts the field to a
5656
# logarithmic scale.
5757
#
5858
# To account for the sign of :math:`B_r r^2`, we take the absolute value before applying

examples/06_spherical_grid_class/p03_filters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107
# points via :meth:`pyvista.DataObjectFilters.sample`.
108108
#
109109
# The second :meth:`~pyvista.Plotter.add_mesh` call projects the colored trajectory
110-
# onto the plane :math:`r = 2` using
111-
# :meth:`pyvista.PolyData.project_points_to_plane`, producing a "shadow" projection
110+
# onto the plane :math:`r = 2 R_\odot` using
111+
# :meth:`~pyvista.PolyDataFilters.project_points_to_plane`, producing a "shadow" projection
112112
# for spatial context.
113113

114114
trajectory = spacecraft_trajectory('psp', '2024-03-28', '2024-04-01')
@@ -130,7 +130,7 @@
130130
# Two points on the trajectory (indices 0 and 50) are converted to Cartesian
131131
# coordinates via :func:`~pyvisual.utils.geometry.spherical_to_cartesian`. Their
132132
# cross product defines the normal to the orbital plane, which is used to orient a
133-
# :class:`pyvista.Disc` spanning 30 :math:`R_\odot`.
133+
# :class:`~pyvista.PolyData` disc spanning 30 :math:`R_\odot`.
134134
# :meth:`~pyvisual.core.mesh3d.SphericalMeshFilters.spherical_to_cartesian` converts
135135
# the :class:`pyvista.RectilinearGrid` to a Cartesian
136136
# :class:`pyvista.StructuredGrid`, and :meth:`pyvista.DataObjectFilters.sample` then

examples/07_cartesian_grid_class/p02_cart_arithmetic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
:class:`~pyvisual.core.mesh3d.SphericalMesh`) inherit a full arithmetic suite
77
from :class:`~pyvisual.core.mesh3d._BaseFrameMesh`. Standard Python operators
88
(``+``, ``-``, ``*``, ``/``, ``**``, etc.) and NumPy ufuncs such as
9-
:func:`numpy.log10` and :func:`numpy.sqrt` operate element-wise on the active
9+
:obj:`numpy.log10` and :obj:`numpy.sqrt` operate element-wise on the active
1010
scalar field and return a new mesh of the same type with the result as the
1111
active scalar. The coordinate arrays are never modified — only the data
1212
changes.
@@ -60,7 +60,7 @@
6060
#
6161
# The :meth:`~pyvisual.core.mesh3d._BaseFrameMesh.__array_ufunc__` hook lets
6262
# any single-output NumPy ufunc act directly on the mesh.
63-
# :func:`numpy.log10` applied to the normalised distance converts the field to
63+
# :obj:`numpy.log10` applied to the normalised distance converts the field to
6464
# a logarithmic scale that compresses the large dynamic range near the outer
6565
# boundary and reveals structure close to the origin. Points at or below zero
6666
# (here, the grid corner where :math:`r = 0`) are masked by the log.

examples/99_advanced_plots/p03_contour_based_fieldlines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
:func:`~mapflpy.scripts.run_fwdbwd_tracing` as ``launch_points`` without
2020
any intermediate coordinate conversion.
2121
22-
See also :ref:`sphx_glr_gallery_02_stack_mesh_mixin_p04_fieldlines.py` for a
22+
See also :ref:`sphx_glr_gallery_02_stack_mesh_mixin_p03_fieldlines.py` for a
2323
general introduction to fieldline rendering, and
2424
:ref:`sphx_glr_gallery_99_advanced_plots_p01_combining_multiple_elements.py` for a
2525
broader scene that layers slices, contours, and fieldlines.

0 commit comments

Comments
 (0)