@pytest.mark.skipif(u'not HAS_SCIPY')
def test_fit_with_fixed_and_bound_constraints():
 m = models.Gaussian1D(amplitude=3, mean=4, stddev=1, bounds={u'mean': (4, 5)}, fixed={u'amplitude': True})
 x = np.linspace(0, 10, 10)
 y = np.exp(((- (x ** 2)) / 2))
 f = fitting.LevMarLSQFitter()
 fitted_1 = f(m, x, y)
 assert (fitted_1.mean >= 4)
 assert (fitted_1.mean <= 5)
 assert (fitted_1.amplitude == 3.0)
 m.amplitude.fixed = False
 fitted_2 = f(m, x, y)
 assert (fitted_1.mean >= 4)
 assert (fitted_1.mean <= 5)

@ pytest . mark . skipif ( u'not HAS_SCIPY' ) def test_fit_with_fixed_and_bound_constraints ( ) : m = models . Gaussian1D ( amplitude = 3 , mean = 4 , stddev = 1 , bounds = { u'mean' : ( 4 , 5 ) } , fixed = { u'amplitude' : True } ) x = np . linspace ( 0 , 10 , 10 ) y = np . exp ( ( ( - ( x ** 2 ) ) / 2 ) ) f = fitting . LevMarLSQFitter ( ) fitted_1 = f ( m , x , y ) assert ( fitted_1 . mean >= 4 ) assert ( fitted_1 . mean <= 5 ) assert ( fitted_1 . amplitude == 3.0 ) m . amplitude . fixed = False fitted_2 = f ( m , x , y ) assert ( fitted_1 . mean >= 4 ) assert ( fitted_1 . mean <= 5 )
regression test for URL currently doesnt test that the fit is any *good*--just that parameters stay within their given constraints .