def det_cat_fct_init(thr, axis=None):
    """
    Initialize a contingency table object.

    Parameters
    ----------
    thr: float
        threshold that is applied to predictions and observations in order
        to define events vs no events (yes/no).
    axis: None or int or tuple of ints, optional
        Axis or axes along which a score is integrated. The default, axis=None,
        will integrate all of the elements of the input arrays.\n
        If axis is -1 (or any negative integer),
        the integration is not performed
        and scores are computed on all of the elements in the input arrays.\n
        If axis is a tuple of ints, the integration is performed on all of the
        axes specified in the tuple.

    Returns
    -------
    out: dict
      The contingency table object.
    """

    contab = {}

    # catch case of axis passed as integer
    def get_iterable(x):
        if x is None or (
            isinstance(x, collections.abc.Iterable) and not isinstance(x, int)
        ):
            return x
        else:
            return (x,)

    contab["thr"] = thr
    contab["axis"] = get_iterable(axis)
    contab["hits"] = None
    contab["false_alarms"] = None
    contab["misses"] = None
    contab["correct_negatives"] = None

    return contab
Initialize a contingency table object.

Parameters
----------
thr: float
threshold that is applied to predictions and observations in order
to define events vs no events (yes/no).
axis: None or int or tuple of ints, optional
Axis or axes along which a score is integrated. The default, axis=None,
will integrate all of the elements of the input arrays.\n
If axis is -1 (or any negative integer),
the integration is not performed
and scores are computed on all of the elements in the input arrays.\n
If axis is a tuple of ints, the integration is performed on all of the
axes specified in the tuple.

Returns
-------
out: dict
The contingency table object.
pysteps/verification/detcatscores.py