SlideShare a Scribd company logo
1 of 22
Download to read offline
iminuit and MINUIT2 Standalone
Hans Dembinski1
for the iminuit authors Henry Schreiner2
ROOT Users Worshop 2018
Sarajevo, Bosnia and Herzegovina
March 22, 2018
1
MPIK Heidelberg
2
University of Cincinnati
iminuit
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 1/15
iminuit in a nutshell iminuit
• Interactive wrapper around C++ MINUIT2
I Uses latest C++ code from ROOT-6.12
I Features of MINUIT2 without ROOT dependency
I O cial successor of pyminuit & pyminuit2
• Easy to install: pip install iminuit
• Enhanced for interactive use and Cython compatibility
I Nice print out in Jupyter notebooks and console
I Simple plots built-in (using matplotlib)
• Docs: http://iminuit.readthedocs.io
• Issue tracker on Github (PRs welcome): https://github.com/iminuit/iminuit
• Citable paper coming soon
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 2/15
Example: line fit iminuit
def line(x, a, b):
return a + x*b
def least_squares(a, b):
yvar = 0.01
return sum((data_y - line(data_x, a, b))**2 / yvar)
Parameter names are detected automatically by iminuit by introspection
from iminuit import Minuit
m = Minuit(least_squares, a=0, b=0, error_a=1, error_b=1, errordef=1)
m.print_param() # Nice printout in notebook
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 3/15
Example: line fit iminuit
Do the actual minimization
m.migrad()
Access the fit values
m.values[ a ]
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 4/15
Hesse and Minos errors iminuit
Hesse
m.hesse()
Value access
m.errors
m.covariance
Minos
m.minos()
Value access
m.merrors
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 5/15
Built-in plotting iminuit
m.draw_mncontour( a , b , nsigma=4) m.draw_profile( a )
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 6/15
Numpy support iminuit
# Numpy functions are supported, too
import numpy as np
def least_squares_np(par): # par is a numpy array
mu = np.polyval(par, data_x) # for len(par) = 2, this is a line
yvar = 0.01
return np.sum((data_y - mu) ** 2 / yvar)
m = Minuit.from_array_func(least_squares_np, (0, 0),
error=(1, 1), errordef=1)
m.migrad()
# Accessors for numpy arrays
m.np_values()
m.np_errors()
m.np_covariance()
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 7/15
Scipy interface iminuit
Alternative interface to ease transition for Scipy users:
from iminuit import minimize
result = minimize(least_squares_np, (0, 0))
Same interface as scipy.optimize.minimize!
Result is of type scipy.optimize.OptimizeResult.
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 8/15
Standalone Minuit2
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 9/15
The need for Standalone Minuit2 Standalone Minuit2
Current state of a airs
• Previous release: ROOT 5.20, 2008
• Poor C++11 support (warnings)
• Old build-system
• Not available via git
Initial work
• Created /GooFit/Minuit2
• Some external interest
• Used internally in GooFit
Many use cases for Minuit standalone
• iminuit: Python, pip install
• GooFit: GPU PDF fitter (also Python)
• Hydra: GPU/CPU analysis toolkit
Other potential users
• TensorFlowAnalysis
• Potential PyBind11 bindings (proof of
concept in GooFit)
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 10/15
Design Standalone Minuit2
Standard CMake builds
• Modern CMake 3.1+ build system
• Support producing source distribution
without scripts
• Support add_subdirectory in and
outside ROOT
cmake <path>
make
make install # optional
• <path> can be root/math/minuit2 or
standalone
• make package and make
package_source (read docs) work too
Use it in (your) libraries
• You can use without ROOT or even if
you just have ROOT::Minuit2 missing.
• Supports all the standard ways to use a
CMake libraries
# Use standalone
add_subdirectory(minuit2)
# Use from ROOT
add_subdirectory(root/math/minuit2)
# Use prebuilt
find_package(Minuit2 CONFIG)
# All methods
target_link_libraries(MyProgram
PRIVATE Minuit2::Minuit2)
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 11/15
Package source design details Standalone Minuit2
External files
• Selected external files
I src/math
I inc/Math
I inc/Fit
• Other files:
I LGPL2_1.txt
I LICENSE
I version_number
Minuit2 standalone distribution
• Sits inside ROOT 6.14+
• Submodule: /GooFit/Minuit2
(synced with master)
• Other downloads (source, binaries)
hopefully available soon
CMakeLists.txt
• No conflicts: ROOT parts protected
• Options shared
• Calls Standalone.cmake
copy_standalone.cmake
• Can use files inplace in ROOT or
standalone mode
• Copies only made if requested for
creating source package
Other
• Example of CMake use in
examples/simple
• CI Tests, include building example
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 12/15
Documentation Standalone Minuit2
Tutorial documented in the book: Modern CMake on gitlab.io
README.md
• User introduction
• Instructions for building
• Instructions for CMake
Packaged files from ROOT
• Version
• License
DEVELOP.md
• Developer introduction
• Instructions for packaging
• Tips for maintenance
CMakeLists
• Lots of helpful comments
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 13/15
Summary
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 14/15
Summary Summary
iminuit
• Powerful, pythonic interface to Minuit2
• Just a pip install away
• Also in Conda for macOS, Linux, and
Windows
conda install -c conda-forge iminuit
Minuit2 Standalone
• Makes it easy to include Minuit2 in a
CMake project any way you want to
• Make it easy to build and use Minuit2
anywhere
• Support for macOS, Linux, and Windows
• Helpful documentation
A PR is currently in progress to use standalone Minuit2 in iMinuit!
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 15/15
Backup
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 16/15
The procedure: Minuit2 patches Backup
Timeline of patches, all 2018:
• Fixed Minuit2 and ROOT separation February 27
• Fixed Windows support February 28
• Standard CMake options for MPI/OpenMP (+fixes)
• Minuit2 standalone March 23
• Missing include in MinimumBuilder May 9
• Standalone target name improvements May 18
• MSVC 15 bug workaround July 19
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 17/15
Inside ROOT Backup
Builds in source, no changes or copies made
cmake /root/math/minuit2
make
make install # optional
Library usage
add_subdirectory(root/math/minuit2) # Combined build
# OR
find_package(Minuit2 CONFIG) # Either build or install
target_link_libraries(MyProgram PUBLIC Minuit2::Minuit2)
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 18/15
Outside ROOT Backup
Builds from source package
cmake <root>/math/minuit2 # Optional
make
make install # optional
Library usage
add_subdirectory(minuit2) # Combined build
# OR
find_package(Minuit2 CONFIG) # Either build or install
target_link_libraries(MyProgram Minuit2::Minuit2)
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 19/15
Making a Source Package Backup
cmake /root/math/minuit2 -Dminuit2-standalone=ON
make package_source
make purge # optional
• Copies needed files into root/math/minuit2
• Utilizes standard CMake technology to make the source package (tar.gz and zip)
• Purge removes all copied files
• Copied files are ignored by git
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 20/15
Binary Packages Backup
# Linux/macOS # Windows
cmake .. "C:Program FilesCMakebincmake.exe" ..
make "C:Program FilesCMakebincmake.exe" --build .
make package "C:Program FilesCMakebincmake.exe" --build . --target package
• No copy needed, in or outside ROOT!
• Makes platform installers (.msi, .sh, .rpm, etc.)
• Supports Windows (tested on VC17 + OpenStack VM)
iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 15/15

More Related Content

Similar to ROOT 2018: iminuit and MINUIT2 Standalone

Open P2P Design. Metadesign for Open Design Projects
Open P2P Design. Metadesign for Open Design ProjectsOpen P2P Design. Metadesign for Open Design Projects
Open P2P Design. Metadesign for Open Design ProjectsMassimo Menichinelli
 
Open Design: Process + Community @ FabLab Cali
Open Design: Process + Community @ FabLab CaliOpen Design: Process + Community @ FabLab Cali
Open Design: Process + Community @ FabLab CaliMassimo Menichinelli
 
Rejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform GainRejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform GainŁukasz Piątkowski
 
Open source projects with python
Open source projects with pythonOpen source projects with python
Open source projects with pythonroskakori
 
Easy contributable internationalization process with Sphinx @ pyconsg2015
Easy contributable internationalization process with Sphinx @ pyconsg2015Easy contributable internationalization process with Sphinx @ pyconsg2015
Easy contributable internationalization process with Sphinx @ pyconsg2015Takayuki Shimizukawa
 
Easy contributable internationalization process with Sphinx @ PyCon APAC 2016
Easy contributable internationalization process with Sphinx @ PyCon APAC 2016Easy contributable internationalization process with Sphinx @ PyCon APAC 2016
Easy contributable internationalization process with Sphinx @ PyCon APAC 2016Takayuki Shimizukawa
 
