Skip to content

Use of a functools.partial not supported in cost.UnbinnedNLL? #1107

@GWeberJ

Description

@GWeberJ

With 2.4.0 (February 10, 2021) it is claimed that "Minuit now supports functions wrapped with functools.partial, by @jnsdrtlf".

However, with iminuit-2.31.1 I get the following error:

File C:\ProgramData\anaconda3\envs\E134\Lib\site-packages\iminuit\minuit.py:2653, in _make_init_state(pos2var, args, kwds)
2650 nargs = len(kwds)
2652 if len(pos2var) != nargs:
-> 2653 raise RuntimeError(
2654 f"{nargs} values given for {len(pos2var)} function parameter(s)"
2655 )
2657 state = MnUserParameterState()
2658 for i, x in enumerate(pos2var):

RuntimeError: 4 values given for 6 function parameter(s)

Relevant lines of code:
def pdf(x, A, B, C, D, data_x, data_y):
...
if name == 'main':
...
pdf_now = partial(pdf, data_x=x_axis, data_y=ref_hist)
c = cost.UnbinnedNLL(test60, pdf_now)

Am I doing something wrong or is this really a problem of iminuit?

Thank you very much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions