Skip to main content

Realistic stellar photometry and spectroscopy simulation package

Project description

Dynamo

Towards realistic stellar obserables

Example

Dynamo is a Python package for simulating stellar light curves and spectra, combining detailed models of stellar evolution, surface activity, planetary transits, and noise. It is based on several exisiting open-source projects that were modified and combined to create stronger link between stellar evolution and stellar observables.

Features

  • Stellar Surface Simulation: Models the emergence and evolution of star spots and active regions using configurable activity cycles, latitude distributions, and spot evolution laws. This part is based on the Butterpy package.
  • Grid-based lightcurve and spectra: Generates synthetic spectra and light curves, including the effects of limb darkening, rotational broadening and spot evolution. This is done in a grid approach and motivated by the Starsim package.
  • Stellar Evolution Parameters: Interpolates stellar parameters (e.g., mass, radius, temperature, luminosity) from evolutionary models. To get stellar evolution parameters we use kiauhoku package.

Using Dynamo we can easily link between stellar evolution parameters (Temperature, mass, logg, etc.) and magnetic-driven spots. Such connection enable the creation of simulated light curve and spectra of the same star, which can serve as a simulated dataset for multi-modal machine learning models for example.


Installation

  1. Clone the repository:

    git clone https://github.com/IlayMalinyak/Dynamo.git
    cd Dynamo
    
  2. Install dependencies:

    pip install -r requirements.txt
    

Usage

Simulating a Star

You can configure and run a stellar simulation by editing the starsim.conf file and using the main classes in the Dynamo package. Example:

from Dynamo.star import Star

# Initialize a star from configuration
star = Star(conf_file_path='starsim.conf')

# Set up simulation times and wavelength grid
import numpy as np
times = np.linspace(0, 30, 1000)  # 30 days, 1000 points
wavelengths = np.linspace(4000, 9500, 1000)  # Angstroms

# generate spots map
sm.generate_spot_map(ndays=1000)
# Run the forward simulation
star.compute_forward(t=times, wv_array=wavelengths)

# Access results (e.g., light curve, spectra)
# star.results, star.spot_map, etc.

Example: Generating a Dataset of Light Curves and Spectra

You can generate a full dataset of physically-consistent light curves and spectra using the script dataset/create_data.py. This script samples stellar parameters, simulates surface activity, and produces time series and spectra for each synthetic star. Note-in dataset/create_data.py we assume some priors that might be non-trivial (for example age-activity and spot-activity relationships). You might want to edit them for your use case

Command-Line Usage

python dataset/create_data.py \
    --models_root /path/to/stellar/models \
    --dataset_dir dataset \
    --plot_dir images \
    --plot_every 100 \
    --num_simulations 1000 \
    --ndays 1000 \
    --n_cpu 4

this would create 1000 simulations of 1000 days each. The arguments are:

  • --models_root: Path to the directory containing stellar evolution models.
  • --dataset_dir: Output directory for the generated dataset (default: dataset).
  • --plot_dir: Directory to save diagnostic plots (default: images).
  • --plot_every: Save a plot every N simulations (default: 100).
  • --num_simulations: Number of stars (light curves/spectra) to generate (default: 1000).
  • --ndays: Number of days to simulate for each light curve (default: 1000).
  • --n_cpu: Number of CPU cores to use for parallel processing (default: 1).

Configuration

Simulation parameters are controlled via the starsim.conf file, which includes sections for:

  • Stellar properties (mass, radius, temperature, rotation, etc.)
  • Spot and faculae properties
  • Limb darkening
  • Planetary parameters
  • Noise characteristics

See the comments in starsim.conf for detailed descriptions of each parameter.

License

This project is licensed under the MIT License. See LICENSE for details.

Acknowledgments


Contact

ilay.kamai@campus.technion.ac.il

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

dynamo_stellar-0.1.0.tar.gz (38.5 kB view details)

Uploaded Source

Built Distribution

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

dynamo_stellar-0.1.0-py3-none-any.whl (42.7 kB view details)

Uploaded Python 3

File details

Details for the file dynamo_stellar-0.1.0.tar.gz.

File metadata

  • Download URL: dynamo_stellar-0.1.0.tar.gz
  • Upload date:
  • Size: 38.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for dynamo_stellar-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2901e31a88b4e9367e6eec141f5bc078fac0e04f4ef9840e990313d1d73dc8df
MD5 7c94b1a378e2631ef10a43e2e7c52edf
BLAKE2b-256 018ed9ccbbc89d4a53e001c37c4cf97a22207aaa67b4166023cfb0d16cb64fd2

See more details on using hashes here.

File details

Details for the file dynamo_stellar-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dynamo_stellar-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 42.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for dynamo_stellar-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a99ef5e207b46b890e06c1ae9051b0f9e5ed81dc1cc1eaa75490af7783639e31
MD5 7d853deebda8693e1865e7847f0b5d5a
BLAKE2b-256 63c43f0d10fd9202cb0e40632ae10f78728691edc6ff99421ab69ecc70c55877

See more details on using hashes here.

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