Module for computing termination flags of MESA runs.

There are four flags:

Flag 1: Indicates why the run terminated. Flag 2: Denotes the mass transfer phase(s) the system has gone through. Flag 3: Marks the evolutionary stage of the primary star. Flag 4: Marks the evolutionary stage of the seconary star.

The funtion get_flags_from_MESA_run is responsible for getting all flags for a run, using the more specialized functions defined in the module.

posydon.grids.termination_flags.check_state_from_history(history, mass, model_index=- 1)[source]

Return the final state of the star from the star history data.

Parameters
  • history (np.array) – MESA history of the star

  • model_index (int) – Index of the model in history for which the state will be computed. By default it is the end of the evolution (last model).

Returns

state – The state of the star.

Return type

str

posydon.grids.termination_flags.get_flag_from_MESA_output(MESA_log_path)[source]

Return a flag about evolutionary outcome based on MESA output file.

Parameters

MESA_log_path (string) – The output file of MESA.

Returns

The termination flag inferred from the last line containing the strings min_timestep_limit, or termination code:, or Terminate:.

Return type

str

posydon.grids.termination_flags.get_flags_from_MESA_run(MESA_log_path, binary_history=None, history1=None, history2=None, start_at_RLO=False)[source]

Return the four termination flags.

Parameters
  • MESA_log_path (str) – path to the MESA terminal output

  • binary_history (np.array) – MESA output histories.

  • history1 (np.array) – MESA output histories.

  • history2 (np.array) – MESA output histories.

Returns

flag_MESAout, flag_mass_transfer, final_state_1, final_state_2 – flag_MESAout: actual line of MESA terminal output_path flag_mass_transfer: describes the mass transfer (e.g., case A, case B). final_state_1, final_state_2: describe the final evolutionary

state of the two stars. None if history star is not provided.

Return type

str

posydon.grids.termination_flags.get_mass_transfer_flag(binary_history, history1, history2, start_at_RLO=False, mesa_flag=None)[source]

Read flag from MESA history.

In case of contact during MS, RLOF1, RLOF2 or no_RLOF.

Parameters
  • binary_history (np.array) – The binary history file of MESA. Can also be the history of star 1 or 2 if binary history columns.

  • history1 (np.array) – The history file of MESA for star1.

  • history2 (np.array) – The history file of MESA for star2.

Returns

flag_system_evolution_history – Possible flags are: “contact during MS”, “no_RLOF”, a cumulative MT flag + “_from_star1/2”, or in case of missing binary history data, “undetermined_flag_mass_transfer_with_no_binary_history”.

Return type

string

posydon.grids.termination_flags.infer_interpolation_class(tf1, tf2)[source]

Use the first two termination flags to infer the interpolation class.

posydon.grids.termination_flags.initial_RLO_fix_applies(mass, period)[source]

Check if initial RLO fix is warranted given the initial mass and period.

Parameters
  • mass (float) – Mass of star 1.

  • period (float) – Binary’s period (in days).

Returns

True if initial RLO flag should be forced.

Return type

bool