Skip to content

Your Python Code

lichtgestalter edited this page Apr 24, 2025 · 23 revisions

Using CurveSimulator in Your Python Code

Quick Start

from curvesimulator import curvesim
curvesim("MyFirstConfigFile.ini")

This script:

  • Reads the configuration file, where the behavior of the program is defined
  • Simulates the motions of celestial bodies
  • Generates a video displaying the moving bodies and the resulting light curve
  • Saves transit events and other results in a JSON file

Advanced Usage

For more detailed analysis of simulation results, use the following code:

from curvesimulator import curvesim
parameters, bodies, results, lightcurve = curvesim("MyFirstConfigFile.ini")
print(parameters)
print(bodies)
print(results)
print(lightcurve)

parameters contains configuration settings (excluding celestial body parameters).

bodies holds celestial body parameters from the configuration file and calculated attributes. The bodies[n].positions attribute stores all 3D
positions calculated during the simulation for each body (where n is the
zero-based index of the body).

results contains all program parameters, star system parameters and transit data (transit times, impact parameters, ...). The content of results will be stored in the results file, which is specified in the configuration file.

lightcurve.array contains all brightness values calculated during the simulation.

Printing these objects provides just basic information. For a comprehensive view of the available data, if you like programming a lot, use a debugger to inspect the objects in detail or else use the saved results file.

Clone this wiki locally