spotter.star#

Star object and related utilities for HEALPix-based stellar surface modeling.

Defines the Star class, which encapsulates a HEALPix map, limb darkening, orientation, and physical properties. Includes visualization and transit utilities.

Classes#

Star

A Star object whose surface is described by HEALPix map(s).

Functions#

show(star[, phase, ax, xsize, rv])

Show the star map. If star.y is 2D, the first map is shown.

video(star[, duration, fps, rv])

Create an HTML video of the star map (for Jupyter notebooks).

transited_star(star[, x, y, z, r, time])

Return a star transited by a circular opaque disk.

Module Contents#

class spotter.star.Star(y: jax.typing.ArrayLike | None = None, u: jax.typing.ArrayLike | None = None, inc: float | None = None, obl: float | None = None, period: float | None = None, radius: float | None = None, wv: float | None = None)[source]#

Bases: equinox.Module

A Star object whose surface is described by HEALPix map(s).

The HEALPix maps can be a 2D array with a shape of (wavelengths, pixels), or a 1D array with a shape of (pixels).

When providing polynomial limb darkening coefficients, different options are possible:

  • u is 1D and y is 1D: Single set of limb darkening coefficients and a single map.

  • u is 1D and y is 2D: The same limb darkening coefficients are applied to all wavelength maps.

  • u is 2D and y is 1D: The limb darkening coefficients are different for each wavelength but the map is the same.

  • u.shape[0] == y.shape[0]: u and y are 2D arrays specifying the limb darkening coeffs and maps for each wavelength.

Parameters:
  • y (ArrayLike or None, optional) – HEALPix map of the star, with shape (pixels,) or (wavelengths, pixels). Must be provided.

  • u (ArrayLike or None, optional) – Polynomial limb darkening coefficients with shape (order,) or (wavelengths, order). By default None. If provided, must either be coefficients applied to all wavelengths, or have the same length as y (i.e. defined for the same number of wavelengths).

  • inc (float or None, optional) – Inclination of the star, in radians. 0 is pole-on, pi/2 is equator-on. By default None.

  • obl (float or None, optional) – Obliquity of the star, in radians. 0 is no obliquity, pi/2 is maximum obliquity. By default None.

  • period (float or None, optional) – Period of the star, in days. By default None.

  • radius (float or None, optional) – Radius of the star, in solar radii. By default None.

  • wv (float or None, optional) – Wavelength of the star maps, in meters. By default None. If provided, must be compatible with either the shape of u and/or y.

y[source]#

HEALPix map of the star, with shape (wavelengths, pixels).

Type:

ArrayLike

u[source]#

Polynomial limb darkening coefficients with shape (wavelengths, order).

Type:

ArrayLike or None

period[source]#

Period of the star, in days.

Type:

float or None

inc[source]#

Inclination of the star, in radians. 0 is pole-on, pi/2 is equator-on.

Type:

float or None

obl[source]#

Obliquity of the star, in radians. 0 is no obliquity, pi/2 is maximum obliquity.

Type:

float or None

radius[source]#

Radius of the star, in solar radii.

Type:

float or None

wv[source]#

Wavelength of the star maps, in meters.

Type:

float or None

sides[source]#

Number of HEALPix sides.

Type:

int

Examples

import numpy as np
from spotter.star import Star, show

star = Star.from_sides(30, inc=0.5, u=(0.4, 0.3), obl=0.5)
show(star)
../../../_images/index-11.png
y: jax.typing.ArrayLike[source]#

HEALPix map of the star, with shape (wavelengths, pixels).

u: jax.typing.ArrayLike | None = None[source]#

Polynomial limb darkening coefficients with shape (wavelengths, order).

period: float | None = None[source]#

Period of the star, in days.

inc: float | None = None[source]#

Inclination of the star, in radians. 0 is pole-on, pi/2 is equator-on.

obl: float | None = None[source]#

Obliquity of the star, in radians. 0 is no obliquity, pi/2 is maximum obliquity.

radius: float | None = None[source]#

Radius of the star, in solar radii.

wv: float | None = None[source]#

Wavelength of the star maps, in meters.

sides: int[source]#

Number of HEALPix sides.

