[Tutor] constructing semi-arbitrary functions

eryksun eryksun at gmail.com
Thu Feb 20 01:21:35 CET 2014


On Wed, Feb 19, 2014 at 6:59 PM, "André Walker-Loud
<walksloud at gmail.com>" <walksloud at gmail.com> wrote:
>
> Also, since you are chiming in, do you have an opinion in general about
> which approach you prefer?  The string hacking vs class method (for lack
> of better way to describe them)?

I've never used iminuit before. I'd ask on a support forum to see what
other people are doing. That said, if possible I'd use a closure like
Peter showed:

    def make_chisq_mn(x, y, dy):
        def chisq_mn(*args):
            return chisq(args, x, y, dy)
        return chisq_mn

Then combine that with the forced_parameters option that Peter
mentioned. This seems simplest to me.


More information about the Tutor mailing list