Integrate gitolite with mantis
Integrate gitolite with mantisIntegrate gitolite with mantis
Integrate gitolite with mantisJohnson Chou
 
Hackaton for health 2015 - Sharing the Code we Make
Hackaton for health 2015 - Sharing the Code we MakeHackaton for health 2015 - Sharing the Code we Make
Hackaton for health 2015 - Sharing the Code we Makeesben1962
 
What so special about Mageia - LinuxCon Japan 2014
What so special about Mageia - LinuxCon Japan 2014What so special about Mageia - LinuxCon Japan 2014
What so special about Mageia - LinuxCon Japan 2014Bruno Cornec
 
Introduction to Git for Network Engineers (Lab Guide)
Introduction to Git for Network Engineers (Lab Guide)Introduction to Git for Network Engineers (Lab Guide)
Introduction to Git for Network Engineers (Lab Guide)Joel W. King
 
Metta Innovations - Introdução ao Deep Learning aplicado a vídeo analytics
Metta Innovations - Introdução ao Deep Learning aplicado a vídeo analyticsMetta Innovations - Introdução ao Deep Learning aplicado a vídeo analytics
Metta Innovations - Introdução ao Deep Learning aplicado a vídeo analyticsEduardo Gaspar
 
Easy contributable internationalization process with Sphinx @ pyconmy2015
Easy contributable internationalization process with Sphinx @ pyconmy2015Easy contributable internationalization process with Sphinx @ pyconmy2015
Easy contributable internationalization process with Sphinx @ pyconmy2015Takayuki Shimizukawa
 
Embedded linux build systems
Embedded linux build systems  Embedded linux build systems
Embedded linux build systems Mender.io
 
Jupyter, A Platform for Data Science at Scale
Jupyter, A Platform for Data Science at ScaleJupyter, A Platform for Data Science at Scale
Jupyter, A Platform for Data Science at ScaleMatthias Bussonnier
 
ePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version ControlePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version ControlGiuseppe Masetti
 
The BondMachine: a fully reconfigurable computing ecosystem
The BondMachine: a fully reconfigurable computing ecosystemThe BondMachine: a fully reconfigurable computing ecosystem
The BondMachine: a fully reconfigurable computing ecosystemMirko Mariotti
 
Embedded Recipes 2017 - An easy-to-install real world embedded Linux distribu...
Embedded Recipes 2017 - An easy-to-install real world embedded Linux distribu...Embedded Recipes 2017 - An easy-to-install real world embedded Linux distribu...
Embedded Recipes 2017 - An easy-to-install real world embedded Linux distribu...Anne Nicolas
 
LinuxKit and Moby, News from DockerCon 2017
LinuxKit and Moby, News from DockerCon 2017LinuxKit and Moby, News from DockerCon 2017
LinuxKit and Moby, News from DockerCon 2017Dieter Reuter
 
Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...
Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...
Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...Databricks
 

