def chisquare(y1, y2, yerr):
    """
    Figure out the chi square value for the model, given some data points,
    model points, and errors
    
    @params
        y1 - data points
        y2 - model points
        yerr - data point errorbars
    """
    chisq= 0.0
    for i in range(len(y1)):
        chisq = chisq + ((y1[i] - y2[i])**2)/(yerr[i]**2)
    return chisq