def calcFreq(amt, total, oneForUndef=False):
    """calculates a frequency or rate. Return the total is zero
     return zero, or one if oneForUndef is True """
    if total == 0.0:
        return 1.0 if oneForUndef else 0.0
    else:
        return amt / total