heros.datasource.observables
============================

.. py:module:: heros.datasource.observables


Classes
-------

.. autoapisummary::

   heros.datasource.observables.BoundaryChecker
   heros.datasource.observables.Converter
   heros.datasource.observables.Observable
   heros.datasource.observables.ObservableProcessor


Functions
---------

.. autoapisummary::

   heros.datasource.observables.lambdify


Module Contents
---------------

.. py:function:: lambdify(expression: str, globals_dict: dict | None = None)

   Turn a string into a lambda function with the given globals.
   By default it enables a set of numpy functions in the expression. Further functions can be added by providing
   it in ``globals_dict``.


.. py:class:: BoundaryChecker(boundaries: list)

   Check whether the observed value is in it's boundaries.
   Therefore provide an integer feedback with rising importance where boundary = 0 says that everything is fine.
   1, 2, 3 correspond to higher warning / error or fault situations.



   .. py:attribute:: boundaries


   .. py:method:: _check_bounds(value)


   .. py:method:: __call__(return_value: heros.datasource.types.DatasourceReturnValue)


.. py:class:: Converter(conversion_code: str, unit: Optional[str] = None)

   .. py:attribute:: _conversion_code


   .. py:attribute:: _convert_lambda


   .. py:attribute:: _unit
      :value: None



   .. py:method:: __call__(return_value: heros.datasource.types.DatasourceReturnValue)


.. py:class:: Observable(id, definition: dict)

   .. py:attribute:: _id


   .. py:attribute:: definition


   .. py:attribute:: _boundary_checker


   .. py:attribute:: _converter


   .. py:property:: id


   .. py:method:: process(return_value: heros.datasource.types.DatasourceReturnValue)


.. py:class:: ObservableProcessor(obs_def: dict)

   An ObservableProcessor takes a configuration dict for multiple observables when it is instantiated.
   An object of this class can be called with a :class:DataSourceReturnSet as an argument.


   .. py:attribute:: observables


   .. py:attribute:: observables_ids


   .. py:method:: __call__(datasource_return_set)