Similar to ROOT 2018: iminuit and MINUIT2 Standalone (20)

Open P2P Design. Metadesign for Open Design Projects
Open P2P Design. Metadesign for Open Design ProjectsOpen P2P Design. Metadesign for Open Design Projects
Open P2P Design. Metadesign for Open Design Projects
 
Open Design: Process + Community @ FabLab Cali
Open Design: Process + Community @ FabLab CaliOpen Design: Process + Community @ FabLab Cali
Open Design: Process + Community @ FabLab Cali
 
Rejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform GainRejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform Gain
 
Mininet Basics
Mininet BasicsMininet Basics
Mininet Basics
 
Open source projects with python
Open source projects with pythonOpen source projects with python
Open source projects with python
 
Easy contributable internationalization process with Sphinx @ pyconsg2015
Easy contributable internationalization process with Sphinx @ pyconsg2015Easy contributable internationalization process with Sphinx @ pyconsg2015
Easy contributable internationalization process with Sphinx @ pyconsg2015
 
Easy contributable internationalization process with Sphinx @ PyCon APAC 2016
Easy contributable internationalization process with Sphinx @ PyCon APAC 2016Easy contributable internationalization process with Sphinx @ PyCon APAC 2016
Easy contributable internationalization process with Sphinx @ PyCon APAC 2016
 
Integrate gitolite with mantis
Integrate gitolite with mantisIntegrate gitolite with mantis
Integrate gitolite with mantis
 
Hackaton for health 2015 - Sharing the Code we Make
Hackaton for health 2015 - Sharing the Code we MakeHackaton for health 2015 - Sharing the Code we Make
Hackaton for health 2015 - Sharing the Code we Make
 
What so special about Mageia - LinuxCon Japan 2014
What so special about Mageia - LinuxCon Japan 2014What so special about Mageia - LinuxCon Japan 2014
What so special about Mageia - LinuxCon Japan 2014
 
Introduction to Git for Network Engineers (Lab Guide)
Introduction to Git for Network Engineers (Lab Guide)Introduction to Git for Network Engineers (Lab Guide)
Introduction to Git for Network Engineers (Lab Guide)
 
Metta Innovations - Introdução ao Deep Learning aplicado a vídeo analytics
Metta Innovations - Introdução ao Deep Learning aplicado a vídeo analyticsMetta Innovations - Introdução ao Deep Learning aplicado a vídeo analytics
Metta Innovations - Introdução ao Deep Learning aplicado a vídeo analytics
 
Easy contributable internationalization process with Sphinx @ pyconmy2015
Easy contributable internationalization process with Sphinx @ pyconmy2015Easy contributable internationalization process with Sphinx @ pyconmy2015
Easy contributable internationalization process with Sphinx @ pyconmy2015
 
Embedded linux build systems
Embedded linux build systems  Embedded linux build systems
Embedded linux build systems
 
Jupyter, A Platform for Data Science at Scale
Jupyter, A Platform for Data Science at ScaleJupyter, A Platform for Data Science at Scale
Jupyter, A Platform for Data Science at Scale
 
ePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version ControlePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version Control
 
The BondMachine: a fully reconfigurable computing ecosystem
The BondMachine: a fully reconfigurable computing ecosystemThe BondMachine: a fully reconfigurable computing ecosystem
The BondMachine: a fully reconfigurable computing ecosystem
 
Embedded Recipes 2017 - An easy-to-install real world embedded Linux distribu...
Embedded Recipes 2017 - An easy-to-install real world embedded Linux distribu...Embedded Recipes 2017 - An easy-to-install real world embedded Linux distribu...
Embedded Recipes 2017 - An easy-to-install real world embedded Linux distribu...
 
