def FitPowerLaw(x, y):
    """
	Fits the input data in the form
		y = a*x^b
	returns a,b
	"""
    import scipy.optimize as optimize
    fFit = lambda p, x: p[0] * x ** p[1]
    fErr = lambda p, x, y: y - fFit(p, x)
    p0 = [max(y), -1.0]
    out = optimize.leastsq(fErr, p0, args=(x, y), full_output=1)
    pOut = out[0]
    b = pOut[1]
    a = pOut[0]
    return a, b
