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#
A Star object whose surface is described by HEALPix map(s). |
Functions#
|
Show the star map. If star.y is 2D, the first map is shown. |
|
Create an HTML video of the star map (for Jupyter notebooks). |
|
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.ModuleA 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.
- u[source]#
Polynomial limb darkening coefficients with shape (wavelengths, order).
- Type:
ArrayLike 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
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)
- u: jax.typing.ArrayLike | None = None[source]#
Polynomial limb darkening coefficients with shape (wavelengths, order).
- 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.
- __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:
- 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:
- 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
- set(**kwargs)[source]#
Return a Star object with updated attributes.
- Parameters:
**kwargs – Attributes to update.
- Returns:
Star object with updated attributes.
- Return type:
- 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
- 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: