Cabinetry

Latest version: v0.6.0

Safety actively analyzes 629599 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 4

0.3.0

This release adds the possibility to access figures produced by `cabinetry` for further customization and introduces a list of breaking API changes. It also adds more features to the specification of systematic uncertainties, labels to kinematic distributions, caching for yield uncertainty calculations, and additional validation for `cabinetry` configurations. The minimum required `pyhf` version for this version of `cabinetry` is 0.6.3, and Python 3.9 is now officially supported.

The `cabinetry.visualize` API has changed in several ways. Model predictions are no longer automatically produced within `visualize.data_mc`, but now have to be produced via `model_utils.prediction`. An optional `fit_results` argument allows to create post-fit distributions, and if it is not set, pre-fit distributions are produced. Example:

_old:_
python
cabinetry.visualize.data_mc(model, data, fit_results=fit_results)


_new:_
python
model_pred = cabinetry.model_utils.prediction(model, fit_results=fit_results)
cabinetry.visualize.data_mc(model_pred, data)


The yield table functionality has been removed from `visualize.data_mc` and is instead available via `tabulate.yields`, which also takes a model prediction as input. See 267 for more information about these changes.

Functions in the `visualize` module now return the figures they produce. The following functions return a single figure: `correlation_matrix`, `pulls`, `ranking`, `scan`, `limit`. The functions `data_mc` and `templates` can create more than one figure, and therefore return a list of dictionaries containing figures and relevant associated information (region name, or region / sample / systematic name, respectively).

Users may modify, customize and save the returned figures. A new `save_figure` argument has been added to the `visualize` API to turn off automatic saving if desired.

**Breaking changes:**
- Many functions in the public `cabinetry` API have been renamed. `get_` prefixes have been removed from all function, and capitalization has been removed. Functionality from the `contrib.visualize_matplotlib` module has been split into `visualize.plot_model`, `visualize.plot_results` and `visualize.utils` (see 250). The following list shows changes other than the cases of removed `get_` prefixes (see 263 for a full list).
- `histo.build_name` -> `hist.name`
- `model_utils.build_Asimov_data` -> `model_utils.asimov_data`
- `model_utils.calculate_stdev` -> `model_utils.yield_stdev`
- `smooth.smooth_353QH_twice` -> `smooth.smooth_353qh_twice`
- `visualize.data_MC_from_histograms` -> `visualize.data_mc_from_histograms`
- `contrib.visualize_matplotlib.data_MC` -> `visualize.plot_model.data_mc`
- `workspace.WorkspaceBuilder.get_NF_modifiers` -> `workspace.WorkspaceBuilder.normfactor_modifiers`
- `WorkspaceBuilder.get_Normalization_modifier` -> `WorkspaceBuilder.normalization_modifier`
- The template order in `visualize.plot_model.templates` has changed, it is now original up / down template, then modified up/down template (see 246).
- The `method` keyword argument has been removed from the `visualize` API, it previously only supported the default `"matplotlib"` (see 250).
- The internal handling of nominal templates in `cabinetry` has changed. As a consequence of this, the `"_Nominal"` suffix is no longer used in histogram names (see 260).
- In addition to this, the `cabinetry.route.Router.register_template_builder` API has changed: `None` is no longer accepted for region/sample/systematic, the corresponding behavior is now achieved via the default `"*"`. The template can be set to `None`, in which case only nominal templates will be matched (see 260 and the documentation).
- Both `workspace.WorkspaceBuilder.get_yield_for_sample` and `workspace.WorkspaceBuilder.get_unc_for_sample` have been removed, as the functionality is more conveniently achieved via `histo.Histogram.from_config` directly and only nominal templates were supported (see 262).
- The order of keyword arguments in `histo.Histogram.from_config` changed: `template` and `modified` flipped places (see 262).
- The `visualization.data_mc` API has changed, this function no longer takes the optional fit results argument and now requires a model prediction (which can be created via `model_utils.prediction`) instead of a model (see 267).
- Yield tables have been removed from `visualization.data_mc` and moved to `tabulate.yields` (see 267).
- The inference result containers in the `fit` module have been moved to a `fit.results_containers` submodule: `FitResults`, `RankingResults`, `ScanResults`, `LimitResults`, `SignificanceResults` (see 267).
- The function `model_utils.parameter_names` was removed, it is now available via the model config in `pyhf`: `model.config.par_names` (see 248).
- The `with_aux` keyword arguments in `model_utils.model_and_data` and `model_utils.asimov_data` have been renamed to `include_auxdata` for consistency with `pyhf` (see 248).
- The `test` setup extra no longer includes all `pyhf` backends, they can now be installed via the new `pyhf_backends` setup extra (see 248).

**Full list of changes:**
- chore: updating version to 0.3.0 (279)
- feat: Add `MANIFEST.in` (278)
- feat: add Python 3.9 support (277)
- fix: compatibility with pyhf 0.6.3 (parameter label API, auxdata) (248)
- docs: multiple minor docstring fixes (274)
- test: additional call argument formatting harmonization (273)
- style: apply optional formatting to magic commas and strings (272)
- feat: close single figures by default (271)
- feat: use uproot4 for file writing (256)
- refactor: correlation matrix and NLL access (270)
- test: harmonize call argument formatting (269)
- refactor: list conversions (268)
- feat: model prediction API and yield table changes (267)
- feat: yield uncertainty caching (266)
- feat: return figures from visualizations (264)
- feat: remove get prefixes from API and additional improvements (263)
- refactor: streamline histogram loading (262)
- build: list direct dependencies explicitly (261)
- refactor: improved nominal template handling (260)
- feat: validate uniqueness of names in config (259)
- fix: configs without systematics (258)
- feat: manual correlation of systematics (257)
- fix: add missing template settings to config schema (255)
- feat: variable overrides in systematic templates (254)
- test: install Ghostscript in nightly tests (253)
- refactor: use absolute imports (252)
- feat: make matplotlib core dependency and refactor visualization code (250)
- refactor: small string handling improvements (249)
- feat: labels for data/MC and template visualizations (246)
- test: increase integration test tolerance (247)
- build: PEP 517/518 support (245)

0.2.3

This release fixes Asimov dataset generation for models with `lumi` modifiers. It also enables figure rendering in notebooks.

**Full list of changes:**
- chore: updating version to 0.2.3 (244)
- docs: update readme and add talks to documentation (243)
- fix: Asimov generation with lumi modifiers (241)
- feat: notebook rendering for figures (240)

0.2.2

This release enables the use of all `pyhf` backends and adds a helper function to set up custom logging output. It also fixes Asimov dataset generation for models with `shapesys` modifiers.

