def calcChiSquared(params):
    global function
    global x
    global y
    global y_err
    return np.sum((((y - functions[function].func(x, *params)) / y_err) ** 2))
def calcChiSquared(params):
    global function
    global x
    global y
    global y_err
    return np.sum((((y - functions[function].func(x, *params)) / y_err) ** 2))