def ni_to_hr(ni, f):
    """Calculate heart rate in beat/min from estimated interval length

    Args:
        ni (int): estimated inter-beat interval length
        f (float): in Hz; sampling rate of input signal

    Returns:
        float: heart rate in beat/min
    """
    if ni == -1:
        return -1
    return 60. * f / ni