spotter.viz#

Visualization utilities for spherical maps and stellar surfaces.

This module provides functions for plotting HEALPix maps, graticules, and generating videos of rotating stars.

Functions#

lon_lat_lines([n, pts, radius])

Generate latitude and longitude lines on a sphere.

rotation(inc, obl, theta)

Compute the rotation for given inclination, obliquity, and phase.

rotate_lines(lines, inc, obl, theta)

Rotate lines by given inclination, obliquity, and phase.

plot_lines(lines[, axis, ax])

Plot lines on a matplotlib axis.

graticule(inc[, obl, theta, pts, radius, n, ax])

Plot a graticule (latitude/longitude grid) on a sphere.

show(y[, inc, obl, u, xsize, phase, ax, radius, ...])

Show a rendered map with graticule.

video(y[, inc, obl, u, duration, fps, radius, period, rv])

Create an HTML video of a rotating map (for Jupyter notebooks).

Module Contents#

spotter.viz.lon_lat_lines(n: int = 6, pts: int = 100, radius: float = 1.0)[source]#

Generate latitude and longitude lines on a sphere.

Parameters:
  • n (int or tuple, optional) – Number of latitude lines (and longitude lines if tuple).

  • pts (int, optional) – Number of points per line.

  • radius (float, optional) – Sphere radius.

Returns:

  • lat (ndarray) – Latitude lines.

  • lon (ndarray) – Longitude lines.

spotter.viz.rotation(inc, obl, theta)[source]#

Compute the rotation for given inclination, obliquity, and phase.

Parameters:
  • inc (float) – Inclination in radians.

  • obl (float) – Obliquity in radians.

  • theta (float) – Rotation phase in radians.

Returns:

R – Rotation object.

Return type:

scipy.spatial.transform.Rotation

spotter.viz.rotate_lines(lines, inc, obl, theta)[source]#

Rotate lines by given inclination, obliquity, and phase.

Parameters:
  • lines (ndarray) – Input lines.

  • inc (float) – Inclination in radians.

  • obl (float) – Obliquity in radians.

  • theta (float) – Rotation phase in radians.

Returns:

rotated_lines – Rotated lines.

Return type:

ndarray

spotter.viz.plot_lines(lines, axis=(0, 1), ax=None, **kwargs)[source]#

Plot lines on a matplotlib axis.

Parameters:
  • lines (ndarray) – Lines to plot.

  • axis (tuple, optional) – Axes to plot (default (0, 1)).

  • ax (matplotlib axis, optional) – Axis to plot on.

  • **kwargs – Additional plot arguments.

spotter.viz.graticule(inc: float, obl: float = 0.0, theta: float = 0.0, pts: int = 100, radius: float = 1.0, n=6, ax=None, **kwargs)[source]#

Plot a graticule (latitude/longitude grid) on a sphere.

Parameters:
  • inc (float) – Inclination in radians.

  • obl (float, optional) – Obliquity in radians.

  • theta (float, optional) – Rotation phase in radians.

  • pts (int, optional) – Number of points per line.

  • radius (float, optional) – Sphere radius.

  • n (int or tuple, optional) – Number of latitude/longitude lines.

  • ax (matplotlib axis, optional) – Axis to plot on.

  • **kwargs – Additional plot arguments.

spotter.viz.show(y, inc=np.pi / 2, obl=0.0, u=None, xsize=800, phase=0.0, ax=None, radius=None, period=None, rv=False, **kwargs)[source]#

Show a rendered map with graticule.

Parameters:
  • y (array_like) – HEALPix map.

  • inc (float, optional) – Inclination in radians.

  • obl (float, optional) – Obliquity in radians.

  • u (array_like or None, optional) – Limb darkening coefficients.

  • xsize (int, optional) – Output image size.

  • phase (float, optional) – Rotation phase in radians.

  • ax (matplotlib axis, optional) – Axis to plot on.

  • **kwargs – Additional plot arguments.

spotter.viz.video(y, inc=None, obl=0.0, u=None, duration=4, fps=10, radius=None, period=None, rv=False, **kwargs)[source]#

Create an HTML video of a rotating map (for Jupyter notebooks).

Parameters:
  • y (array_like) – HEALPix map.

  • inc (float, optional) – Inclination in radians.

  • obl (float, optional) – Obliquity in radians.

  • u (array_like or None, optional) – Limb darkening coefficients.

  • duration (int, optional) – Duration of the video in seconds.

  • fps (int, optional) – Frames per second.

  • render_fun (callable, optional) – A function of phase that renders the star. Default is core.render

  • **kwargs – Additional plot arguments.

Return type:

None