property N[source]#
Return the number of sides of the star map.
property x[source]#
Return the xyz coordinates of the star pixels.
property size[source]#
Return the number of pixels in the star map.
property resolution[source]#
Return the approximate size of a single map pixel in radians.
__getitem__(key)[source]#

Return a new Star with selected wavelength(s).

Parameters:

key (int, slice, or array_like) – Index or indices to select.

Returns:

New Star object with selected map(s).

Return type:

Star

classmethod from_sides(sides: int, **kwargs)[source]#

Create a Star object with a given number of sides.

Parameters:
  • sides (int) – Number of sides of the HEALPix map.

  • **kwargs – Additional keyword arguments for Star.

Returns:

Star object with the given number of sides.

Return type:

Star

phase(time: jax.typing.ArrayLike | None) jax.typing.ArrayLike[source]#

Compute the rotation phase for a given time.

Parameters:

time (array_like or None) – Time(s) in days.

Returns:

phase – Rotation phase(s) in radians.

Return type:

float or array_like

__mul__(other)[source]#

Multiply the star map by another Star or scalar.

Parameters:

other (Star or scalar) – Object to multiply with.

Returns:

Resulting Star object.

Return type:

Star

__rmul__(other)[source]#

Multiply the star map by another Star or scalar (right-mult).

Parameters:

other (Star or scalar) – Object to multiply with.

Returns:

Resulting Star object.

Return type:

Star

__add__(other)[source]#

Add another Star or scalar to the star map.

Parameters:

other (Star or scalar) – Object to add.

Returns:

Resulting Star object.

Return type:

Star

__radd__(other)[source]#

Add another Star or scalar to the star map (right-add).

Parameters:

other (Star or scalar) – Object to add.

Returns:

Resulting Star object.

Return type:

Star

__sub__(other)[source]#

Subtract another Star or scalar from the star map.

Parameters:

other (Star or scalar) – Object to subtract.

Returns:

Resulting Star object.

Return type:

Star

__rsub__(other)[source]#

Subtract the star map from another Star or scalar (right-sub).

Parameters:

other (Star or scalar) – Object to subtract from.

Returns:

Resulting Star object.

Return type:

Star

set(**kwargs)[source]#

Return a Star object with updated attributes.

Parameters:

**kwargs – Attributes to update.

Returns:

Star object with updated attributes.

Return type:

Star

spot(lat: float, lon: float, radius: float, sharpness: float = 20)[source]#

Return a HEALPix map with a spot.

Parameters:
  • lat (float) – Latitude of the spot, in radians.

  • lon (float) – Longitude of the spot, in radians.

  • radius (float) – Radius of the spot, in radians.

  • sharpness (float, optional) – Sharpness of the spot edge (default 20).

Returns:

HEALPix map with a spot.

Return type:

ArrayLike

property coords[source]#
Return the coordinates of the star pixels.
Returns:

coords – Cartesian coordinates of pixels.

Return type:

ndarray

spotter.star.show(star: Star, phase: jax.typing.ArrayLike = 0.0, ax=None, xsize=800, rv=False, **kwargs)[source]#

Show the star map. If star.y is 2D, the first map is shown.

Parameters:
  • star (Star) – Star object to show.

  • phase (ArrayLike, optional) – Phase of the star map to show (default 0.0).

  • ax (matplotlib axis, optional) – Axis to plot the star map (default None).

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

  • **kwargs – Additional keyword arguments for viz.show.

spotter.star.video(star: Star, duration: int = 4, fps: int = 10, rv=False, **kwargs)[source]#

Create an HTML video of the star map (for Jupyter notebooks).

Parameters:
  • star (Star) – Star object to show.

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

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

  • **kwargs – Additional keyword arguments for viz.video.

spotter.star.transited_star(star: Star, x: float = 0.0, y: float = 0.0, z: float = 0.0, r: float = 0.0, time: float = None)[source]#

Return a star transited by a circular opaque disk.

Parameters:
  • star (Star) – Star object to be transited.

  • x (float, optional) – x coordinate of the disk center (default 0.0).

  • y (float, optional) – y coordinate of the disk center (default 0.0).

  • z (float, optional) – z coordinate of the disk center (default 0.0).

  • r (float, optional) – Radius of the disk (default 0.0).

  • time (float, optional) – Time in days (default None).

Returns:

Star object transited by the disk.

Return type:

Star