sherlockpipe.system_stability.megno.MegnoStabilityCalculator
- class sherlockpipe.system_stability.megno.MegnoStabilityCalculator(years, dt, repetitions)
Bases:
StabilityCalculatorRuns the stability computations by calculating the MEGNO score.
- __init__(years, dt, repetitions)
Initialize the MEGNO-based stability calculator.
Parameters
- yearsfloat
Maximum integration time in years.
- dtfloat
Fraction of the minimum orbital period used as the integration timestep.
- repetitionsint
Number of simulation repetitions per scenario.
Methods
__init__(years, dt, repetitions)Initialize the MEGNO-based stability calculator.
init_rebound_simulation(simulation_input)Initializes the simulation for rebound-based algorithms
log_and_run_simulation(simulation_input)Logs the simulation input and launches the simulation for the given input.
mass_from_radius(radius)Computation of mass-radius relationship from Bashi D., Helled R., Zucker S., Mordasini C., 2017, A&A, 604, A83.
plot_simulation(simulation_input_df, ...[, ...])Generate an orbit plot for a single simulation scenario row.
prepare_planet_params(planet_params)Fills the planet masses if missing
prepare_star_masses(star_mass_low, ...)Creates a star masses grid
run(results_dir, star_mass_low, ...[, cpus, ...])Creates possible scenarios of stellar masses, planet masses and planet eccentricities.
run_simulation(simulation_input)Runs one simulation scenario using the megno module of rebound.
store_simulation_results(simulation_results, ...)Stores the megno results in the given directory
- init_rebound_simulation(simulation_input)
Initializes the simulation for rebound-based algorithms
- Parameters:
simulation_input – the input data for the simulation scenario
- Returns:
the rebound initialized simulation scenario
- log_and_run_simulation(simulation_input: SimulationInput) dict
Logs the simulation input and launches the simulation for the given input.
- Parameters:
simulation_input (SimulationInput)
- Return dict:
the resulting dictionary from the simulation
- static mass_from_radius(radius)
Computation of mass-radius relationship from Bashi D., Helled R., Zucker S., Mordasini C., 2017, A&A, 604, A83. doi:10.1051/0004-6361/201629922
- Parameters:
radius – the radius value in earth radius
- Returns:
the mass in earth masses
- plot_simulation(simulation_input_df, save_dir, scenario_name, xlim=None, ylim=None)
Generate an orbit plot for a single simulation scenario row.
Reads planet parameters from a DataFrame row, initializes a rebound simulation, integrates forward, and saves an orbit plot image.
Parameters
- simulation_input_dfpandas.Series
Series with keys ‘eccentricities’, ‘inclinations’, ‘arg_periastron’, ‘periods’, ‘masses’, and ‘star_mass’.
- save_dirstr
Directory where the plot image will be saved.
- scenario_namestr
Name used to construct the output filename.
- xlimtuple, optional
X-axis limits for the orbit plot.
- ylimtuple, optional
Y-axis limits for the orbit plot.
- static prepare_planet_params(planet_params: List[PlanetInput])
Fills the planet masses if missing
- Parameters:
planet_params – the planet inputs
- Returns:
the planet inputs with the filled masses
- static prepare_star_masses(star_mass_low, star_mass_up, star_mass_bins)
Creates a star masses grid
- Parameters:
star_mass_low – the lowest star mass value
star_mass_up – the highest star mass value
star_mass_bins – the number of star masses to sample. It will be ignored if star_mass_low == star_mass_up.
- Returns:
the star masses grid
- run(results_dir, star_mass_low, star_mass_up, star_mass_bins, planet_params: List[PlanetInput], cpus=1, free_params=None)
Creates possible scenarios of stellar masses, planet masses and planet eccentricities. Afterwards a stability analysis is run for each of the scenarios and the results are stored in a file.
- Parameters:
results_dir – the directory where the results will be written into
star_mass_low – the lowest star mass
star_mass_up – the highest star mass
star_mass_bins – the number of star masses to sample
planet_params (List[PlanetInput]) – the planet inputs containing the planets parameters
cpus – the number of cpus to be used
free_params – the parameters to be sampled entirely
- run_simulation(simulation_input: SimulationInput) dict
Runs one simulation scenario using the megno module of rebound.
- Parameters:
simulation_input (SimulationInput) – the scenario parameters
- Return dict:
the results of the simulation with the rebound-specific megno metric.
- store_simulation_results(simulation_results: List[Dict], results_dir: str)
Stores the megno results in the given directory
- Parameters:
simulation_results (List[Dict]) – the list of results dictionaries
results_dir (str) – directory to store the file