functions module

format_timespan(start, end)

Formats the elapsed time between two time points into a human-readable string.

Parameters:
  • start (int | float) – Start time in seconds, typically as a timestamp or relative value.

  • end (int | float) – End time in seconds, typically as a timestamp or relative value.

Returns:

A formatted string representing the elapsed time between start and end. The format is “MM:SS.sss (sss ms)”, where: - MM is minutes, zero-padded to 2 digits. - SS.sss is seconds with 2 decimal places. - sss ms represents milliseconds.

Return type:

str

Raises:

ValueError – If start is greater than end.

hb_method(data, p_c, p_u, p_a, id_field_name='id', x_1_field_name='x1', x_2_field_name='x2')

Runs the Hb method from the R package Kostra.

Parameters:
  • data (DataFrame) – The data to run the method on

  • p_c (int) – The value of pC

  • p_u (float) – The value of pU

  • p_a (float) – The value of pA

  • id_field_name (str) – The name of the id field

  • x_1_field_name (str) – The name of the first x field

  • x_2_field_name (str) – The name of the second x field

Return type:

DataFrame

Returns:

The result of the method

sidebar_button(icon, text, component_id, additional_styling=None)

Generate a sidebar button with an icon and label.

Parameters:
  • icon (str) – The icon displayed at the top of the button.

  • text (str) – The label text displayed below the icon.

  • component_id (str) – The ID assigned to the button component.

  • additional_styling (dict, optional) – Additional styling applied to the button. Defaults to an empty dictionary.

Returns:

A Div containing the styled button.

Return type:

html.Div

th_error(data, id_field_name, x_1_field_name, x_2_field_name)

Runs the ThError method from the R package Kostra.

Parameters:
  • data (DataFrame) – The data to run the method on

  • id_field_name (str) – The name of the id field

  • x_1_field_name (str) – The name of the first x field

  • x_2_field_name (str) – The name of the second x field

Return type:

DataFrame

Returns:

The result of the method