Skip to content

Commit

Permalink
build: upgrade to iminuit v2.x (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Feb 9, 2021
1 parent 3d0ec44 commit 5da1b7c
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"https://pwa.readthedocs.io/projects/expertsystem/en/0.6.9",
None,
),
"iminuit": ("https://iminuit.readthedocs.io/en/v1.5.4", None),
"iminuit": ("https://iminuit.readthedocs.io/en/stable", None),
"matplotlib": ("https://matplotlib.org", None),
"mypy": ("https://mypy.readthedocs.io/en/stable", None),
"numpy": ("https://numpy.org/doc/stable", None),
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.6/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ hepunits==2.0.1
identify==1.5.13
idna==2.10
imagesize==1.2.0
iminuit==1.5.4
iminuit==2.3.0
immutables==0.14
importlib-metadata==3.4.0
importlib-resources==3.0.0
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.6/requirements-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ h5py==2.10.0
hepunits==2.0.1
idna==2.10
imagesize==1.2.0
iminuit==1.5.4
iminuit==2.3.0
importlib-metadata==3.4.0
importlib-resources==3.0.0
ipykernel==5.4.3
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.6/requirements-sty.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ h5py==2.10.0
hepunits==2.0.1
identify==1.5.13
idna==2.10
iminuit==1.5.4
iminuit==2.3.0
importlib-metadata==3.4.0
importlib-resources==3.0.0
iniconfig==1.1.1
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.6/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ grpcio==1.32.0
h5py==2.10.0
hepunits==2.0.1
idna==2.10
iminuit==1.5.4
iminuit==2.3.0
importlib-metadata==3.4.0
importlib-resources==3.0.0
iniconfig==1.1.1
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.6/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ grpcio==1.32.0
h5py==2.10.0
hepunits==2.0.1
idna==2.10
iminuit==1.5.4
iminuit==2.3.0
importlib-metadata==3.4.0
importlib-resources==3.0.0
jsonschema==3.2.0
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.7/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ hepunits==2.0.1
identify==1.5.13
idna==2.10
imagesize==1.2.0
iminuit==1.5.4
iminuit==2.3.0
importlib-metadata==3.4.0
iniconfig==1.1.1
ipykernel==5.4.3
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.7/requirements-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ h5py==2.10.0
hepunits==2.0.1
idna==2.10
imagesize==1.2.0
iminuit==1.5.4
iminuit==2.3.0
importlib-metadata==3.4.0
ipykernel==5.4.3
ipython-genutils==0.2.0
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.7/requirements-sty.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ h5py==2.10.0
hepunits==2.0.1
identify==1.5.13
idna==2.10
iminuit==1.5.4
iminuit==2.3.0
importlib-metadata==3.4.0
iniconfig==1.1.1
ipython-genutils==0.2.0
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.7/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ grpcio==1.32.0
h5py==2.10.0
hepunits==2.0.1
idna==2.10
iminuit==1.5.4
iminuit==2.3.0
importlib-metadata==3.4.0
iniconfig==1.1.1
jsonschema==3.2.0
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.7/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ grpcio==1.32.0
h5py==2.10.0
hepunits==2.0.1
idna==2.10
iminuit==1.5.4
iminuit==2.3.0
importlib-metadata==3.4.0
jsonschema==3.2.0
keras-preprocessing==1.1.2
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.8/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ hepunits==2.0.1
identify==1.5.13
idna==2.10
imagesize==1.2.0
iminuit==1.5.4
iminuit==2.3.0
importlib-metadata==3.4.0
iniconfig==1.1.1
ipykernel==5.4.3
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.8/requirements-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ h5py==2.10.0
hepunits==2.0.1
idna==2.10
imagesize==1.2.0
iminuit==1.5.4
iminuit==2.3.0
importlib-metadata==3.4.0
ipykernel==5.4.3
ipython-genutils==0.2.0
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.8/requirements-sty.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ h5py==2.10.0
hepunits==2.0.1
identify==1.5.13
idna==2.10
iminuit==1.5.4
iminuit==2.3.0
iniconfig==1.1.1
ipython-genutils==0.2.0
isort==5.7.0
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.8/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ grpcio==1.32.0
h5py==2.10.0
hepunits==2.0.1
idna==2.10
iminuit==1.5.4
iminuit==2.3.0
iniconfig==1.1.1
jsonschema==3.2.0
keras-preprocessing==1.1.2
Expand Down
2 changes: 1 addition & 1 deletion reqs/3.8/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ grpcio==1.32.0
h5py==2.10.0
hepunits==2.0.1
idna==2.10
iminuit==1.5.4
iminuit==2.3.0
jsonschema==3.2.0
keras-preprocessing==1.1.2
markdown==3.3.3
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ setup_requires =
install_requires =
amplitf
expertsystem == 0.6.9
iminuit >=1.5.3, <2.0
iminuit >= 2.0
numpy
pandas
phasespace >= 1.2.0
Expand Down
14 changes: 8 additions & 6 deletions src/tensorwaves/optimizer/minuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ def wrapped_function(pars: list) -> float:
self.__callback.on_iteration_end(n_function_calls, logs)
return estimator_value

minuit = Minuit.from_array_func(
minuit = Minuit(
wrapped_function,
list(parameters.values()),
error=[0.1 * x if x != 0.0 else 0.1 for x in parameters.values()],
name=list(parameters.keys()),
errordef=0.5,
tuple(parameters.values()),
name=tuple(parameters),
)
minuit.errors = tuple(
0.1 * x if x != 0.0 else 0.1 for x in parameters.values()
)
minuit.errordef = Minuit.LIKELIHOOD

start_time = time.time()
minuit.migrad()
Expand All @@ -80,6 +82,6 @@ def wrapped_function(pars: list) -> float:
"parameter_values": parameter_values,
"parameter_errors": parameter_errors,
"log_likelihood": minuit.fmin.fval,
"function_calls": minuit.fmin.nfcn_total,
"function_calls": minuit.fmin.nfcn,
"execution_time": end_time - start_time,
}

0 comments on commit 5da1b7c

Please sign in to comment.