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

append_state()[source]

Update the history of the binaries’ properties.

evolve()[source]

Evolve a binary from start to finish.

classmethod from_df(dataframe, **kwargs)[source]

Convert a binary from a pandas DataFrame to BinaryStar instance.

Parameters
  • dataframe (Pandas DataFrame) – data to turn into a BinaryStar instance.

  • index (int, optional) – Sets the binary index.

  • extra_columns (list, optional) – Column names to be added directly to binary not in BINARYPROPERTIES.

Returns

Return type

New instance of BinaryStar

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.

Parameters
  • oneline_df (DataFrame) – A oneline DataFrame describing a binary.

  • index (int, None) – Binary index

  • extra_columns (list) – Names of any extra history columns not inlcuded in BINARYPROPERTIES

Returns

Return type

A new BinaryStar instance.

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.

run_step()[source]

Evolve the binary through one evolutionary step.

switch_star()[source]

Switch stars.

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

to_oneline_df(scalar_names=[], history=True, **kwargs)[source]

Convert binary into a single row DataFrame.

update_star_states()[source]

Update the states of the two stars in the binary.

posydon.binary_evol.binarystar.signal_handler(signum, frame)[source]

React to a maximum time signal.