The binary object describes current and past state of the binary.
The binary object is composed of two star objects and contains the current and past states of the binary. Only parameters in the BINARYPROPERTIES list are stored in the history.
The current parameter value of the star object is accessed as, e.g. binary.orbital_period while its past history with binary.orbital_period_history.
The two stars are accessed as, e.g. binary.star_1.mass while their past history with binary.star_1.mass_history.
- class posydon.binary_evol.binarystar.BinaryStar(star_1=None, star_2=None, index=None, properties=None, **binary_kwargs)[source]
Bases:
object
A class containing the state and history of a stellar binary.
Initialize a binary star.
- Parameters
properties (SimulationProperties) – Instance of the SimulationProperties class (default: None)
star_1 (SingleStar) – The first star of the binary.
star_2 (Star) – The second star of the binary.
**binary_kwargs (dictionary) – List of initialization parameters for a binary
- classmethod from_df(dataframe, **kwargs)[source]
Convert a binary from a pandas DataFrame to BinaryStar instance.
- classmethod from_oneline_df(oneline_df, **kwargs)[source]
Convert a oneline DataFrame into a BinaryStar.
The oneline DataFrame is expected to have initial-final values from history and any individual values that don’t have histories.
- static from_run(run, history=False, profiles=False)[source]
Create a BinaryStar object from a PSyGrid run.
- reset(properties=None)[source]
Reset the binary to its ZAMS state.
- Parameters
properties (SimulationProperties) – Instance of the SimulationProperties class (default: None)
- restore(i=0, delete_history=True)[source]
Restore the object to the i-th state.
- Parameters
i (int) – The index of the binary object history to reset the binary to. By default 0, i.e. the star will be restored to its initial state.
- to_df(**kwargs)[source]
Return history parameters from the binary in a DataFrame.
Includes star 1 and 2 (S1, S2) data and an extra column ‘binary_index’.
- Parameters
extra_columns (list) – Extra binary parameters to return in DataFrame that are not included in BINARYPROPERTIES. Can be used in combination with only_select_columns. Assumes names have no suffix.
ignore_columns (list) – Names of binary parameters to ignore. Assumes names have _history suffix.
only_select_columns (list) – Names of the only columns to include. Assumes names have _history suffix. Can be used in combination with extra_columns.
null_value (float) – Replace all None values with something else (for saving). Default is np.NAN.
include_S1 (bool) – Choose to include star 1 or 2 data to the DataFrame. The default is to include both.
include_S2 (bool) – Choose to include star 1 or 2 data to the DataFrame. The default is to include both.
S1_kwargs (dict) – kwargs to pass to each star’s ‘to_df’ method (extra/ignore columns)
S2_kwargs (dict) – kwargs to pass to each star’s ‘to_df’ method (extra/ignore columns)
- Returns
- Return type
pandas DataFrame