[SciPy-dev] parameter control in scipy.optimize.leastsq
Sun Oct 19 05:52:24 CDT 2008
On Sun, Oct 19, 2008 at 11:28 AM, Maximilian Fabricius <email@example.com> wrote:
> thank you for the quick reply.
> Indeed, but this would still involve to swap parameters around between
> fixed and non-fixed and
> changing the lambda function manually rather then just switching the
> fissint on and off
> with a single variable.
> But no doubt, a wrapper can be done.
I couldn't think of a way to squeeze it into a lamdba single
statement, but something like this would do:
def fit_function(x, fit, y):
p0 = zeros(fit.size)
p0[fit] = x
p0[~fit] = y
where fit is a boolean array, x is the ones to optimised and y are the
You have the extra overhead of the p0 array allocation for every
iteration of the function - but perhaps that is worth it for the
More information about the Scipy-dev