def _safe_db ( num , den ) : if den == 0 : return np . inf return 10 * np . log10 ( num / den )
how to type infinity in python
Properly handle the potential + Inf db SIR instead of raising a RuntimeWarning .
def _safe_db(num, den):
    """Properly handle the potential +Inf db SIR instead of raising a
    RuntimeWarning.
    """
    if den == 0:
        return np.inf
    return 10 * np.log10(num / den)