To set a `pyhf` backend, use the `pyhf` API: [`pyhf.set_backend`](https://pyhf.readthedocs.io/en/latest/_generated/pyhf.set_backend.html#pyhf.set_backend). This backend is no longer overridden within `cabinetry` and therefore used for inference and other operations in `pyhf`.

**Full list of changes:**
- chore: updating version to 0.2.2 (239)
- fix: Asimov generation with shapesys modifiers (238)
- feat: helper function for log formatting (237)
- feat: support all pyhf backends (228)
- fix: workaround for coverage bug (234)
- fix: simplify example workspace and small type check fix (235)
- chore: add standard venv names and notebook checkpoints to gitignore (229)
- fix: compatibility with mypy 0.900 (232)
- fix: NamedTuple compatibility in typeguard, Codecov token for upload (230)
- refactor: histogram normalization (226)
- test: extend coverage for workspace building (225)

0.2.1

This release fixes the goodness-of-fit calculation for models without auxiliary data. It also adopts the `boost-histogram` v1 API, and adds a command line interface for data/model plots. The config schema is expanded to allow for region-dependent samples, systematics, and normalization factors.

**Breaking changes:**
- `workspace.WorkspaceBuilder.get_NF_modifiers` signature has changed, the function now takes a region argument in addition to a sample argument.
- `configuration.sample_affected_by_modifier` is now called `configuration.sample_contains_modifier` for consistency with similar functions.

**Full list of changes:**
- chore: updating version to 0.2.1 (224)
- ci: run mypy again with Python 3.7 (223)
- feat: region-dependent modifiers (220)
- chore: remove black version restriction and update pre-commit hook versions (222)
- feat: make Samples property of modifiers optional (218)
- feat: region-dependent samples (217)
- ci: remove Codecov token (215)
- fix: goodness-of-fit with no auxiliary data (208)
- fix: skip typeguard 2.12 for NamedTuple compatibility (209)
- fix: typing for registering custom template builders (205)
- fix: compatibility with matplotlib 3.4 (207)
- feat: boost-histogram 1.0 compatibility and typing updates (204)
- feat: command line interface for data-MC plots (203)
- chore: remove upper version limits for dependencies (202)

0.2.0

This release adopts the `pyhf` 0.6 and `iminuit` v2 APIs, and introduces several breaking changes. It also adds discovery significance calculation and yield tables with yields per channel summed.

The most notable breaking change has occurred in the `cabinetry.fit` API. `workspace` function arguments have been replaced by `model`, `data` arguments (pdf and data including auxiliary data). `model_utils.model_and_data(spec)` can be used to obtain `model` and `data`:

_old:_
python
ws_spec = cabinetry.workspace.load(workspace_path)
fit_results = cabinetry.fit.fit(ws_spec, asimov=False)


_new:_
python
ws_spec = cabinetry.workspace.load(workspace_path)
model, data = cabinetry.model_utils.model_and_data(ws_spec, asimov=False)
fit_results = cabinetry.fit.fit(model, data)


This affects `fit.fit`, `fit.ranking`, `fit.scan`, `fit.limit` as well as the new `fit.significance`. The `asimov` keyword argument was removed from these functions, it can instead be used with `model_utils.model_and_data`.

**Breaking changes:**
- Support for Python 3.6 has been dropped, following `pyhf` 0.6 dropping support for Python 3.6. The last `cabinetry` version supporting Python 3.6 is `v0.1.8`.
- The `cabinetry.fit` API has changed: `fit.fit`, `fit.ranking`, `fit.scan` and `fit.limit` require `model` and `data` arguments (can be obtained via `model_utils.model_and_data`) instead of `workspace`, and these functions no longer support the `asimov` keyword argument.
- Instead of using a workspace function argument,`visualize.data_MC` now requires `model` and `data` (similar to the changes in the `cabinetry.fit` API). The `config` argument is now an optional keyword argument.
- The `fit_results` argument in `fit.ranking` is now a keyword argument (if not set, the nominal fit will be performed automatically).
- `model_utils.calculate_stdev` now returns a tuple: uncertainties for all bins per channel, and uncertainties for total yield in channel.



**Full list of changes:**
- chore: updating version to 0.2.0 (200)
- feat: discovery significance (176)
- fix: pyhf 0.6 compatibility (156)
- fix: restrict typeguard version for NamedTuple compatibility (199)
- feat: update default bracket in limit calculation for stability (197)
- build: drop support for Python 3.6 (194)
- test: check yield uncertainties in integration test (196)
- feat: mypy check for tabulate package (195)
- ci: do not cancel jobs early if another job fails (193)
- feat: yields per region (189)
- fix: numpy array smoothing and typing (190)
- feat: make reference fit results in ranking optional (186)
- ci: install ghostscript for pdf conversion (187)
- fix: likelihood scan visualization layout for small NLL variations (185)
- feat: data/MC plots without configuration file (184)
- feat: updated fit API with model and data arguments instead of workspace (183)
- docs: change logo location for PyPI rendering (181)

0.1.8

This release fixes yield tables for multiple multi-bin regions. It adds optional systematic template histogram smoothing (see 175 for more details) and improves the efficiency of the limit-finding algorithm.

**Full list of changes:**
- chore: updating version to 0.1.8 (180)
- feat: horizontal log scale for data/model plots (179)
- feat: template smoothing (175)
- refactor: string formatting (177)
- refactor: remove superfluous lists in limit calculation (174)
- feat: take upper bracket default for limit from measurement (173)
- feat: root finding for faster limit convergence (172)
- docs: logo for cabinetry (171)
- feat: more flexibility in parameter exclusion from pull plots (170)
- fix: yield tables for multiple multi-bin regions (169)
- chore: Simplify install_requires and use compatible release syntax (168)
- ci: Uninstall dependencies before installed HEAD versions (166)

Page 2 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.