v0.7.0 #2030
Unanswered
matthewfeickert
asked this question in
General
v0.7.0
#2030
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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.0API.All backends are now fully compatible and tested with Python 3.10. (PR build: Add support for Python 3.10 across all backends #1809)
The$$\lim_{\lambda \to 0} ,\mathrm{Pois}(n | \lambda)$$ is well defined. (PR feat: Allow zero rate Poisson #1657)
pyhf.tensorlib.poissonAPI now allows for the expected rate parameterlamto be0in the case that the observed eventsnis0given that the limitpyhf.readxml.parsenow supports reading of XML configurations with absolute paths. To support this,pyhf xlm2jsonnow has a-v/--mountoption. (PR feat: Handle absolute paths in XML config files (xml2json / readxml) #1909)Support for model specifications without a parameter of interest defined is added. (PRs feat: Add POI-less specification support #1638, feat: Allow POI-less models via Workspace.model #1636)
The
pyhf.parameters.paramsetsclassessuggested_fixedattribute behavior has been updated. To access the behavior used inpyhfv0.6.xuse thesuggested_fixed_as_boolattribute. (PR refactor: Simplified parameters #1639)pyhf.pdf._ModelConfig.par_namesis changed to be a property attribute. (PR feat: Makepar_namesa _ModelConfig property attribute #2027)The order of model parameters is now sorted by model parameter name. (PR feat: Add setup for custom modifiers #1625)
Support for writing user custom modifiers is added. (PRs feat: Add setup for custom modifiers #1625, fix: custom modifier / new parameter support and test #1644)
Performance in
pyhf.readxmlis increased by improvements topyhf.readxml.import_root_histogram. (PR fix: Speed-up readxml by caching key lookup instead of using try/except #1691)pyhf.contrib.utils.downloadis now more robust to different target file types. (PRs refactor: Make contrib.utils.download robust to archive file types #1697, fix: Accept tar and zip headers in contrib.utils.download requests #1704)A
pyhf.default_backendhas been added that is configurable through adefaultkwarg inpyhf.set_backend. (PR feat: Configurable default backend #1646) This is part of work to makepyhffully automatic differentiable. (Issue Making pyhf differentiable #882)Schema validation now allows for both
listandpyhf.tensorlibobjects to exist in the model specification. (PR feat: Add support for arrayful JSON #1647)The minimum required dependencies have been updated to support added features:
scipy>=1.2.0(PR feat: Add autoscan for upper limit using TOMS Algorithm 748 #1274)click>=8.0.0(PRs feat: Handle absolute paths in XML config files (xml2json / readxml) #1909, build: Update lower bound of click to v8.0.0 #1958)jsonschema>=4.15.0(PRs fix: Base URI for jsonschema.RefResolver has better behavior #1976, build: Update lower bounds to jsonschema v4.15.0, importlib-resources v1.4.0 #1979)importlib_resources>=1.4.0(for Python 3.7, 3.8) (PR build: Update lower bounds to jsonschema v4.15.0, importlib-resources v1.4.0 #1979)typing_extensions>=3.7.4.3(for Python 3.7 only) (PRs feat: Add typehints to pyhf.tensor #1940, build: Update lower bound of typing-extensions to v3.7.4.3 #1961)The minimum required backend versions have been updated to support added features:
jax>=0.2.10,jaxlib>=0.1.61(PR build: Update lower bounds to tensorflow v2.7.0, jaxlib v0.1.61 #1962)torch>=1.10.0(PR feat: Allow zero rate Poisson #1657)tensorflow>=2.7.0,tensorflow-probability>=0.11.0(PRs build: Update lower bounds to tensorflow v2.7.0, jaxlib v0.1.61 #1962, feat: Allow zero rate Poisson #1657)iminuit>=2.7.0(PR build: Update lower bound on iminuit to v2.7.0 #1895)'xmlio'extra requiresuproot>=4.1.1(PR feat: Drop uproot3 for uproot4 for writing ROOT files #1567)Fixes
Use improvements to
jsonschema.RefResolverto avoidjsonschema.exceptions.RefResolutionError. (PR fix: Base URI for jsonschema.RefResolver has better behavior #1976)Use the conditional maximum likelihood estimators of the nuisance parameters to create the sampling distributions for
pyhf.infer.calculators.ToyCalculator. (PR fix: Use MLEs of NPs to create sampling distributions in ToyCalculator #1610) This follows the joint recommendations of the ATLAS and CMS experiments in Procedure for the LHC Higgs boson search combination in Summer 2011.Features
Python API
The following functions have been added to the
pyhf.tensorlibAPI:pyhf.tensorlib.transpose(PR feat: Add transpose function to tensorlib #1696)pyhf.tensorlib.percentile(PR feat: Add percentile function to tensorlib #817)pyhf.readxml.parsenow supports reading of XML configurations with absolute paths with the addition of themountsoptional argument. (PR feat: Handle absolute paths in XML config files (xml2json / readxml) #1909)Support for overriding the paths for finding schemas is added, using the
pyhfinstalled location as a base viapyhf.utils.schemas. (PRs feat: Alternative Schema Locations #1753, feat: Add contextlib support to pyhf.schema API #1818)>>> 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')In
pyhf.workspace.Workspace.modelthe parameter of interest specified in the measurement may now be overridden using the addedpoi_namekwarg. (PR feat: Allow POI-less models via Workspace.model #1636)The
pyhf.parameters.paramsetsclassessuggested_fixedattribute behavior has been updated to return alistofboolof lengthn_parameters. To access the behavior used inpyhfv0.6.xuse thesuggested_fixed_as_boolattribute. (PR refactor: Simplified parameters #1639)pyhf.pdf._ModelConfig.par_namesis changed to be a property attribute. (PR feat: Makepar_namesa _ModelConfig property attribute #2027)The order of model parameters is now sorted by model parameter name. (PR feat: Add setup for custom modifiers #1625)
Support for writing user custom modifiers is added.
(PRs feat: Add setup for custom modifiers #1625, fix: custom modifier / new parameter support and test #1644) This is still in the stage where it is targeted at expert users.
{modifier}_builderclasses are added for all modifiers. (PRs feat: Add setup for custom modifiers #1625) For example,pyhf.modifiers.histosys.histosys_builder.When using
pyhf.writexmland thenormfactorparameter config is missinginitsorbounds, fall back to using default values. (PRs fix: writexml handles missing parameter configs for normfactor #1819)Supported options for
pyhf.infer.hypotestcan now be passed as kwargs through thepyhf.infer.intervals.upper_limits.upper_limitAPI. (PR feat: Add hypotest kwargs to pyhf.infer.intervals.upperlimit #1613) This now enables things like usingpyhf.infer.calculators.ToyCalculatoras the calculator used for the hypothesis test scan:>>> 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_statisticsfunctions to be returned by use ofreturn_fitted_parskwarg with thepyhf.infer.test_statisticsfunctions andreturn_calculatorkwarg withpyhf.infer.hypotest. (PR feat: Expose fitted parameter values of implicit fits in test statistic calls #1554)A
validatekwarg has been added topyhf.workspace.Workspaceandpyhf.pdf.Modelto allow skipping validation. (PR feat: Configurable default backend #1646) This should only be used by expert users who understand the risks.A
pyhf.default_backendhas been added that is configurable through adefaultkwarg inpyhf.set_backend. (PR feat: Configurable default backend #1646) This allows setting thepyhf.default_backendto be different from the value ofpyhf.tensorlibreturned bypyhf.get_backend, which can be useful in situations where differentiable model construction is needed.>>> import jax >>> import pyhf >>> pyhf.set_backend("jax", default=True) >>> pyhf.set_backend("numpy") >>> pyhf.get_backend() (<pyhf.tensor.numpy_backend.numpy_backend object at 0x...>, <pyhf.optimize.scipy_optimizer object at 0x...>) >>> pyhf.default_backend <pyhf.tensor.jax_backend.jax_backend object at 0x...> >>> 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)]Schema validation now allows for both
listandpyhf.tensorlibobjects to exist in the model specification. (PR feat: Add support for arrayful JSON #1647)>>> 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
The
pyhf xlm2jsonCLI API now has a-v/--mountoption to support reading XML configurations with absolute paths. (PR feat: Handle absolute paths in XML config files (xml2json / readxml) #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!Deprecations
Python API
pyhf.infer.intervals.upperlimitAPI has been deprecated in favor ofpyhf.infer.intervals.upper_limits.upper_limit.The
pyhf.infer.intervals.upperlimitAPI will removed inpyhfv0.9.0.(PR feat: Add autoscan for upper limit using TOMS Algorithm 748 #1274)
Removals
Python API
The
pyhf.simplemodels.hepdata_likeAPI, deprecated sincepyhfv0.6.2, has been removed.(PR feat: Remove pyhf.simplemodels.hepdata_like from API #1670)
Use the
pyhf.simplemodels.uncorrelated_backgroundAPI instead.pyhf.workspace.Workspace'sparametersattribute is removed in favor ofusing
pyhf.pdf._ModelConfig'sparameters.(PR feat: Add setup for custom modifiers #1625)
pyhf.workspace.Workspace.get_measurementhas thepoi_namekwarg removed.(PR feat: Allow POI-less models via Workspace.model #1636)
Contributors
v0.7.0benefited from contributions from:Changes
include_auxdatakwarg forpyhf.Workspace.databy @matthewfeickert in fix: Update notebooks to useinclude_auxdatakwarg forpyhf.Workspace.data#1588pyhf.pdf._ModelConfig.channelsis a list by @RhnSharma in docs: Correct v0.6.3 release notes to notepyhf.pdf._ModelConfig.channelsis a list #1592jupyter-blackpre-commit hook overnbqa-blackby @matthewfeickert in ci: Usejupyter-blackpre-commit hook overnbqa-black#1598uproot4writing speedup to v0.6.3 release notes by @matthewfeickert in docs: Adduproot4writing speedup to v0.6.3 release notes #1601Acceptheader to requests incontrib.utils.downloadby @matthewfeickert in refactor: PassAcceptheader to requests incontrib.utils.download#1673_ModelConfig.suggested_fixedlist contains only booleans for all modifiers by @alexander-held in fix: Ensure_ModelConfig.suggested_fixedlist contains only booleans for all modifiers #1706pyhf.contrib.utils.downloadby @matthewfeickert in fix: Skip doctest ofpyhf.contrib.utils.download#1715tolistfallback by @matthewfeickert in fix: Accept ValueError for JAX backendtolistfallback #1746RuntimeWarningfrom NumPy by @matthewfeickert in fix: Allow for true_divide or divideRuntimeWarningfrom NumPy #1873github.workflowproperty to ensure unique concurrency group by @matthewfeickert in ci: Usegithub.workflowproperty to ensure unique concurrency group #1879find_namespace:to ensure discovery of package data by @matthewfeickert in build: Usefind_namespace:to ensure discovery of package data #1881license_filesin setup.cfg by @matthewfeickert in build: Uselicense_filesin setup.cfg #1883builderror on warnings by @matthewfeickert in ci: Makebuilderror on warnings #1887defs.jsonagain by @lhenkelm in fix: Populate the schema cache with localdefs.jsonagain #1917validatekwarg to top-level functions inpyhf.simplemodelsby @phinate in feat: Promotevalidatekwarg to top-level functions inpyhf.simplemodels#1858_ModelConfig.set_poi(None)to unset model POI by @kratsg in feat: Add support for_ModelConfig.set_poi(None)to unset model POI #1985--no-extrasfunctionality by @matthewfeickert in fix: Pin codemetapy to v0.3.5 for--no-extrasfunctionality #1995par_namesa _ModelConfig property attribute by @matthewfeickert in feat: Makepar_namesa _ModelConfig property attribute #2027New Contributors
pyhf.pdf._ModelConfig.channelsis a list #1592validatekwarg to top-level functions inpyhf.simplemodels#1858Full Changelog: v0.6.3...v0.7.0
This discussion was created from the release v0.7.0.
Beta Was this translation helpful? Give feedback.
All reactions