Sets the default kind of DataFrame for the functions that create one from a system: simulate_system and get_bodies. Both also take a backend argument that overrides the default for a single call. The setting lasts for the rest of the Python session.
Functions that are given a DataFrame (the analysis functions, continue_simulation) ignore this setting and return the same kind they were given. A polars LazyFrame is collected, and a polars DataFrame comes back.
Parameters
Name
Type
Description
Default
backend
str
"pandas" or "polars". pyorbiter starts with "pandas".
required
Returns
Name
Type
Description
None
Called for its side effect.
Raises
Name
Type
Description
ValueError
If backend is not "pandas" or "polars".
ImportError
If backend is "polars" and polars is not installed. The default is left unchanged. Install it with pip install polars.
See Also
get_backend: See which library is the current default.
simulate_system: Takes a backend argument for a single call.
run_settings: Read the settings of a run from either kind of DataFrame.
Examples
Switch to polars, simulate, and switch back.
import pyorbiter as orborb.set_backend("polars")sim = orb.create_system().add_sun().add_planet("Earth", parent="Sun").simulate( time_step=orb.seconds_per_day, duration=30* orb.seconds_per_day)orb.set_backend("pandas")sim.head()