17 May
2012
17 May
'12
2:02 p.m.
17.05.2012 11:51, federico vaggi kirjoitti: [clip]
And that will do the trick. If you need to more complex boundaries, you can simply use a combination of period functions with a given amplitude or what have you. Alternatively, there are *a lot* of optimization libraries available for Python that are not a part of scipy that offer the possibility to specify boundaries.
Note that Scipy has several solvers that support bounds in optimization problems --- to use those for least squares, you'll just need to do "return (r**2).sum()" yourself. This is AFAIK also what lmfit does, in addition to clipping parameter values within the bounds in the residual function (I'm not sure how robust the results such clipping produces are). Pauli