@staticmethod
def fraction(val, base=np.pi, n=100, tol=1e-05):
    abs_val = abs(val)
    for i in range(1, n):
        for j in range(1, n):
            if math.isclose(abs_val, ((i / j) * base), rel_tol=tol):
                if (val < 0):
                    i *= (- 1)
                return fractions.Fraction(i, j)
    return None
@staticmethod
def fraction(val, base=np.pi, n=100, tol=1e-05):
    abs_val = abs(val)
    for i in range(1, n):
        for j in range(1, n):
            if math.isclose(abs_val, ((i / j) * base), rel_tol=tol):
                if (val < 0):
                    i *= (- 1)
                return fractions.Fraction(i, j)
    return None