Rounds a number rounded to a specific number of significant
    figures instead of to a specific precision.

def round_to_sigfigs(num, sigfigs):
    """
    Rounds a number rounded to a specific number of significant
    figures instead of to a specific precision.
    """
    if type(sigfigs) != int:
        raise TypeError("Number of significant figures must be integer.")
    elif sigfigs < 1:
        raise ValueError("Number of significant figures "
                         "must be larger than zero.")
    elif num == 0:
        return num
    else:
        prec = int(sigfigs - np.ceil(np.log10(np.absolute(num))))
        return round(num, prec)