Skip to main content

No project description provided

Project description

spice logo

SPICE: SPectral Integration Compiled Engine

A comprehensive Python library for modeling and analyzing stellar spectra with inhomogeneous surfaces, supporting rotation, pulsations, spots, and binary star systems.

Installation

Install from PyPI:

pip install stellar-spice

For PHOEBE integration support:

pip install stellar-spice[phoebe]

Documentation

📖 Read the full documentation for detailed API reference and tutorials.

Key Features

🌟 Stellar Surface Modeling

  • Mesh-based stellar surfaces using icosphere discretization
  • Inhomogeneous temperature distributions across stellar surfaces
  • Surface gravity variations accounting for rotation and shape distortions
  • Line-of-sight velocity calculations for Doppler shift effects

🔄 Stellar Rotation

  • Differential rotation modeling with customizable rotation laws
  • Rotational broadening effects on spectral lines
  • Surface velocity field calculations
  • Time-dependent spectral variations due to rotation

🌊 Stellar Pulsations

  • Spherical harmonic pulsation modes (l, m modes)
  • Fourier series parameterization for complex pulsation patterns
  • Multi-mode pulsations with different periods and amplitudes
  • Surface displacement and velocity calculations

🌑 Stellar Spots

  • Spherical harmonic spot modeling for complex spot distributions
  • Temperature contrast between spots and photosphere
  • Time-evolving spot patterns
  • Spot-induced spectral variations

Binary Star Systems

  • Full orbital dynamics with Keplerian orbits
  • Mutual eclipses and occultations
  • Roche lobe geometry for close binaries
  • Tidal distortion effects
  • PHOEBE integration for advanced binary modeling

📊 Spectral Synthesis

  • Blackbody radiation for basic stellar modeling
  • ATLAS9 model atmospheres for realistic stellar spectra
  • Transformer-Payne integration for ML-based spectral synthesis
  • Custom spectral models support

🔍 Synthetic Photometry

  • Multiple passband support (Johnson, Stromgren, Gaia, etc.)
  • AB magnitude system calculations
  • Bolometric luminosity computations
  • Time-series photometry for variable stars

🎯 Advanced Features

  • JAX-based computations for fast, differentiable calculations
  • GPU acceleration support
  • 3D visualization of stellar surfaces and binary systems
  • Animation capabilities for time-evolving systems
  • Occlusion handling for complex geometries

Quick Start

Basic Stellar Model

import numpy as np
from spice.models import IcosphereModel
from spice.spectrum import simulate_observed_flux
from spice.spectrum.planck_law import Blackbody

# Create a solar-like star
star = IcosphereModel.construct(
    subdivisions=500,  # Mesh resolution
    radius=1.0,        # Solar radii
    mass=1.0,          # Solar masses
    parameters=Blackbody().solar_parameters,
    parameter_names=Blackbody().parameter_names
)

# Add rotation
star = star.add_rotation(period=25.0)  # 25-day rotation period

# Generate spectrum
wavelengths = np.logspace(3, 4, 1000)  # 1000-10000 Å
spectrum = simulate_observed_flux(Blackbody().intensity, star, wavelengths)

Binary Star System

from spice.models import Binary, add_orbit
from spice.spectrum.filter import GaiaG

# Create binary components
primary = IcosphereModel.construct(500, 1.0, 1.0, bb.solar_parameters, bb.parameter_names)
secondary = IcosphereModel.construct(500, 0.8, 0.8, bb.solar_parameters, bb.parameter_names)

# Create binary system
binary = Binary.from_bodies(primary, secondary)

# Add orbital parameters
binary = add_orbit(
    binary,
    P=1.0,      # 1-year period
    ecc=0.1,    # 10% eccentricity
    i=np.pi/3,  # 60° inclination
    # ... other orbital elements
)

# Calculate light curve
times = np.linspace(0, 1, 100)
light_curve = []
for t in times:
    p1, p2 = evaluate_orbit_at_times(binary, t)
    flux = simulate_observed_flux(bb.intensity, p1, wavelengths) + \
           simulate_observed_flux(bb.intensity, p2, wavelengths)
    light_curve.append(AB_passband_luminosity(GaiaG(), wavelengths, flux))

PHOEBE Integration

import phoebe
from spice.models import PhoebeBinary

# Create PHOEBE binary
b = phoebe.default_binary()
# ... set up PHOEBE parameters

# Convert to SPICE format
pb = PhoebeBinary.construct(b, parameter_names, parameter_values)

# Use SPICE for spectral calculations
spectrum = simulate_observed_flux(intensity_function, pb, wavelengths)

Performance

  • JAX-powered computations for fast, vectorized operations
  • GPU acceleration support for large-scale calculations
  • Efficient mesh operations with optimized occlusion algorithms
  • Memory-efficient spectral synthesis for time-series data

Citation

If you use stellar-spice in your research, please cite:

@article{spice,
  title={SPICE - software for modelling synthetic spectra of stars with
non-homogenous surfaces},
  author={Jabłońska, M. et al.},
  journal={In preparation},
  year={2025}
}

Contributing

We welcome contributions! Please see our contributing guidelines for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with JAX for fast, differentiable computations
  • Integrates with PHOEBE for binary star modeling
  • Uses Transformer-Payne for ML-based spectral synthesis

Paper currently in preparation - Check back for the full scientific publication!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stellar_spice-1.6.1.tar.gz (633.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stellar_spice-1.6.1-py3-none-any.whl (637.3 kB view details)

Uploaded Python 3

File details

Details for the file stellar_spice-1.6.1.tar.gz.

File metadata

  • Download URL: stellar_spice-1.6.1.tar.gz
  • Upload date:
  • Size: 633.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stellar_spice-1.6.1.tar.gz
Algorithm Hash digest
SHA256 43fc939b898c6f6198fb85965810ae9791414a6ca48de0dff90c83a2142a7622
MD5 c330a5e4150bcd3a3a00df8eb3ea77e9
BLAKE2b-256 b8baaa6c31e4f75d969ddaf9e1d692efd14908d76301de82d10a6b02b86cfc35

See more details on using hashes here.

Provenance

The following attestation bundles were made for stellar_spice-1.6.1.tar.gz:

Publisher: release.yml on maja-jablonska/spice

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stellar_spice-1.6.1-py3-none-any.whl.

File metadata

  • Download URL: stellar_spice-1.6.1-py3-none-any.whl
  • Upload date:
  • Size: 637.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stellar_spice-1.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 de6574006856a457c4d7752c17c93eb0e3d42c7f6a628ec8c6f3ff7662e892e2
MD5 21a122fe6a6a6ef078758b8e5729534d
BLAKE2b-256 805654615ad9f505c25e7d88410f1e01d3c8ac5ebc1324f9476789bc2f85b2fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for stellar_spice-1.6.1-py3-none-any.whl:

Publisher: release.yml on maja-jablonska/spice

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page