Data visualization in VH diagram.

class posydon.visualization.VH_diagram.Presenter.Presenter(filename, path='./', binary=False)[source]

Bases: object

Charged to setup window and format data before calling display funcs.

Initialize a Presenter instance.

PATH_TO_DRAWS = '/Users/max/Documents/POSYDON/posydon/visualization/VH_diagram/draws'
PATH_TO_SCREENS = '/Users/max/Documents/POSYDON_versions/POSYDON_v1.0.4/docs/screens'
close()[source]

Close the window.

present(index, mode=PresenterMode.DETAILED)[source]

Preset the binary.

screen()[source]

Take a screen of the displayed window.

class posydon.visualization.VH_diagram.Presenter.SimplifiedInfo(state_before=None, state_after=None)[source]

Bases: object

Simple class to store an before/after info and simplfy dataframe.

Parameters
  • state_before (any value) – Value for the older state.

  • state_after (any value) – Value for the younger state.

state_before
state_after

Initialize a SimplifiedInfo instance.

posydon.visualization.VH_diagram.Presenter.calculate_separation(data)[source]

For each row in dataframe, calculate the separation.

Parameters

data (pandas.DataFrame) – Complete dataframe without ‘separation’.

Returns

Array of calculated separations, len(array) == nb rows.

Return type

Array of float

posydon.visualization.VH_diagram.Presenter.combine_simplified_data(*, data_to, data_from)[source]

Combine 2 dictionaries of SimplifiedInfo.

data_to[].state_after take the value of data_from[].state_before.

Parameters
  • data_to (dictionary of SimplifiedInfo) – Informations who will be udpated.

  • data_from (dictionary of SimplifiedInfo) – Informations who will be combined.

posydon.visualization.VH_diagram.Presenter.equal_with_epsilon(nb_1, nb_2, epsilon)[source]

Check if 2 numbers are equal up to epsilon.

Parameters
  • nb_1 (int, float, double) – Value 1 to compare.

  • nb_2 (int, float, double) – Value 2 compare.

  • epsilon (int, float, double) – Difference allowed.

Returns

True if numbers are equal up to epsilon, False if not.

Return type

bool

posydon.visualization.VH_diagram.Presenter.file_exist(filename)[source]

Check if file exists.

posydon.visualization.VH_diagram.Presenter.get_event_state_filename(left_star_state, event_state, right_star_state, *, suffix='')[source]

Get the name of the file illustrating the event with the 2 given star.

Parameters
  • left_star_state (str) – State’s name of the left star.

  • event_state (str) – State’s name of the event.

  • right_star_state (type) – State’s name of the right star.

Returns

Name of the file illustrating this complete state.

Return type

str

posydon.visualization.VH_diagram.Presenter.get_max_distance(data)[source]

Get max distance from a dictionary of SimplifiedInfo.

Parameters

data (dictionnary of SimplifiedInfo) – Dictionnary, full of SimplifiedInfo, containing all infos

Returns

Max distance of this row, accroding to before/after state

Return type

float

posydon.visualization.VH_diagram.Presenter.get_star_state_filename(state, *, suffix='')[source]

Get the name of the file illustring the state of one star.

Parameters

state (str) – State name of the star.

Returns

Name of the file illustrating this state.

Return type

str

posydon.visualization.VH_diagram.Presenter.to_megayears(nb)[source]

Convert yr to Myr.

posydon.visualization.VH_diagram.Presenter.to_simplified_data(row)[source]

Convert dictionnary of SimplifiedInfo with values as .state_before.

Parameters

row (dictionnary) – Dictionnary of value to convert.

Returns

Dictionnary of SimplifiedInfo containing the value as SimplifiedInfo.state_before.

Return type

dictionnary of SimplifiedInfo