From 3998543d301e9f029bd6d15a2886efd868db068a Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 17 Nov 2021 23:52:58 -0600 Subject: [PATCH 01/42] Add Graeme Watt to contributor list --- docs/contributors.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/contributors.rst b/docs/contributors.rst index a0da954d61..7fdf9fcce0 100644 --- a/docs/contributors.rst +++ b/docs/contributors.rst @@ -27,6 +27,7 @@ Contributors include: - Mason Proffitt - Lars Henkelmann - Aryan Roy +- Graeme Watt - Jerry Ling - Nathan Simpson - Beojan Stanislaus From 15497054380eca285ab29f7ab10e855cdac03460 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 18 Nov 2021 00:02:09 -0600 Subject: [PATCH 02/42] Add stub of v0.7.0 release notes --- docs/release-notes/v0.7.0.rst | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docs/release-notes/v0.7.0.rst diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst new file mode 100644 index 0000000000..cc4c8a03bd --- /dev/null +++ b/docs/release-notes/v0.7.0.rst @@ -0,0 +1,60 @@ +|release v0.7.0|_ +================= + +This is a minor release from ``v0.6.3`` → ``v0.7.0``. + +Important Notes +--------------- + +* NEW IMPORTANT STUFF GOES HERE +* The minimum required backend versions have been updated to support added features: + + - JAX backend requires ``jax>=0.2.10`` + - PyTorch backend requires ``torch>=1.10.0`` + - TensorFlow backend requires ``tensorflow>=2.3.1`` + +Fixes +----- + +* FIXES HERE + +Features +-------- + +Python API +~~~~~~~~~~ + +* Supported options for :func:`pyhf.infer.hypotest` can now be passed as kwargs + through the :func:`pyhf.infer.intervals.upperlimit` API. + (PR :pr:`1613`) + This now enables things like using :class:`pyhf.infer.calculators.ToyCalculator` + as the calculator used for the hypothesis test scan: + + .. code:: pycon + + >>> import numpy as np + >>> import pyhf + >>> pyhf.set_backend("jax") + >>> model = pyhf.simplemodels.uncorrelated_background( + ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] + ... ) + >>> observations = [51, 48] + >>> data = pyhf.tensorlib.astensor(observations + model.config.auxdata) + >>> scan = np.linspace(0, 5, 21) + >>> obs_limit, exp_limits, (scan, results) = pyhf.infer.intervals.upperlimit( + ... data, model, scan, return_results=True, calctype="toybased", ntoys=3000 + ... ) + +Contributors +------------ + +``v0.7.0`` benefited from contributions from: + +* Alexander Held +* Mason Proffitt +* Lars Henkelmann +* Aryan Roy +* Graeme Watt + +.. |release v0.7.0| replace:: ``v0.7.0`` +.. _`release v0.7.0`: https://github.com/scikit-hep/pyhf/releases/tag/v0.7.0 From 0af86b6b81cdae0337875b849b2f3bcbd8852fea Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 18 Nov 2021 00:02:27 -0600 Subject: [PATCH 03/42] Add v0.7.0 to release notes page --- docs/release-notes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 0ce738d57a..87e9335ef9 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -2,6 +2,7 @@ Release Notes ============= +.. include:: release-notes/v0.7.0.rst .. include:: release-notes/v0.6.3.rst .. include:: release-notes/v0.6.2.rst .. include:: release-notes/v0.6.1.rst From 64530b2b5f0c2248731f0435598685da8e21526b Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 29 Aug 2022 14:27:04 -0500 Subject: [PATCH 04/42] docs: don't fail on invalid tag urls --- docs/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 276d85a52b..d36a231539 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -500,5 +500,7 @@ def setup(app): r'https://doi\.org/10\.31526/.*', # https://doi.org/10.1051/epjconf/x DOI URLs will periodically generate 500 Server Error r'https://doi\.org/10\.1051/epjconf/.*', + # tags for a release won't exist until it is made, but the release notes need to reference them + r' https://github.com/scikit-hep/pyhf/releases/tag/.*', ] linkcheck_retries = 50 From cf50905048aef32150e31751568e8463c8c7fc33 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 29 Aug 2022 14:39:37 -0500 Subject: [PATCH 05/42] typo --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index d36a231539..f9c747400c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -501,6 +501,6 @@ def setup(app): # https://doi.org/10.1051/epjconf/x DOI URLs will periodically generate 500 Server Error r'https://doi\.org/10\.1051/epjconf/.*', # tags for a release won't exist until it is made, but the release notes need to reference them - r' https://github.com/scikit-hep/pyhf/releases/tag/.*', + r'https://github.com/scikit-hep/pyhf/releases/tag/.*', ] linkcheck_retries = 50 From c40405bccd00dc42e2d6c7b6aafe58003e0b947d Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 29 Aug 2022 15:18:32 -0500 Subject: [PATCH 06/42] Update required depdnencies lower bounds --- docs/release-notes/v0.7.0.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index cc4c8a03bd..0a3cd95386 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -7,11 +7,16 @@ Important Notes --------------- * NEW IMPORTANT STUFF GOES HERE +* The minimum required dependencies have been updated to support added features: + + - ``click>=8.0.0`` + * The minimum required backend versions have been updated to support added features: - - JAX backend requires ``jax>=0.2.10`` + - JAX backend requires ``jax>=0.2.10``, ``jaxlib>=0.1.61`` - PyTorch backend requires ``torch>=1.10.0`` - - TensorFlow backend requires ``tensorflow>=2.3.1`` + - TensorFlow backend requires ``tensorflow>=2.7.0`` + - iminuit optimizer requires ``iminuit>=2.7.0`` Fixes ----- From 29aaef3b8ab424dda2e7020da0516991508bc1ff Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 15:06:27 -0500 Subject: [PATCH 07/42] Update contributors --- docs/release-notes/v0.7.0.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 0a3cd95386..588d0870fc 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -60,6 +60,9 @@ Contributors * Lars Henkelmann * Aryan Roy * Graeme Watt +* Jerry Ling +* Nathan Simpson +* Beojan Stanislaus .. |release v0.7.0| replace:: ``v0.7.0`` .. _`release v0.7.0`: https://github.com/scikit-hep/pyhf/releases/tag/v0.7.0 From 0c55deead50bad991f32fcf77a592e7c8adae755 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 15:09:51 -0500 Subject: [PATCH 08/42] Update dependencies lower bounds --- docs/release-notes/v0.7.0.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 588d0870fc..0deaced2ec 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -9,7 +9,11 @@ Important Notes * NEW IMPORTANT STUFF GOES HERE * The minimum required dependencies have been updated to support added features: + - ``scipy>=1.2.0`` - ``click>=8.0.0`` + - ``jsonschema>=4.15.0`` + - ``importlib_resources>=1.4.0`` (for Python 3.7, 3.8) + - ``typing_extensions>=3.7.4.3`` (for Python 3.7 only) * The minimum required backend versions have been updated to support added features: From 532efb62b1b646e342d14c898dcbc97c4f3ab87f Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 15:12:57 -0500 Subject: [PATCH 09/42] Update optional backends --- docs/release-notes/v0.7.0.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 0deaced2ec..1f4f3e7d19 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -19,8 +19,9 @@ Important Notes - JAX backend requires ``jax>=0.2.10``, ``jaxlib>=0.1.61`` - PyTorch backend requires ``torch>=1.10.0`` - - TensorFlow backend requires ``tensorflow>=2.7.0`` + - TensorFlow backend requires ``tensorflow>=2.7.0``, ``tensorflow-probability>=0.11.0`` - iminuit optimizer requires ``iminuit>=2.7.0`` + - xmlio extra requires ``uproot>=4.1.1`` Fixes ----- From e4710ce497eba04f3246c739deb7d8e7876a3c39 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 16:15:53 -0500 Subject: [PATCH 10/42] Fix upper_limits API --- docs/release-notes/v0.7.0.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 1f4f3e7d19..25ed5e566a 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -35,7 +35,7 @@ Python API ~~~~~~~~~~ * Supported options for :func:`pyhf.infer.hypotest` can now be passed as kwargs - through the :func:`pyhf.infer.intervals.upperlimit` API. + through the :func:`pyhf.infer.intervals.upper_limits.upper_limit` API. (PR :pr:`1613`) This now enables things like using :class:`pyhf.infer.calculators.ToyCalculator` as the calculator used for the hypothesis test scan: @@ -51,7 +51,7 @@ Python API >>> observations = [51, 48] >>> data = pyhf.tensorlib.astensor(observations + model.config.auxdata) >>> scan = np.linspace(0, 5, 21) - >>> obs_limit, exp_limits, (scan, results) = pyhf.infer.intervals.upperlimit( + >>> obs_limit, exp_limits, (scan, results) = pyhf.infer.intervals.upper_limits.upper_limit( ... data, model, scan, return_results=True, calctype="toybased", ntoys=3000 ... ) From 31ae520fe185bcc67de15814174ab0b95b0703df Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 16:22:07 -0500 Subject: [PATCH 11/42] Note deprecation of infer.upperlimit --- docs/release-notes/v0.7.0.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 25ed5e566a..97d05d6945 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -55,6 +55,18 @@ Python API ... data, model, scan, return_results=True, calctype="toybased", ntoys=3000 ... ) +Deprecations +------------ + +Python API +~~~~~~~~~~ + +* The :func:`pyhf.infer.intervals.upperlimit` API has been deprecated in favor of + :func:`pyhf.infer.intervals.upper_limits.upper_limit`. + The :func:`pyhf.infer.intervals.upperlimit` API will removed in ``pyhf`` ``v0.9.0``. + (PR :pr:`1274`) + + Contributors ------------ From d118c9b29428bfeaf668899814bab7d402f7f778 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 16:26:31 -0500 Subject: [PATCH 12/42] Note Python 3.10 support --- docs/release-notes/v0.7.0.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 97d05d6945..9388124817 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -6,7 +6,9 @@ This is a minor release from ``v0.6.3`` → ``v0.7.0``. Important Notes --------------- -* NEW IMPORTANT STUFF GOES HERE +* All backends are now fully compatible and tested with + `Python 3.10 `_. + (PR :pr:`1809`) * The minimum required dependencies have been updated to support added features: - ``scipy>=1.2.0`` From 973762f28bf5bd0f0c4ba5e8f342c8557f5da476 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 16:31:02 -0500 Subject: [PATCH 13/42] Add pyhf.contrib.utils.download improvements --- docs/release-notes/v0.7.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 9388124817..acad2746ac 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -9,6 +9,8 @@ Important Notes * All backends are now fully compatible and tested with `Python 3.10 `_. (PR :pr:`1809`) +* :func:`pyhf.contrib.utils.download` is now more robust to different target file types. + (PRs :pr:`1697`, :pr:`1704`) * The minimum required dependencies have been updated to support added features: - ``scipy>=1.2.0`` From 8e2320022b94b46ef004c8cfcc3e946166ebcf29 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 16:37:57 -0500 Subject: [PATCH 14/42] Add fix and helpdata_like removal --- docs/release-notes/v0.7.0.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index acad2746ac..556072cb95 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -30,7 +30,8 @@ Important Notes Fixes ----- -* FIXES HERE +* Use improvements to `jsonschema.RefResolver` to avoid `jsonschema.exceptions.RefResolutionError`. + (PR :pr:`1976`) Features -------- @@ -70,6 +71,15 @@ Python API The :func:`pyhf.infer.intervals.upperlimit` API will removed in ``pyhf`` ``v0.9.0``. (PR :pr:`1274`) +Removals +-------- + +Python API +~~~~~~~~~~ + +* The :func:`pyhf.simplemodels.hepdata_like` API, deprecated since ``pyhf`` + ``v0.6.2``, has been removed. + (PR :pr:`1670`) Contributors ------------ From 5e0c4a37f8a0459c85af75a771c9bca073f6bdfa Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 17:13:05 -0500 Subject: [PATCH 15/42] Add pyhf.default_backend --- docs/release-notes/v0.7.0.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 556072cb95..41346f470b 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -6,6 +6,9 @@ This is a minor release from ``v0.6.3`` → ``v0.7.0``. Important Notes --------------- +* A `pyhf.default_backend` has been added that is configurable through a + ``default`` kwarg in :func:`pyhf.set_backend`. + (PR :pr:`1646`) * All backends are now fully compatible and tested with `Python 3.10 `_. (PR :pr:`1809`) @@ -60,6 +63,31 @@ Python API ... data, model, scan, return_results=True, calctype="toybased", ntoys=3000 ... ) +* A ``pyhf.default_backend`` has been added that is configurable through a + ``default`` kwarg in :func:`pyhf.set_backend`. + (PR :pr:`1646`) + This allows setting setting the ``pyhf.default_backend`` to be different from the value of + ``pyhf.tensorlib`` returned by :func:`pyhf.get_backend`, which can be useful in situations where + a model construction is needed. + + .. code:: pycon + + >>> import jax + >>> import pyhf + >>> pyhf.set_backend("jax", default=True) + >>> pyhf.set_backend("numpy") + >>> pyhf.get_backend() + (, ) + >>> pyhf.default_backend + + >>> def example_op(x): + ... return 2 * pyhf.default_backend.power(pyhf.default_backend.astensor(x), 3) + ... + >>> example_op([2.0]) + DeviceArray([16.], dtype=float64) + >>> jax.jacrev(jax.jit(example_op))([2.0]) + [DeviceArray([24.], dtype=float64, weak_type=True)] + Deprecations ------------ From 9a61a83510ec1f6839d91b8f3d4cea5d6edc1b7e Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 17:15:35 -0500 Subject: [PATCH 16/42] fixup --- docs/release-notes/v0.7.0.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 41346f470b..bab447f834 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -6,7 +6,7 @@ This is a minor release from ``v0.6.3`` → ``v0.7.0``. Important Notes --------------- -* A `pyhf.default_backend` has been added that is configurable through a +* A ``pyhf.default_backend`` has been added that is configurable through a ``default`` kwarg in :func:`pyhf.set_backend`. (PR :pr:`1646`) * All backends are now fully compatible and tested with @@ -33,7 +33,7 @@ Important Notes Fixes ----- -* Use improvements to `jsonschema.RefResolver` to avoid `jsonschema.exceptions.RefResolutionError`. +* Use improvements to ``jsonschema.RefResolver`` to avoid ``jsonschema.exceptions.RefResolutionError``. (PR :pr:`1976`) Features From 218dd5ac3684e90a4581d89d1df8d94c2e710956 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 17:22:26 -0500 Subject: [PATCH 17/42] Note improved readxml speed --- docs/release-notes/v0.7.0.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index bab447f834..c8f31b8daf 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -6,12 +6,15 @@ This is a minor release from ``v0.6.3`` → ``v0.7.0``. Important Notes --------------- -* A ``pyhf.default_backend`` has been added that is configurable through a - ``default`` kwarg in :func:`pyhf.set_backend`. - (PR :pr:`1646`) * All backends are now fully compatible and tested with `Python 3.10 `_. (PR :pr:`1809`) +* A ``pyhf.default_backend`` has been added that is configurable through a + ``default`` kwarg in :func:`pyhf.set_backend`. + (PR :pr:`1646`) +* Performance in :class:`pyhf.readxml` is increased by improvements to + :func:`pyhf.readxml.import_root_histogram`. + (PR :pr:`1691`) * :func:`pyhf.contrib.utils.download` is now more robust to different target file types. (PRs :pr:`1697`, :pr:`1704`) * The minimum required dependencies have been updated to support added features: From bbe0eb346b4fee5710f1e9302b972f2101569d7d Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 17:29:54 -0500 Subject: [PATCH 18/42] Add skipping of validation --- docs/release-notes/v0.7.0.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index c8f31b8daf..9df2d93b28 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -70,8 +70,8 @@ Python API ``default`` kwarg in :func:`pyhf.set_backend`. (PR :pr:`1646`) This allows setting setting the ``pyhf.default_backend`` to be different from the value of - ``pyhf.tensorlib`` returned by :func:`pyhf.get_backend`, which can be useful in situations where - a model construction is needed. + ``pyhf.tensorlib`` returned by :func:`pyhf.get_backend`, which can be useful in situations + where differentiable model construction is needed. .. code:: pycon @@ -91,6 +91,11 @@ Python API >>> jax.jacrev(jax.jit(example_op))([2.0]) [DeviceArray([24.], dtype=float64, weak_type=True)] +* A ``validate`` kwarg has been added to :func:`pyhf.workspace.Workspace` to allow + skipping validation. + (PR :pr:`1646`) + This should only be used by expert users who understand the risks. + Deprecations ------------ From 6f6586e8dbbdb41743eaab7368a1e20961ff9cea Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 17:44:56 -0500 Subject: [PATCH 19/42] Add new tensorlib APIs --- docs/release-notes/v0.7.0.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 9df2d93b28..9420631a56 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -6,6 +6,8 @@ This is a minor release from ``v0.6.3`` → ``v0.7.0``. Important Notes --------------- +* Please note this release has **API breaking changes** and carefully read these + notes while updating your code to the ``v0.7.0`` API. * All backends are now fully compatible and tested with `Python 3.10 `_. (PR :pr:`1809`) @@ -96,6 +98,14 @@ Python API (PR :pr:`1646`) This should only be used by expert users who understand the risks. +* The following functions have been added to the ``pyhf.tensorlib`` API: + + + - :func:`pyhf.tensorlib.transpose` + (PR :pr:`1696`) + - :func:`pyhf.tensorlib.percentile` + (PR :pr:`817`) + Deprecations ------------ From bf95f3669838569977a481cf590f940d801a7e22 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 18:42:01 -0500 Subject: [PATCH 20/42] Add volume mounting to release notes --- docs/release-notes/v0.7.0.rst | 30 ++++++++++++++++++++++++++++-- src/pyhf/cli/rootio.py | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 9420631a56..3c7488271c 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -14,6 +14,9 @@ Important Notes * A ``pyhf.default_backend`` has been added that is configurable through a ``default`` kwarg in :func:`pyhf.set_backend`. (PR :pr:`1646`) +* :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. + To support this, ``pyhf xlm2json`` now has ``-v/--mount`` options. + (PR :pr:`1909`) * Performance in :class:`pyhf.readxml` is increased by improvements to :func:`pyhf.readxml.import_root_histogram`. (PR :pr:`1691`) @@ -93,8 +96,8 @@ Python API >>> jax.jacrev(jax.jit(example_op))([2.0]) [DeviceArray([24.], dtype=float64, weak_type=True)] -* A ``validate`` kwarg has been added to :func:`pyhf.workspace.Workspace` to allow - skipping validation. +* A ``validate`` kwarg has been added to :func:`pyhf.workspace.Workspace` and + :func:`pyhf.pdf.Model` to allow skipping validation. (PR :pr:`1646`) This should only be used by expert users who understand the risks. @@ -106,6 +109,29 @@ Python API - :func:`pyhf.tensorlib.percentile` (PR :pr:`817`) +* :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. + (PR :pr:`1909`) + +CLI API +~~~~~~~ + +* The ``pyhf xlm2json`` CLI API now has a ``-v/--mount`` option to support reading + XML configurations with absolute paths. + (PR :pr:`1909`) + Similar to Docker volume mounts, the options allows a user to pass two fields + separated by a colon (``:``). + The first field is a local path and the second field is the absolute path specified + in the XML configuration to be substituted. + Without the ``-v/--mount`` option a user would have to manually edit the absolute + path in each XML file it appeared in! + + .. code:: console + + pyhf xml2json \ + --mount /local/path/to/workspace:/absolute/path/to/replace/inside/xml \ + --output-file workspace.json \ + workspace/analysis_config.xml + Deprecations ------------ diff --git a/src/pyhf/cli/rootio.py b/src/pyhf/cli/rootio.py index d1312c2641..053304f381 100644 --- a/src/pyhf/cli/rootio.py +++ b/src/pyhf/cli/rootio.py @@ -27,7 +27,7 @@ def cli(): @click.option( '-v', '--mount', - help='Consists of two fields, separated by a colon character ( : ). The first field is the local path to where files are located, the second field is the path where the file or directory are saved in the XML configuration. This is similar in spirit to docker.', + help='Consists of two fields, separated by a colon character ( : ). The first field is the local path to where files are located, the second field is the path where the file or directory are saved in the XML configuration. This is similar in spirit to Docker.', type=VolumeMountPath(exists=True, resolve_path=True, path_type=Path), default=None, multiple=True, From e19d9b1f4307d63aa67b91d33fb5a1ceb3334b33 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 22:56:19 -0500 Subject: [PATCH 21/42] Note to use uncorrelated_background --- docs/release-notes/v0.7.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 3c7488271c..c6d2a9e15f 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -152,6 +152,7 @@ Python API * The :func:`pyhf.simplemodels.hepdata_like` API, deprecated since ``pyhf`` ``v0.6.2``, has been removed. (PR :pr:`1670`) + Use the :func:`pyhf.simplemodels.uncorrelated_background` API instead. Contributors ------------ From 32834651468f84b2d9302198f03b5310988cf117 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 23:04:59 -0500 Subject: [PATCH 22/42] Add zero rate Poisson --- docs/release-notes/v0.7.0.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index c6d2a9e15f..6a11e14282 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -14,6 +14,10 @@ Important Notes * A ``pyhf.default_backend`` has been added that is configurable through a ``default`` kwarg in :func:`pyhf.set_backend`. (PR :pr:`1646`) +* :func:`pyhf.tensorlib.poisson` now allows for the expected rate parameter ``lam`` + to be ``0`` in the case that the observed events ``n`` is ``0`` given that the + limit :math:`\lim_{\lambda \to 0} \,\mathrm{Pois}(n | \lambda)` is well defined. + (PR :pr:`1657`) * :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. To support this, ``pyhf xlm2json`` now has ``-v/--mount`` options. (PR :pr:`1909`) From 7980913132f6a5724064310b5947d21145446bea Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 23:21:10 -0500 Subject: [PATCH 23/42] As pyhf.tensorlib.X won't resolve to any one function as shim, don't use :func: with it --- docs/release-notes/v0.7.0.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 6a11e14282..e37c5b4e9c 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -14,9 +14,9 @@ Important Notes * A ``pyhf.default_backend`` has been added that is configurable through a ``default`` kwarg in :func:`pyhf.set_backend`. (PR :pr:`1646`) -* :func:`pyhf.tensorlib.poisson` now allows for the expected rate parameter ``lam`` - to be ``0`` in the case that the observed events ``n`` is ``0`` given that the - limit :math:`\lim_{\lambda \to 0} \,\mathrm{Pois}(n | \lambda)` is well defined. +* The ``pyhf.tensorlib.poisson`` API now allows for the expected rate parameter + ``lam`` to be ``0`` in the case that the observed events ``n`` is ``0`` given + that the limit :math:`\lim_{\lambda \to 0} \,\mathrm{Pois}(n | \lambda)` is well defined. (PR :pr:`1657`) * :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. To support this, ``pyhf xlm2json`` now has ``-v/--mount`` options. @@ -108,9 +108,9 @@ Python API * The following functions have been added to the ``pyhf.tensorlib`` API: - - :func:`pyhf.tensorlib.transpose` + - ``pyhf.tensorlib.transpose`` (PR :pr:`1696`) - - :func:`pyhf.tensorlib.percentile` + - ``pyhf.tensorlib.percentile`` (PR :pr:`817`) * :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. From 76e1cc165ad0ac356e73e7f0b6c6aecab785adf9 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 22 Sep 2022 23:28:35 -0500 Subject: [PATCH 24/42] Add arrayful JSON --- docs/release-notes/v0.7.0.rst | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index e37c5b4e9c..1fcf9f3430 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -11,9 +11,6 @@ Important Notes * All backends are now fully compatible and tested with `Python 3.10 `_. (PR :pr:`1809`) -* A ``pyhf.default_backend`` has been added that is configurable through a - ``default`` kwarg in :func:`pyhf.set_backend`. - (PR :pr:`1646`) * The ``pyhf.tensorlib.poisson`` API now allows for the expected rate parameter ``lam`` to be ``0`` in the case that the observed events ``n`` is ``0`` given that the limit :math:`\lim_{\lambda \to 0} \,\mathrm{Pois}(n | \lambda)` is well defined. @@ -26,6 +23,12 @@ Important Notes (PR :pr:`1691`) * :func:`pyhf.contrib.utils.download` is now more robust to different target file types. (PRs :pr:`1697`, :pr:`1704`) +* A ``pyhf.default_backend`` has been added that is configurable through a + ``default`` kwarg in :func:`pyhf.set_backend`. + (PR :pr:`1646`) +* :func:`pyhf.pdf.Model` now allows for both :class:`list` and ``pyhf.tensorlib`` objects + to exist in the ``spec``. + (PR :pr:`1647`) * The minimum required dependencies have been updated to support added features: - ``scipy>=1.2.0`` @@ -116,6 +119,21 @@ Python API * :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. (PR :pr:`1909`) +* :func:`pyhf.pdf.Model` now allows for both :class:`list` and ``pyhf.tensorlib`` objects + to exist in the ``spec``. + (PR :pr:`1647`) + + .. code:: pycon + + >>> import pyhf + >>> signal = pyhf.tensorlib.astensor([12.0, 11.0]) + >>> background = pyhf.tensorlib.astensor([50.0, 52.0]) + >>> background_uncertainty = pyhf.tensorlib.astensor([3.0, 7.0]) + >>> model = pyhf.simplemodels.uncorrelated_background( + ... signal=signal, bkg=background, bkg_uncertainty=background_uncertainty + ... ) + + CLI API ~~~~~~~ From f63f709abc9eaa51a8e0b963cdc0b32365e072e1 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 00:29:18 -0500 Subject: [PATCH 25/42] Add fix for MLE of NPs for ToyCalculator --- docs/release-notes/v0.7.0.rst | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 1fcf9f3430..181d287a0d 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -18,6 +18,8 @@ Important Notes * :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. To support this, ``pyhf xlm2json`` now has ``-v/--mount`` options. (PR :pr:`1909`) +* Support for writing user custom modifiers is added. + (PRs :pr:`1625`, :pr:`1644`) * Performance in :class:`pyhf.readxml` is increased by improvements to :func:`pyhf.readxml.import_root_histogram`. (PR :pr:`1691`) @@ -48,9 +50,16 @@ Important Notes Fixes ----- -* Use improvements to ``jsonschema.RefResolver`` to avoid ``jsonschema.exceptions.RefResolutionError``. +* Use improvements to ``jsonschema.RefResolver`` to avoid + ``jsonschema.exceptions.RefResolutionError``. (PR :pr:`1976`) +* Use the conditional maximum likelihood estimators of the nuisance parameters + to create the sampling distributions for :class:`pyhf.infer.calculators.ToyCalculator`. + (PR :pr:`1610`) + This follows the joint recommendations of the ATLAS and CMS experiments in + |LHC Higgs search combination procedure|_. + Features -------- @@ -78,6 +87,13 @@ Python API ... data, model, scan, return_results=True, calctype="toybased", ntoys=3000 ... ) +* Add ``{modifier}_builder`` classes for all modifiers. + (PRs :pr:`1625`) + For example, :class:`pyhf.modifiers.histosys.histosys_builder`. + +* Support for writing user custom modifiers is added. + (PRs :pr:`1625`, :pr:`1644`) + * A ``pyhf.default_backend`` has been added that is configurable through a ``default`` kwarg in :func:`pyhf.set_backend`. (PR :pr:`1646`) @@ -176,6 +192,10 @@ Python API (PR :pr:`1670`) Use the :func:`pyhf.simplemodels.uncorrelated_background` API instead. +* :class:`pyhf.workspace.Workspace`'s ``parameters`` attribute is removed in favor of + using :class:`pyhf.pdf._ModelConfig`'s ``parameters``. + (PR :pr:`1625`) + Contributors ------------ @@ -192,3 +212,6 @@ Contributors .. |release v0.7.0| replace:: ``v0.7.0`` .. _`release v0.7.0`: https://github.com/scikit-hep/pyhf/releases/tag/v0.7.0 + +.. _LHC Higgs search combination procedure: https://inspirehep.net/literature/1196797 +.. |LHC Higgs search combination procedure| replace:: *Procedure for the LHC Higgs boson search combination in Summer 2011* From 0df7e7c362bc306e788d38391f47102c2121f192 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 00:39:07 -0500 Subject: [PATCH 26/42] Add PR 1636 effects --- docs/release-notes/v0.7.0.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 181d287a0d..81bd1a180c 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -23,6 +23,8 @@ Important Notes * Performance in :class:`pyhf.readxml` is increased by improvements to :func:`pyhf.readxml.import_root_histogram`. (PR :pr:`1691`) +* Support for model specifications without a parameter of interest defined is added. + (PRs :pr:`1638`, :pr:`1636`) * :func:`pyhf.contrib.utils.download` is now more robust to different target file types. (PRs :pr:`1697`, :pr:`1704`) * A ``pyhf.default_backend`` has been added that is configurable through a @@ -91,6 +93,10 @@ Python API (PRs :pr:`1625`) For example, :class:`pyhf.modifiers.histosys.histosys_builder`. +* In :func:`pyhf.workspace.Workspace.model` the parameter of interest specified + in the measurement may now be overridden using the added ``poi_name`` kwarg. + (PR :pr:`1636`) + * Support for writing user custom modifiers is added. (PRs :pr:`1625`, :pr:`1644`) @@ -196,6 +202,9 @@ Python API using :class:`pyhf.pdf._ModelConfig`'s ``parameters``. (PR :pr:`1625`) +* :func:`pyhf.workspace.Workspace.get_measurement` has the ``poi_name`` kwarg removed. + (PR :pr:`1636`) + Contributors ------------ From 336093428a05e8e19c67b8406a2c6fad549e4fdc Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 00:46:46 -0500 Subject: [PATCH 27/42] Add fit parameter value returns --- docs/release-notes/v0.7.0.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 81bd1a180c..1f1fff11b2 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -100,6 +100,12 @@ Python API * Support for writing user custom modifiers is added. (PRs :pr:`1625`, :pr:`1644`) +* Allow for fit parameter values from required fits in ``pyhf.infer.test_statistics`` + functions to be returned by use of ``return_fitted_pars`` kwarg with the + ``pyhf.infer.test_statistics`` functions and ``return_calculator`` kwarg with + :func:`pyhf.infer.hypotest`. + (PR :pr:`1554`) + * A ``pyhf.default_backend`` has been added that is configurable through a ``default`` kwarg in :func:`pyhf.set_backend`. (PR :pr:`1646`) From 59821087950bbe9ef527e98bdd3d3bcc5d07cc9d Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 01:05:46 -0500 Subject: [PATCH 28/42] Add custom schema paths --- docs/release-notes/v0.7.0.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 1f1fff11b2..9601fd4be6 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -89,6 +89,25 @@ Python API ... data, model, scan, return_results=True, calctype="toybased", ntoys=3000 ... ) +* Add support for overriding the paths for finding schemas, using the ``pyhf`` + installed location as a base via ``pyhf.utils.schemas``. + (PRs :pr:`1753`, :pr:`1818``) + + .. code:: pycon + + >>> from pathlib import Path + >>> import pyhf.schema + >>> current_schema_path = pyhf.schema.path + >>> current_schema_path + PosixPath('/path/to/your/venv/lib/python3.X/site-packages/pyhf/schemas') + >>> custom_schema_path = Path("/path/to/custom/pyhf/schema") + >>> with pyhf.schema(custom_schema_path): + ... print(repr(pyhf.schema.path)) + ... + PosixPath('/path/to/custom/pyhf/schema') + >>> pyhf.schema.path + PosixPath('/path/to/your/venv/lib/python3.X/site-packages/pyhf/schemas') + * Add ``{modifier}_builder`` classes for all modifiers. (PRs :pr:`1625`) For example, :class:`pyhf.modifiers.histosys.histosys_builder`. From 97fc164c7f348325111bd06a095c3d161c612a34 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 01:10:11 -0500 Subject: [PATCH 29/42] Add 1819 --- docs/release-notes/v0.7.0.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 9601fd4be6..42ec642305 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -108,6 +108,10 @@ Python API >>> pyhf.schema.path PosixPath('/path/to/your/venv/lib/python3.X/site-packages/pyhf/schemas') +* When using ``pyhf.writexml`` and the ``normfactor`` parameter config is missing + ``inits`` or ``bounds``, fall back to using default values. + (PRs :pr:`1819`) + * Add ``{modifier}_builder`` classes for all modifiers. (PRs :pr:`1625`) For example, :class:`pyhf.modifiers.histosys.histosys_builder`. From 4ab20d1ae6fa7e4570adb433abec3f609e7e0a41 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 01:13:08 -0500 Subject: [PATCH 30/42] Reorder important notes --- docs/release-notes/v0.7.0.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 42ec642305..1f14e21161 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -18,13 +18,13 @@ Important Notes * :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. To support this, ``pyhf xlm2json`` now has ``-v/--mount`` options. (PR :pr:`1909`) +* Support for model specifications without a parameter of interest defined is added. + (PRs :pr:`1638`, :pr:`1636`) * Support for writing user custom modifiers is added. (PRs :pr:`1625`, :pr:`1644`) * Performance in :class:`pyhf.readxml` is increased by improvements to :func:`pyhf.readxml.import_root_histogram`. (PR :pr:`1691`) -* Support for model specifications without a parameter of interest defined is added. - (PRs :pr:`1638`, :pr:`1636`) * :func:`pyhf.contrib.utils.download` is now more robust to different target file types. (PRs :pr:`1697`, :pr:`1704`) * A ``pyhf.default_backend`` has been added that is configurable through a From ae1a4a2eb418acf25ca834d6c5e9e1b079e076ff Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 01:17:28 -0500 Subject: [PATCH 31/42] Reoder features section --- docs/release-notes/v0.7.0.rst | 86 +++++++++++++++++------------------ 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 1f14e21161..74ff3bfbd9 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -68,30 +68,20 @@ Features Python API ~~~~~~~~~~ -* Supported options for :func:`pyhf.infer.hypotest` can now be passed as kwargs - through the :func:`pyhf.infer.intervals.upper_limits.upper_limit` API. - (PR :pr:`1613`) - This now enables things like using :class:`pyhf.infer.calculators.ToyCalculator` - as the calculator used for the hypothesis test scan: +* The following functions have been added to the ``pyhf.tensorlib`` API: - .. code:: pycon - >>> import numpy as np - >>> import pyhf - >>> pyhf.set_backend("jax") - >>> model = pyhf.simplemodels.uncorrelated_background( - ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] - ... ) - >>> observations = [51, 48] - >>> data = pyhf.tensorlib.astensor(observations + model.config.auxdata) - >>> scan = np.linspace(0, 5, 21) - >>> obs_limit, exp_limits, (scan, results) = pyhf.infer.intervals.upper_limits.upper_limit( - ... data, model, scan, return_results=True, calctype="toybased", ntoys=3000 - ... ) + - ``pyhf.tensorlib.transpose`` + (PR :pr:`1696`) + - ``pyhf.tensorlib.percentile`` + (PR :pr:`817`) + +* :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. + (PR :pr:`1909`) * Add support for overriding the paths for finding schemas, using the ``pyhf`` installed location as a base via ``pyhf.utils.schemas``. - (PRs :pr:`1753`, :pr:`1818``) + (PRs :pr:`1753`, :pr:`1818`) .. code:: pycon @@ -108,14 +98,6 @@ Python API >>> pyhf.schema.path PosixPath('/path/to/your/venv/lib/python3.X/site-packages/pyhf/schemas') -* When using ``pyhf.writexml`` and the ``normfactor`` parameter config is missing - ``inits`` or ``bounds``, fall back to using default values. - (PRs :pr:`1819`) - -* Add ``{modifier}_builder`` classes for all modifiers. - (PRs :pr:`1625`) - For example, :class:`pyhf.modifiers.histosys.histosys_builder`. - * In :func:`pyhf.workspace.Workspace.model` the parameter of interest specified in the measurement may now be overridden using the added ``poi_name`` kwarg. (PR :pr:`1636`) @@ -123,12 +105,46 @@ Python API * Support for writing user custom modifiers is added. (PRs :pr:`1625`, :pr:`1644`) +* Add ``{modifier}_builder`` classes for all modifiers. + (PRs :pr:`1625`) + For example, :class:`pyhf.modifiers.histosys.histosys_builder`. + +* When using ``pyhf.writexml`` and the ``normfactor`` parameter config is missing + ``inits`` or ``bounds``, fall back to using default values. + (PRs :pr:`1819`) + +* Supported options for :func:`pyhf.infer.hypotest` can now be passed as kwargs + through the :func:`pyhf.infer.intervals.upper_limits.upper_limit` API. + (PR :pr:`1613`) + This now enables things like using :class:`pyhf.infer.calculators.ToyCalculator` + as the calculator used for the hypothesis test scan: + + .. code:: pycon + + >>> import numpy as np + >>> import pyhf + >>> pyhf.set_backend("jax") + >>> model = pyhf.simplemodels.uncorrelated_background( + ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] + ... ) + >>> observations = [51, 48] + >>> data = pyhf.tensorlib.astensor(observations + model.config.auxdata) + >>> scan = np.linspace(0, 5, 21) + >>> obs_limit, exp_limits, (scan, results) = pyhf.infer.intervals.upper_limits.upper_limit( + ... data, model, scan, return_results=True, calctype="toybased", ntoys=3000 + ... ) + * Allow for fit parameter values from required fits in ``pyhf.infer.test_statistics`` functions to be returned by use of ``return_fitted_pars`` kwarg with the ``pyhf.infer.test_statistics`` functions and ``return_calculator`` kwarg with :func:`pyhf.infer.hypotest`. (PR :pr:`1554`) +* A ``validate`` kwarg has been added to :func:`pyhf.workspace.Workspace` and + :func:`pyhf.pdf.Model` to allow skipping validation. + (PR :pr:`1646`) + This should only be used by expert users who understand the risks. + * A ``pyhf.default_backend`` has been added that is configurable through a ``default`` kwarg in :func:`pyhf.set_backend`. (PR :pr:`1646`) @@ -154,22 +170,6 @@ Python API >>> jax.jacrev(jax.jit(example_op))([2.0]) [DeviceArray([24.], dtype=float64, weak_type=True)] -* A ``validate`` kwarg has been added to :func:`pyhf.workspace.Workspace` and - :func:`pyhf.pdf.Model` to allow skipping validation. - (PR :pr:`1646`) - This should only be used by expert users who understand the risks. - -* The following functions have been added to the ``pyhf.tensorlib`` API: - - - - ``pyhf.tensorlib.transpose`` - (PR :pr:`1696`) - - ``pyhf.tensorlib.percentile`` - (PR :pr:`817`) - -* :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. - (PR :pr:`1909`) - * :func:`pyhf.pdf.Model` now allows for both :class:`list` and ``pyhf.tensorlib`` objects to exist in the ``spec``. (PR :pr:`1647`) From 7d15bde60172cf9d36dc80f30c8d7b6b8fde545b Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 01:24:57 -0500 Subject: [PATCH 32/42] Use pyhf.readxml.parse --- docs/release-notes/v0.7.0.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 74ff3bfbd9..67a33692b4 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -15,7 +15,7 @@ Important Notes ``lam`` to be ``0`` in the case that the observed events ``n`` is ``0`` given that the limit :math:`\lim_{\lambda \to 0} \,\mathrm{Pois}(n | \lambda)` is well defined. (PR :pr:`1657`) -* :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. +* :func:`pyhf.readxml.parse` now supports reading of XML configurations with absolute paths. To support this, ``pyhf xlm2json`` now has ``-v/--mount`` options. (PR :pr:`1909`) * Support for model specifications without a parameter of interest defined is added. @@ -76,7 +76,8 @@ Python API - ``pyhf.tensorlib.percentile`` (PR :pr:`817`) -* :class:`pyhf.readxml` now supports reading of XML configurations with absolute paths. +* :func:`pyhf.readxml.parse` now supports reading of XML configurations with absolute paths + with the addition of the ``mounts`` optional argument. (PR :pr:`1909`) * Add support for overriding the paths for finding schemas, using the ``pyhf`` From 691888fa9f1590ad01af509203aef3b0cf761cdf Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 01:37:07 -0500 Subject: [PATCH 33/42] Add generating PRs --- docs/release-notes/v0.7.0.rst | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 67a33692b4..7e52dc6dab 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -35,19 +35,19 @@ Important Notes (PR :pr:`1647`) * The minimum required dependencies have been updated to support added features: - - ``scipy>=1.2.0`` - - ``click>=8.0.0`` - - ``jsonschema>=4.15.0`` - - ``importlib_resources>=1.4.0`` (for Python 3.7, 3.8) - - ``typing_extensions>=3.7.4.3`` (for Python 3.7 only) + - ``scipy>=1.2.0`` (PR :pr:`1274`) + - ``click>=8.0.0`` (PRs :pr:`1909`, :pr:`1958`) + - ``jsonschema>=4.15.0`` (PRs :pr:`1976`, :pr:`1979`) + - ``importlib_resources>=1.4.0`` (for Python 3.7, 3.8) (PR :pr:`1979`) + - ``typing_extensions>=3.7.4.3`` (for Python 3.7 only) (PRs :pr:`1940`, :pr:`1961`) * The minimum required backend versions have been updated to support added features: - - JAX backend requires ``jax>=0.2.10``, ``jaxlib>=0.1.61`` - - PyTorch backend requires ``torch>=1.10.0`` - - TensorFlow backend requires ``tensorflow>=2.7.0``, ``tensorflow-probability>=0.11.0`` - - iminuit optimizer requires ``iminuit>=2.7.0`` - - xmlio extra requires ``uproot>=4.1.1`` + - JAX backend requires ``jax>=0.2.10``, ``jaxlib>=0.1.61`` (PR :pr:`1962`) + - PyTorch backend requires ``torch>=1.10.0`` (PR :pr:`1657`) + - TensorFlow backend requires ``tensorflow>=2.7.0``, ``tensorflow-probability>=0.11.0`` (PRs :pr:`1962`, :pr:`1657`) + - iminuit optimizer requires ``iminuit>=2.7.0`` (PR :pr:`1895`) + - xmlio extra requires ``uproot>=4.1.1`` (PR :pr:`1567`) Fixes ----- @@ -71,10 +71,8 @@ Python API * The following functions have been added to the ``pyhf.tensorlib`` API: - - ``pyhf.tensorlib.transpose`` - (PR :pr:`1696`) - - ``pyhf.tensorlib.percentile`` - (PR :pr:`817`) + - ``pyhf.tensorlib.transpose`` (PR :pr:`1696`) + - ``pyhf.tensorlib.percentile`` (PR :pr:`817`) * :func:`pyhf.readxml.parse` now supports reading of XML configurations with absolute paths with the addition of the ``mounts`` optional argument. From db47eeee4df1e08feccd6509034eb422de7470c1 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 02:03:56 -0500 Subject: [PATCH 34/42] try to clarify the xmlio is an install extra via notation --- docs/release-notes/v0.7.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 7e52dc6dab..0b51b4dd05 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -47,7 +47,7 @@ Important Notes - PyTorch backend requires ``torch>=1.10.0`` (PR :pr:`1657`) - TensorFlow backend requires ``tensorflow>=2.7.0``, ``tensorflow-probability>=0.11.0`` (PRs :pr:`1962`, :pr:`1657`) - iminuit optimizer requires ``iminuit>=2.7.0`` (PR :pr:`1895`) - - xmlio extra requires ``uproot>=4.1.1`` (PR :pr:`1567`) + - ``'xmlio'`` extra requires ``uproot>=4.1.1`` (PR :pr:`1567`) Fixes ----- From f878d869a9e0873a58b9212c8780078cd9efaccf Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 02:09:31 -0500 Subject: [PATCH 35/42] fixups --- docs/release-notes/v0.7.0.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 0b51b4dd05..7d92606de3 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -16,7 +16,7 @@ Important Notes that the limit :math:`\lim_{\lambda \to 0} \,\mathrm{Pois}(n | \lambda)` is well defined. (PR :pr:`1657`) * :func:`pyhf.readxml.parse` now supports reading of XML configurations with absolute paths. - To support this, ``pyhf xlm2json`` now has ``-v/--mount`` options. + To support this, ``pyhf xlm2json`` now has a ``-v/--mount`` option. (PR :pr:`1909`) * Support for model specifications without a parameter of interest defined is added. (PRs :pr:`1638`, :pr:`1636`) @@ -78,7 +78,7 @@ Python API with the addition of the ``mounts`` optional argument. (PR :pr:`1909`) -* Add support for overriding the paths for finding schemas, using the ``pyhf`` +* Support for overriding the paths for finding schemas is added, using the ``pyhf`` installed location as a base via ``pyhf.utils.schemas``. (PRs :pr:`1753`, :pr:`1818`) @@ -104,7 +104,7 @@ Python API * Support for writing user custom modifiers is added. (PRs :pr:`1625`, :pr:`1644`) -* Add ``{modifier}_builder`` classes for all modifiers. +* ``{modifier}_builder`` classes are added for all modifiers. (PRs :pr:`1625`) For example, :class:`pyhf.modifiers.histosys.histosys_builder`. @@ -147,7 +147,7 @@ Python API * A ``pyhf.default_backend`` has been added that is configurable through a ``default`` kwarg in :func:`pyhf.set_backend`. (PR :pr:`1646`) - This allows setting setting the ``pyhf.default_backend`` to be different from the value of + This allows setting the ``pyhf.default_backend`` to be different from the value of ``pyhf.tensorlib`` returned by :func:`pyhf.get_backend`, which can be useful in situations where differentiable model construction is needed. From aa2c1707e46b1977b6c10be9cfa44ce4d6f7e1eb Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 11:09:59 -0500 Subject: [PATCH 36/42] Note autodiff goals --- docs/release-notes/v0.7.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 7d92606de3..747c0e0e45 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -30,6 +30,8 @@ Important Notes * A ``pyhf.default_backend`` has been added that is configurable through a ``default`` kwarg in :func:`pyhf.set_backend`. (PR :pr:`1646`) + This is as part of work to make ``pyhf`` fully automatic differentiable. + (Issue :issue:`882`) * :func:`pyhf.pdf.Model` now allows for both :class:`list` and ``pyhf.tensorlib`` objects to exist in the ``spec``. (PR :pr:`1647`) From 7742678507731d157fff309abd957d70fdfb500f Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 11:23:12 -0500 Subject: [PATCH 37/42] Emphasize schema validation --- docs/release-notes/v0.7.0.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 747c0e0e45..133441801f 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -32,8 +32,8 @@ Important Notes (PR :pr:`1646`) This is as part of work to make ``pyhf`` fully automatic differentiable. (Issue :issue:`882`) -* :func:`pyhf.pdf.Model` now allows for both :class:`list` and ``pyhf.tensorlib`` objects - to exist in the ``spec``. +* Schema validation now allows for both :class:`list` and ``pyhf.tensorlib`` objects + to exist in the model specification. (PR :pr:`1647`) * The minimum required dependencies have been updated to support added features: @@ -171,8 +171,8 @@ Python API >>> jax.jacrev(jax.jit(example_op))([2.0]) [DeviceArray([24.], dtype=float64, weak_type=True)] -* :func:`pyhf.pdf.Model` now allows for both :class:`list` and ``pyhf.tensorlib`` objects - to exist in the ``spec``. +* Schema validation now allows for both :class:`list` and ``pyhf.tensorlib`` objects + to exist in the model specification. (PR :pr:`1647`) .. code:: pycon From 95908d383fdef83191bcc66aa0e32d5bcd4c973a Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 11:44:12 -0500 Subject: [PATCH 38/42] Note PR 1639 as suggested by Alex --- docs/release-notes/v0.7.0.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 133441801f..b78401f608 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -20,6 +20,10 @@ Important Notes (PR :pr:`1909`) * Support for model specifications without a parameter of interest defined is added. (PRs :pr:`1638`, :pr:`1636`) +* The :class:`pyhf.parameters.paramsets` classes ``suggested_fixed`` attribute behavior has + been updated. + To access the behavior used in ``pyhf`` ``v0.6.x`` use the ``suggested_fixed_as_bool`` attribute. + (PR :pr:`1639`) * Support for writing user custom modifiers is added. (PRs :pr:`1625`, :pr:`1644`) * Performance in :class:`pyhf.readxml` is increased by improvements to @@ -103,6 +107,11 @@ Python API in the measurement may now be overridden using the added ``poi_name`` kwarg. (PR :pr:`1636`) +* The :class:`pyhf.parameters.paramsets` classes ``suggested_fixed`` attribute behavior has + been updated to return a :class:`list` of :class:`bool` of length ``n_parameters``. + To access the behavior used in ``pyhf`` ``v0.6.x`` use the ``suggested_fixed_as_bool`` attribute. + (PR :pr:`1639`) + * Support for writing user custom modifiers is added. (PRs :pr:`1625`, :pr:`1644`) From 3a98bfc446e8961dab966139d9e6b34038e5c649 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 11:58:31 -0500 Subject: [PATCH 39/42] Note that model parameters are now sorted as pointed out by Alex --- docs/release-notes/v0.7.0.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index b78401f608..ebba9deaac 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -24,6 +24,8 @@ Important Notes been updated. To access the behavior used in ``pyhf`` ``v0.6.x`` use the ``suggested_fixed_as_bool`` attribute. (PR :pr:`1639`) +* The order of model parameters is now sorted by model parameter name. + (PR :pr:`1625`) * Support for writing user custom modifiers is added. (PRs :pr:`1625`, :pr:`1644`) * Performance in :class:`pyhf.readxml` is increased by improvements to @@ -112,6 +114,23 @@ Python API To access the behavior used in ``pyhf`` ``v0.6.x`` use the ``suggested_fixed_as_bool`` attribute. (PR :pr:`1639`) +* The order of model parameters is now sorted by model parameter name. + (PR :pr:`1625`) + + .. code:: pycon + + >>> import pyhf + >>> model = pyhf.simplemodels.correlated_background( + ... signal=[12.0, 11.0], + ... bkg=[50.0, 52.0], + ... bkg_up=[45.0, 57.0], + ... bkg_down=[55.0, 47.0], + ... ) + >>> model.config.par_order + ['correlated_bkg_uncertainty', 'mu'] + >>> model.config.par_names() + ['correlated_bkg_uncertainty', 'mu'] + * Support for writing user custom modifiers is added. (PRs :pr:`1625`, :pr:`1644`) From b469bee8e6f137a3028ee96e235e3b069476e907 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 12:03:24 -0500 Subject: [PATCH 40/42] Note that custom modifiers are for expert users as suggested by Alex --- docs/release-notes/v0.7.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index ebba9deaac..aefce98239 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -133,6 +133,8 @@ Python API * Support for writing user custom modifiers is added. (PRs :pr:`1625`, :pr:`1644`) + This is still in the stage where it is `targeted at expert users + `_. * ``{modifier}_builder`` classes are added for all modifiers. (PRs :pr:`1625`) From 95110421abfb7ae229a290886efc3a105774a247 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 15:11:32 -0500 Subject: [PATCH 41/42] Add par_names is now a property attribute - PR 2027 --- docs/release-notes/v0.7.0.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index aefce98239..38d60e988f 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -24,6 +24,8 @@ Important Notes been updated. To access the behavior used in ``pyhf`` ``v0.6.x`` use the ``suggested_fixed_as_bool`` attribute. (PR :pr:`1639`) +* ``pyhf.pdf._ModelConfig.par_names`` is changed to be a property attribute. + (PR :pr:`2027`) * The order of model parameters is now sorted by model parameter name. (PR :pr:`1625`) * Support for writing user custom modifiers is added. @@ -114,6 +116,9 @@ Python API To access the behavior used in ``pyhf`` ``v0.6.x`` use the ``suggested_fixed_as_bool`` attribute. (PR :pr:`1639`) +* ``pyhf.pdf._ModelConfig.par_names`` is changed to be a property attribute. + (PR :pr:`2027`) + * The order of model parameters is now sorted by model parameter name. (PR :pr:`1625`) @@ -128,7 +133,7 @@ Python API ... ) >>> model.config.par_order ['correlated_bkg_uncertainty', 'mu'] - >>> model.config.par_names() + >>> model.config.par_names ['correlated_bkg_uncertainty', 'mu'] * Support for writing user custom modifiers is added. From 2db2b63b0348ebf1e0efb7f9def3e70b8c789f85 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 23 Sep 2022 16:02:37 -0500 Subject: [PATCH 42/42] grammar fix --- docs/release-notes/v0.7.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release-notes/v0.7.0.rst b/docs/release-notes/v0.7.0.rst index 38d60e988f..f6c17aca9f 100644 --- a/docs/release-notes/v0.7.0.rst +++ b/docs/release-notes/v0.7.0.rst @@ -38,7 +38,7 @@ Important Notes * A ``pyhf.default_backend`` has been added that is configurable through a ``default`` kwarg in :func:`pyhf.set_backend`. (PR :pr:`1646`) - This is as part of work to make ``pyhf`` fully automatic differentiable. + This is part of work to make ``pyhf`` fully automatic differentiable. (Issue :issue:`882`) * Schema validation now allows for both :class:`list` and ``pyhf.tensorlib`` objects to exist in the model specification.