LinuxKit and Moby, News from DockerCon 2017
LinuxKit and Moby, News from DockerCon 2017LinuxKit and Moby, News from DockerCon 2017
LinuxKit and Moby, News from DockerCon 2017
 
Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...
Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...
Streaming Trend Discovery: Real-Time Discovery in a Sea of Events with Scott ...
 

More from Henry Schreiner

Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Henry Schreiner
 
Princeton RSE Peer network first meeting
Princeton RSE Peer network first meetingPrinceton RSE Peer network first meeting
Princeton RSE Peer network first meetingHenry Schreiner
 
Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Henry Schreiner
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingHenry Schreiner
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11Henry Schreiner
 
Everything you didn't know you needed
Everything you didn't know you neededEverything you didn't know you needed
Everything you didn't know you neededHenry Schreiner
 
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...Henry Schreiner
 
PyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packaging
PyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packagingPyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packaging
PyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packagingHenry Schreiner
 
PyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsPyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsHenry Schreiner
 
boost-histogram / Hist: PyHEP Topical meeting
boost-histogram / Hist: PyHEP Topical meetingboost-histogram / Hist: PyHEP Topical meeting
boost-histogram / Hist: PyHEP Topical meetingHenry Schreiner
 
Digital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingDigital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingHenry Schreiner
 
RDM 2020: Python, Numpy, and Pandas
RDM 2020: Python, Numpy, and PandasRDM 2020: Python, Numpy, and Pandas
RDM 2020: Python, Numpy, and PandasHenry Schreiner
 
HOW 2019: Machine Learning for the Primary Vertex Reconstruction
HOW 2019: Machine Learning for the Primary Vertex ReconstructionHOW 2019: Machine Learning for the Primary Vertex Reconstruction
HOW 2019: Machine Learning for the Primary Vertex ReconstructionHenry Schreiner
 
HOW 2019: A complete reproducible ROOT environment in under 5 minutes
HOW 2019: A complete reproducible ROOT environment in under 5 minutesHOW 2019: A complete reproducible ROOT environment in under 5 minutes
HOW 2019: A complete reproducible ROOT environment in under 5 minutesHenry Schreiner
 
ACAT 2019: A hybrid deep learning approach to vertexing
ACAT 2019: A hybrid deep learning approach to vertexingACAT 2019: A hybrid deep learning approach to vertexing
ACAT 2019: A hybrid deep learning approach to vertexingHenry Schreiner
 
2019 CtD: A hybrid deep learning approach to vertexing
2019 CtD: A hybrid deep learning approach to vertexing2019 CtD: A hybrid deep learning approach to vertexing
2019 CtD: A hybrid deep learning approach to vertexingHenry Schreiner
 
2019 IRIS-HEP AS workshop: Boost-histogram and hist
2019 IRIS-HEP AS workshop: Boost-histogram and hist2019 IRIS-HEP AS workshop: Boost-histogram and hist
2019 IRIS-HEP AS workshop: Boost-histogram and histHenry Schreiner
 

More from Henry Schreiner (20)

Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
Princeton RSE Peer network first meeting
Princeton RSE Peer network first meetingPrinceton RSE Peer network first meeting
Princeton RSE Peer network first meeting
 
Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance Tooling
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
 
Everything you didn't know you needed
Everything you didn't know you neededEverything you didn't know you needed
Everything you didn't know you needed
 
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
 
SciPy 2022 Scikit-HEP
SciPy 2022 Scikit-HEPSciPy 2022 Scikit-HEP
SciPy 2022 Scikit-HEP
 
PyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packaging
PyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packagingPyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packaging
PyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packaging
 
PyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsPyCon2022 - Building Python Extensions
PyCon2022 - Building Python Extensions
 
boost-histogram / Hist: PyHEP Topical meeting
boost-histogram / Hist: PyHEP Topical meetingboost-histogram / Hist: PyHEP Topical meeting
boost-histogram / Hist: PyHEP Topical meeting
 
