Skip to content

Commit

Permalink
Merge branch 'master' into prefill-schema-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
kratsg authored Aug 12, 2022
2 parents 013b9cc + 97664bc commit 3d311bb
Show file tree
Hide file tree
Showing 22 changed files with 813 additions and 52 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@ repos:
- id: blacken-docs
additional_dependencies: [black==22.6.0]

- repo: https://github.com/asottile/yesqa
rev: v1.4.0
hooks:
- id: yesqa

- repo: https://github.com/PyCQA/flake8
rev: 5.0.2
hooks:
- id: flake8
args: ["--count", "--statistics"]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.4.0
Expand Down
48 changes: 48 additions & 0 deletions docs/bib/use_citations.bib
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
% 2022-07-21
@article{Allwicher:2022mcg,
author = "Allwicher, Lukas and Faroughy, Darius. A. and Jaffredo, Florentin and Sumensari, Olcyr and Wilsch, Felix",
title = "{HighPT: A Tool for high-$p_T$ Drell-Yan Tails Beyond the Standard Model}",
eprint = "2207.10756",
archivePrefix = "arXiv",
primaryClass = "hep-ph",
reportNumber = "ZU-TH-29/22",
month = "7",
year = "2022",
journal = ""
}

% 2022-07-15
@article{Belle:2022gbl,
author = "{Belle Collaboration}",
title = "{Search for a dark leptophilic scalar produced in association with $\tau^+\tau^-$ pair in $e^+e^-$ annihilation at center-of-mass energies near 10.58 GeV}",
eprint = "2207.07476",
archivePrefix = "arXiv",
primaryClass = "hep-ex",
reportNumber = "BELLE-CONF-2201",
month = "7",
year = "2022",
journal = ""
}

% 2022-06-29
@article{Alguero:2022gwm,
author = {Alguero, Ga\"el and Araz, Jack Y. and Fuks, Benjamin and Kraml, Sabine},
title = "{Signal region combination with full and simplified likelihoods in MadAnalysis 5}",
eprint = "2206.14870",
archivePrefix = "arXiv",
primaryClass = "hep-ph",
reportNumber = "IPPP/22/41",
month = "6",
year = "2022",
journal = ""
}

% 2022-04-19
@phdthesis{Kvam:2022vgy,
author = "Kvam, Audrey",
Expand All @@ -20,6 +59,15 @@ @article{ATLAS:2022pib
journal = ""
}

% 2022-03-28
@phdthesis{Borgna:2022zoi,
author = "Borgna, Lucas Santiago",
title = "{Search for pair production of Higgs Bosons decaying to four bottom quarks with data collected by the ATLAS detector}",
school = "University Coll. London",
year = "2022",
url = "https://cds.cern.ch/record/2812193"
}

% 2022-03-14
@inproceedings{Albert:2022mpk,
author = "Albert, Alexander and others",
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,3 @@ console_scripts =
# E501: line too long
extend-ignore = E203, E402, E501
max-line-length = 88
count = True
statistics = True
14 changes: 13 additions & 1 deletion src/pyhf/cli/rootio.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
from pathlib import Path
import jsonpatch
from pyhf.utils import VolumeMountPath

log = logging.getLogger(__name__)

Expand All @@ -23,14 +24,24 @@ def cli():
type=click.Path(exists=True),
default=Path.cwd(),
)
@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.',
type=VolumeMountPath(exists=True, resolve_path=True, path_type=Path),
default=None,
multiple=True,
)
@click.option(
'--output-file',
help='The location of the output json file. If not specified, prints to screen.',
default=None,
)
@click.option('--track-progress/--hide-progress', default=True)
@click.option('--validation-as-error/--validation-as-warning', default=True)
def xml2json(entrypoint_xml, basedir, output_file, track_progress, validation_as_error):
def xml2json(
entrypoint_xml, basedir, mount, output_file, track_progress, validation_as_error
):
"""Entrypoint XML: The top-level XML file for the PDF definition."""
try:
import uproot
Expand All @@ -47,6 +58,7 @@ def xml2json(entrypoint_xml, basedir, output_file, track_progress, validation_as
spec = readxml.parse(
entrypoint_xml,
basedir,
mounts=mount,
track_progress=track_progress,
validation_as_error=validation_as_error,
)
Expand Down
2 changes: 1 addition & 1 deletion src/pyhf/infer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def hypotest(
return tuple(_returns) if len(_returns) > 1 else _returns[0]


from pyhf.infer import intervals # noqa: F401
from pyhf.infer import intervals

__all__ = ["hypotest", "calculators", "intervals", "mle", "test_statistics", "utils"]

Expand Down
15 changes: 12 additions & 3 deletions src/pyhf/optimize/mixins.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Helper Classes for use of automatic differentiation."""
from pyhf.tensor.manager import get_backend
import logging

import numpy as np

from pyhf import exceptions
from pyhf.optimize.common import shim

import logging
from pyhf.tensor.manager import get_backend

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -82,6 +84,13 @@ def _internal_postprocess(self, fitresult, stitch_pars, return_uncertainties=Fal
if uncertainties is not None:
# extract number of fixed parameters
num_fixed_pars = len(fitted_pars) - len(fitresult.x)

# FIXME: Set uncertainties for fixed parameters to 0 manually
# https://github.com/scikit-hep/iminuit/issues/762
# https://github.com/scikit-hep/pyhf/issues/1918
# https://github.com/scikit-hep/cabinetry/pull/346
uncertainties = np.where(fitresult.minuit.fixed, 0.0, uncertainties)

# stitch in zero-uncertainty for fixed values
uncertainties = stitch_pars(
tensorlib.astensor(uncertainties),
Expand Down
3 changes: 0 additions & 3 deletions src/pyhf/optimize/opt_minuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ def _get_minimizer(
par_names=None,
):

step_sizes = [(b[1] - b[0]) / float(self.steps) for b in init_bounds]
fixed_vals = fixed_vals or []
# Minuit wants True/False for each parameter
fixed_bools = [False] * len(init_pars)
for index, val in fixed_vals:
fixed_bools[index] = True
init_pars[index] = val
step_sizes[index] = 0.0

# Minuit requires jac=callable
if do_grad:
Expand All @@ -68,7 +66,6 @@ def _get_minimizer(
jac = None

minuit = iminuit.Minuit(wrapped_objective, init_pars, grad=jac, name=par_names)
minuit.errors = step_sizes
minuit.limits = init_bounds
minuit.fixed = fixed_bools
minuit.print_level = self.verbose
Expand Down
Loading

0 comments on commit 3d311bb

Please sign in to comment.