Repository: lmfit/lmfit-py

Issue:
`height` breaks `Model.make_params`
ACK, #324 breaks `examples/doc_nistgauss.py` with

```
NameError
  <_ast.Module object at 0x115871f98>
              ^^^
name 'g1_amplitude' is not defined
Traceback (most recent call last):
  File "doc_nistgauss.py", line 16, in <module>
    pars.update( gauss1.make_params())
  File "/Users/Newville/anaconda3/lib/python3.5/site-packages/lmfit-0.9.3rc2_32_g323882a-py3.5.egg/lmfit/parameter.py", line 132, in __setitem__
    self._asteval.symtable[key] = par.value
  ....
NameError: name 'g1_amplitude' is not defined in expr='<_ast.Module object at 0x115871f98>'
```

I hope to provide fix soon....



Discussion:

Resolving patch:
diff --git a/lmfit/model.py b/lmfit/model.py
--- a/lmfit/model.py
+++ b/lmfit/model.py
@@ -265,27 +265,8 @@ def make_params(self, verbose=False, **kwargs):
         This applies any default values
         """
         params = Parameters()
-        # first build parameters defined in param_hints
-        # note that composites may define their own additional
-        # convenience parameters here
-        for basename, hint in self.param_hints.items():
-            name = "%s%s" % (self._prefix, basename)
-            if name in params:
-                par = params[name]
-            else:
-                par = Parameter(name=name)
-            par._delay_asteval = True
-            for item in self._hint_names:
-                if item in  hint:
-                    setattr(par, item, hint[item])
-            # Add the new parameter to self._param_names
-            if name not in self._param_names:
-                self._param_names.append(name)
-            params.add(par)
-            if verbose:
-                print( ' - Adding parameter for hint "%s"' % name)
 
-        # next, make sure that all named parameters are included
+        # make sure that all named parameters are in params
         for name in self.param_names:
             if name in params:
                 par = params[name]
@@ -313,6 +294,26 @@ def make_params(self, verbose=False, **kwargs):
             if verbose:
                 print( ' - Adding parameter "%s"' % name)
 
+        # next build parameters defined in param_hints
+        # note that composites may define their own additional
+        # convenience parameters here
+        for basename, hint in self.param_hints.items():
+            name = "%s%s" % (self._prefix, basename)
+            if name in params:
+                par = params[name]
+            else:
+                par = Parameter(name=name)
+                params.add(par)
+                if verbose:
+                    print( ' - Adding parameter for hint "%s"' % name)
+            par._delay_asteval = True
+            for item in self._hint_names:
+                if item in  hint:
+                    setattr(par, item, hint[item])
+            # Add the new parameter to self._param_names
+            if name not in self._param_names:
+                self._param_names.append(name)
+
         for p in params.values():
             p._delay_asteval = False
         return params


Test patch:
diff --git a/tests/test_model.py b/tests/test_model.py
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -433,6 +433,25 @@ def func(x, amplitude):
         self.assertEqual(param_values['p1_amplitude'], 1)
         self.assertEqual(param_values['p2_amplitude'], 2)
 
+    def test_hints_for_peakmodels(self):
+        # test that height/fwhm do not cause asteval errors.
+
+        x = np.linspace(-10, 10, 101)
+        y = np.sin(x / 3)  + x /100.
+
+        m1 = models.LinearModel(prefix='m1_')
+
+        params = m1.guess(y, x=x)
+
+        m2 = models.GaussianModel(prefix='m2_')
+        params.update(m2.make_params())
+
+        m = m1 + m2
+
+        param_values = {name: p.value for name, p in params.items()}
+        self.assertTrue(param_values['m1_intercept'] < -0.0)
+        self.assertEqual(param_values['m2_amplitude'], 1)
+
     def test_weird_param_hints(self):
         # tests Github Issue 312, a very weird way to access param_hints
         def func(x, amp):
@@ -531,7 +550,6 @@ def setUp(self):
 
 
 class TestConstant(CommonTests, unittest.TestCase):
-
     def setUp(self):
         self.true_values = lambda: dict(c=5)
         self.guess = lambda: dict(c=2)
@@ -542,7 +560,6 @@ def check_skip_independent_vars(self):
         raise nose.SkipTest("ConstantModel has not independent_vars.")
 
 class TestPowerlaw(CommonTests, unittest.TestCase):
-
     def setUp(self):
         self.true_values = lambda: dict(amplitude=5, exponent=3)
         self.guess = lambda: dict(amplitude=2, exponent=8)
@@ -551,7 +568,6 @@ def setUp(self):
 
 
 class TestExponential(CommonTests, unittest.TestCase):
-
     def setUp(self):
         self.true_values = lambda: dict(amplitude=5, decay=3)
         self.guess = lambda: dict(amplitude=2, decay=8)
@@ -564,4 +580,6 @@ def setUp(self):
         self.true_values = lambda: dict(re=5,im=5)
         self.guess = lambda: dict(re=2,im=2)
         self.model_constructor = models.ComplexConstantModel
-        super(TestComplexConstant, self).setUp()
\ No newline at end of file
+        super(TestComplexConstant, self).setUp()
+
+#