Digital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meetingDigital RSE: automated code quality checks - RSE group meeting
Digital RSE: automated code quality checks - RSE group meeting
 
CMake best practices
CMake best practicesCMake best practices
CMake best practices
 
Pybind11 - SciPy 2021
Pybind11 - SciPy 2021Pybind11 - SciPy 2021
Pybind11 - SciPy 2021
 
RDM 2020: Python, Numpy, and Pandas
RDM 2020: Python, Numpy, and PandasRDM 2020: Python, Numpy, and Pandas
RDM 2020: Python, Numpy, and Pandas
 
HOW 2019: Machine Learning for the Primary Vertex Reconstruction
HOW 2019: Machine Learning for the Primary Vertex ReconstructionHOW 2019: Machine Learning for the Primary Vertex Reconstruction
HOW 2019: Machine Learning for the Primary Vertex Reconstruction
 
HOW 2019: A complete reproducible ROOT environment in under 5 minutes
HOW 2019: A complete reproducible ROOT environment in under 5 minutesHOW 2019: A complete reproducible ROOT environment in under 5 minutes
HOW 2019: A complete reproducible ROOT environment in under 5 minutes
 
ACAT 2019: A hybrid deep learning approach to vertexing
ACAT 2019: A hybrid deep learning approach to vertexingACAT 2019: A hybrid deep learning approach to vertexing
ACAT 2019: A hybrid deep learning approach to vertexing
 
2019 CtD: A hybrid deep learning approach to vertexing
2019 CtD: A hybrid deep learning approach to vertexing2019 CtD: A hybrid deep learning approach to vertexing
2019 CtD: A hybrid deep learning approach to vertexing
 
2019 IRIS-HEP AS workshop: Boost-histogram and hist
2019 IRIS-HEP AS workshop: Boost-histogram and hist2019 IRIS-HEP AS workshop: Boost-histogram and hist
2019 IRIS-HEP AS workshop: Boost-histogram and hist
 

Recently uploaded

FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryAlex Henderson
 
Grade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its FunctionsGrade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its FunctionsOrtegaSyrineMay
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPirithiRaju
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.Nitya salvi
 
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑Damini Dixit
 
GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)Areesha Ahmad
 
300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptxryanrooker
 
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....muralinath2
 
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Young
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai YoungDubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Young
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Youngkajalvid75
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bSérgio Sacani
 
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedConnaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Sector 62, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 62, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...Silpa
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000Sapana Sha
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)Areesha Ahmad
 
High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...
High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...
High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...chandars293
 
Call Girls Ahmedabad +917728919243 call me Independent Escort Service
Call Girls Ahmedabad +917728919243 call me Independent Escort ServiceCall Girls Ahmedabad +917728919243 call me Independent Escort Service
Call Girls Ahmedabad +917728919243 call me Independent Escort Serviceshivanisharma5244
 
Molecular markers- RFLP, RAPD, AFLP, SNP etc.
Molecular markers- RFLP, RAPD, AFLP, SNP etc.Molecular markers- RFLP, RAPD, AFLP, SNP etc.
Molecular markers- RFLP, RAPD, AFLP, SNP etc.Silpa
 
Pests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdfPests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdfPirithiRaju
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticssakshisoni2385
 

Recently uploaded (20)

FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
 
Grade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its FunctionsGrade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its Functions
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
 
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
 
GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)
 
300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx
 
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
 
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Young
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai YoungDubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Young
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Young
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
 
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedConnaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
 
Sector 62, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 62, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)
 
High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...
High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...
High Class Escorts in Hyderabad ₹7.5k Pick Up & Drop With Cash Payment 969456...
 
Call Girls Ahmedabad +917728919243 call me Independent Escort Service
Call Girls Ahmedabad +917728919243 call me Independent Escort ServiceCall Girls Ahmedabad +917728919243 call me Independent Escort Service
Call Girls Ahmedabad +917728919243 call me Independent Escort Service
 
