"""
Module.
Examples
--------
"""
__author__ = "Yeremia Gunawan Adhisantoso"
__email__ = "adhisant@tnt.uni-hannover.de"
__license__ = "Clear BSD"
__version__ = "1.0.0"
import numpy as np
[docs]
def limit_count(
counts: np.ndarray,
min_val: int = None,
max_val: int = None,
) -> np.ndarray:
"""
Limit the maximum and minimum values of a matrix `counts`
if `min_val` is not None or/and `max_val` is not None.
Parameters
----------
counts : np.ndarray
Input numpy array.
min_val : int, optional
Minimum value to limit the array, by default None.
max_val : int, optional
Maximum value to limit the array, by default None.
Returns
-------
np.ndarray
Output numpy array with limited values.
Examples
--------
"""
# if min_val is not None:
# counts = np.maximum(counts, min_val)
# if max_val is not None:
# counts = np.minimum(counts, max_val)
counts = np.clip(counts, min_val, max_val)
return counts