Hi Oscar,

On Feb 17, 2014, at 6:02 PM, Oscar Benjamin <oscar.j.benja...@gmail.com> wrote:

> On 17 February 2014 22:15, "André Walker-Loud <walksl...@gmail.com>"
> <walksl...@gmail.com> wrote:
>>> This particular case is easily solved:
>>> 
>>> def f_lambda(x,pars):
>>>    return lambda x: poly(x,*pars)
>>> 
>>> You let the closure take care of pars and return a function that takes
>>> exactly one argument x.
>> 
>> Hi Oscar,
>> 
>> This is the opposite of what I am trying to do.  In the example, x 
>> represents the data and pars represent the parameters I want to determine, 
>> so it is the pars which I need passed into the "func_code.co_varnames" part 
>> of f.
>> 
>> Maybe your suggestion gets me in that direction, but I don't see how.
> 
> No, you're right. I misunderstood this example.
> 
> Are you able to see/alter the source code of the 3rd party function?
> As I said earlier my preferred solution would be to rewrite the
> outermost part of that.
> 
> The core inner minimisation routine will (I'm guessing) be something
> that really doesn't care about the names of these parameters and just
> needs to know the dimensionality of the space it is exploring. If you
> can access that routine directly then you can bypass the (IMO
> unfortunate) interface that you're currently trying to contort your
> problems into.

Thanks for the advice.  At the moment, that sounds a bit too daunting to look 
into, but worth the effort in the long run.  The code is all available.  It is 
in fact a python wrapper around a sophisticated c++ minimizer (Minuit if you’ve 
heard of it).  I am not sure if the python wrapper design was just a choice, or 
forced upon the designer by the interface to Minuit.  That will involve a bit 
of research.


Thanks,

Andre
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to