Utilities

This section shows general objects and helper functions that are used with this package.

Note

This BalderHub project doesn’t have any utilities.

Optical Heart Beat Simulation

class balderhub.heart.lib.utils.optical_simulation.TkinterOpticalHeartBeatSimulation(position: tuple[int, int], size: tuple[int, int] = (200, 200), color_config: ColorConfiguration | None = None)

Bases: object

Simulator class that creates an own tkinter process to simulate heart beat behavior for optical sensors.

close_window() None

This method closes the window and stops the process

open_window() None

This method opens the window and starts the process

send_command(cmd: Command, timeout_sec: float = 10, **kwargs) Any

Method that sends commands to the graphical process :param cmd: command to send :param timeout_sec: timeout to wait for confirmation :return: returns the confirmation value

class balderhub.heart.lib.utils.optical_simulation.Command(value)

Bases: Enum

enum with all possible commands

class balderhub.heart.lib.utils.optical_simulation.ColorConfiguration

Bases: object

color configuration dataclass that can be adjusted to the requirements of the DUT

get_color(for_alpha: float) str

Returns the corresponding color for the given alpha value and based on the min/max values of the color configuration

Parameters:

for_alpha – current alpha value that should be applied

Returns:

the color string