'Test if the parametric model works with the fitter.'

@pytest.mark.skipif(u'not    HAS_SCIPY')
def test_fitter1D(self, model_class, test_parameters):

    x_lim = test_parameters[u'x_lim']
    parameters = test_parameters[u'parameters']
    model = create_model(model_class, test_parameters)
    if isinstance(parameters, dict):
        parameters = [parameters[name] for name in model.param_names]
    if (u'log_fit' in test_parameters):
        if test_parameters[u'log_fit']:
            x = np.logspace(x_lim[0], x_lim[1], self.N)
    else:
        x = np.linspace(x_lim[0], x_lim[1], self.N)
    np.random.seed(0)
    relative_noise_amplitude = 0.01
    data = ((1 + (relative_noise_amplitude * np.random.randn(len(x)))) * model(x))
    fitter = fitting.LevMarLSQFitter()
    new_model = fitter(model, x, data)
    params = [getattr(new_model, name) for name in new_model.param_names]
    fixed = [param.fixed for param in params]
    expected = np.array([val for (val, fixed) in zip(parameters, fixed) if (not fixed)])
    fitted = np.array([param.value for param in params if (not param.fixed)])
    utils.assert_allclose(fitted, expected, atol=self.fit_error)
