'Tests results from `LevMarLSQFitter` with weights.'

def test_with_weights(self):

    fitter = LevMarLSQFitter()
    model = fitter(self.gauss, self.xdata, self.ydata, estimate_jacobian=True)
    withw = fitter(self.gauss, self.xdata, self.ydata, estimate_jacobian=True, weights=np.ones_like(self.xdata))
    assert_allclose(model.parameters, withw.parameters, rtol=(10 ** (-4)))
    weights = np.zeros_like(self.xdata)
    weights[::2] = 1.0
    mask = (weights >= 1.0)
    model = fitter(self.gauss, self.xdata[mask], self.ydata[mask], estimate_jacobian=True)
    withw = fitter(self.gauss, self.xdata, self.ydata, estimate_jacobian=True, weights=weights)
    assert_allclose(model.parameters, withw.parameters, rtol=(10 ** (-4)))
