probabilistic_model.utils
=========================

.. py:module:: probabilistic_model.utils


Classes
-------

.. autoapisummary::

   probabilistic_model.utils.MissingDict


Functions
---------

.. autoapisummary::

   probabilistic_model.utils.simple_interval_as_array
   probabilistic_model.utils.interval_as_array
   probabilistic_model.utils.timeit
   probabilistic_model.utils.timeit_print
   probabilistic_model.utils.neighbouring_points


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

.. py:function:: simple_interval_as_array(interval: random_events.interval.SimpleInterval) -> numpy.ndarray

   Convert a simple interval to a numpy array.
   :param interval:  The interval
   :return:  [lower, upper] as numpy array


.. py:function:: interval_as_array(interval: random_events.interval.Interval) -> numpy.ndarray

   Convert an interval to a numpy array.
   The resulting array has shape (n, 2) where n is the number of simple intervals in the interval.
   The first column contains the lower bounds and the second column the upper bounds of the simple intervals.
   :param interval: The interval
   :return:  as numpy array


.. py:class:: MissingDict

   Bases: :py:obj:`collections.defaultdict`


   A defaultdict that returns the default value when the key is missing and does **not** add the key to the dict.


   .. py:method:: __missing__(key)


.. py:function:: timeit(func)

   Decorator to measure the time a function takes to execute.


.. py:function:: timeit_print(func)

.. py:function:: neighbouring_points(point: float) -> numpy.array

   Embed the point in an array with the next left and next right point.

   :param point: The point.
   :return: The point and its two neighbours