Molecular markers- RFLP, RAPD, AFLP, SNP etc.
Molecular markers- RFLP, RAPD, AFLP, SNP etc.Molecular markers- RFLP, RAPD, AFLP, SNP etc.
Molecular markers- RFLP, RAPD, AFLP, SNP etc.
 
Pests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdfPests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdf
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
 

ROOT 2018: iminuit and MINUIT2 Standalone

  • 1. iminuit and MINUIT2 Standalone Hans Dembinski1 for the iminuit authors Henry Schreiner2 ROOT Users Worshop 2018 Sarajevo, Bosnia and Herzegovina March 22, 2018 1 MPIK Heidelberg 2 University of Cincinnati
  • 2. iminuit iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 1/15
  • 3. iminuit in a nutshell iminuit • Interactive wrapper around C++ MINUIT2 I Uses latest C++ code from ROOT-6.12 I Features of MINUIT2 without ROOT dependency I O cial successor of pyminuit & pyminuit2 • Easy to install: pip install iminuit • Enhanced for interactive use and Cython compatibility I Nice print out in Jupyter notebooks and console I Simple plots built-in (using matplotlib) • Docs: http://iminuit.readthedocs.io • Issue tracker on Github (PRs welcome): https://github.com/iminuit/iminuit • Citable paper coming soon iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 2/15
  • 4. Example: line fit iminuit def line(x, a, b): return a + x*b def least_squares(a, b): yvar = 0.01 return sum((data_y - line(data_x, a, b))**2 / yvar) Parameter names are detected automatically by iminuit by introspection from iminuit import Minuit m = Minuit(least_squares, a=0, b=0, error_a=1, error_b=1, errordef=1) m.print_param() # Nice printout in notebook iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 3/15
  • 5. Example: line fit iminuit Do the actual minimization m.migrad() Access the fit values m.values[ a ] iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 4/15
  • 6. Hesse and Minos errors iminuit Hesse m.hesse() Value access m.errors m.covariance Minos m.minos() Value access m.merrors iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 5/15
  • 7. Built-in plotting iminuit m.draw_mncontour( a , b , nsigma=4) m.draw_profile( a ) iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 6/15
  • 8. Numpy support iminuit # Numpy functions are supported, too import numpy as np def least_squares_np(par): # par is a numpy array mu = np.polyval(par, data_x) # for len(par) = 2, this is a line yvar = 0.01 return np.sum((data_y - mu) ** 2 / yvar) m = Minuit.from_array_func(least_squares_np, (0, 0), error=(1, 1), errordef=1) m.migrad() # Accessors for numpy arrays m.np_values() m.np_errors() m.np_covariance() iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 7/15
  • 9. Scipy interface iminuit Alternative interface to ease transition for Scipy users: from iminuit import minimize result = minimize(least_squares_np, (0, 0)) Same interface as scipy.optimize.minimize! Result is of type scipy.optimize.OptimizeResult. iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 8/15
  • 10. Standalone Minuit2 iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 9/15
  • 11. The need for Standalone Minuit2 Standalone Minuit2 Current state of a airs • Previous release: ROOT 5.20, 2008 • Poor C++11 support (warnings) • Old build-system • Not available via git Initial work • Created /GooFit/Minuit2 • Some external interest • Used internally in GooFit Many use cases for Minuit standalone • iminuit: Python, pip install • GooFit: GPU PDF fitter (also Python) • Hydra: GPU/CPU analysis toolkit Other potential users • TensorFlowAnalysis • Potential PyBind11 bindings (proof of concept in GooFit) iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 10/15
  • 12. Design Standalone Minuit2 Standard CMake builds • Modern CMake 3.1+ build system • Support producing source distribution without scripts • Support add_subdirectory in and outside ROOT cmake <path> make make install # optional • <path> can be root/math/minuit2 or standalone • make package and make package_source (read docs) work too Use it in (your) libraries • You can use without ROOT or even if you just have ROOT::Minuit2 missing. • Supports all the standard ways to use a CMake libraries # Use standalone add_subdirectory(minuit2) # Use from ROOT add_subdirectory(root/math/minuit2) # Use prebuilt find_package(Minuit2 CONFIG) # All methods target_link_libraries(MyProgram PRIVATE Minuit2::Minuit2) iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 11/15
  • 13. Package source design details Standalone Minuit2 External files • Selected external files I src/math I inc/Math I inc/Fit • Other files: I LGPL2_1.txt I LICENSE I version_number Minuit2 standalone distribution • Sits inside ROOT 6.14+ • Submodule: /GooFit/Minuit2 (synced with master) • Other downloads (source, binaries) hopefully available soon CMakeLists.txt • No conflicts: ROOT parts protected • Options shared • Calls Standalone.cmake copy_standalone.cmake • Can use files inplace in ROOT or standalone mode • Copies only made if requested for creating source package Other • Example of CMake use in examples/simple • CI Tests, include building example iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 12/15
  • 14. Documentation Standalone Minuit2 Tutorial documented in the book: Modern CMake on gitlab.io README.md • User introduction • Instructions for building • Instructions for CMake Packaged files from ROOT • Version • License DEVELOP.md • Developer introduction • Instructions for packaging • Tips for maintenance CMakeLists • Lots of helpful comments iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 13/15
  • 15. Summary iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 14/15
  • 16. Summary Summary iminuit • Powerful, pythonic interface to Minuit2 • Just a pip install away • Also in Conda for macOS, Linux, and Windows conda install -c conda-forge iminuit Minuit2 Standalone • Makes it easy to include Minuit2 in a CMake project any way you want to • Make it easy to build and use Minuit2 anywhere • Support for macOS, Linux, and Windows • Helpful documentation A PR is currently in progress to use standalone Minuit2 in iMinuit! iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 15/15
  • 17. Backup iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 16/15
  • 18. The procedure: Minuit2 patches Backup Timeline of patches, all 2018: • Fixed Minuit2 and ROOT separation February 27 • Fixed Windows support February 28 • Standard CMake options for MPI/OpenMP (+fixes) • Minuit2 standalone March 23 • Missing include in MinimumBuilder May 9 • Standalone target name improvements May 18 • MSVC 15 bug workaround July 19 iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 17/15
  • 19. Inside ROOT Backup Builds in source, no changes or copies made cmake /root/math/minuit2 make make install # optional Library usage add_subdirectory(root/math/minuit2) # Combined build # OR find_package(Minuit2 CONFIG) # Either build or install target_link_libraries(MyProgram PUBLIC Minuit2::Minuit2) iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 18/15
  • 20. Outside ROOT Backup Builds from source package cmake <root>/math/minuit2 # Optional make make install # optional Library usage add_subdirectory(minuit2) # Combined build # OR find_package(Minuit2 CONFIG) # Either build or install target_link_libraries(MyProgram Minuit2::Minuit2) iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 19/15
  • 21. Making a Source Package Backup cmake /root/math/minuit2 -Dminuit2-standalone=ON make package_source make purge # optional • Copies needed files into root/math/minuit2 • Utilizes standard CMake technology to make the source package (tar.gz and zip) • Purge removes all copied files • Copied files are ignored by git iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 20/15
  • 22. Binary Packages Backup # Linux/macOS # Windows cmake .. "C:Program FilesCMakebincmake.exe" .. make "C:Program FilesCMakebincmake.exe" --build . make package "C:Program FilesCMakebincmake.exe" --build . --target package • No copy needed, in or outside ROOT! • Makes platform installers (.msi, .sh, .rpm, etc.) • Supports Windows (tested on VC17 + OpenStack VM) iminuit and MINUIT2 Standalone Hans Dembinski for the iminuit authors, Henry Schreiner March 22, 2018 15/15