Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
Use fstrings for rtol warning

Use level arg over hardcoded 0.05

add in lru_cache import

fix: Pin codemetapy to v0.3.5 for `--no-extras` functionality (#1995)

* Pin codemetapy to v0.3.5 in the 'current release' test workflow to keep the
  `--no-extras` CLI API option.
   - c.f. proycon/codemetapy#24
* Update lower bounds for scipy and click in codemeta.json and add lower bounds
  for importlib-resources and typing-extensions.

Rename and add to public API

Add in hypotest_kwargs

Add FIXME notice for later. FIX BEFORE MERGE

Update public API repr

ci: Install release candidates for 'current release' test workflow (#1996)

* Use release candidates that are on PyPI for verifiying that the public API
  passes tests. This verifies that the release candidates that users are being
  asked to test reflect the release API.
* Use the latest version of pytest.

refactor: Use urllib.parse.urlsplit over urlparse (#1997)

* Use urllib.parse.urlsplit over urllib.parse.urlparse to avoid having to deal with
  urlparse's 'params' argument which incurs a performance cost.
   - c.f. https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlsplit
   - c.f. https://youtu.be/ABJvdsIANds

Indent docstrings correctly

Use uncorrelated_background API for docstring example

Use rtol in docstring example to avoid warning

drop lru_cache

fix kwargs for autoscan

Bump version: 0.7.0rc3 → 0.7.0rc4

docs: Add Binder Python runtime environment specification (#1998)

* Add binder/runtime.txt to specify the version of Python that is used for the Binder
  environment. Use Python 3.10 as this is the latest version that all pyhf backends will
  work with.
   - c.f. https://mybinder.readthedocs.io/en/latest/howto/languages.html#python

fix: Update codemeta lower bounds for jsonschema, importlib-resources (#2000)

* Update jsonschema lower bound to v4.15.0 and importlib-resources lower bound to v1.4.0
  to match their versions in setup.cfg.
   - Amends PR #1979

docs: Add milestone for 2000 project GitHub items (#2001)

* Add milestone to README for 2000 project GitHub issues and pull requests.

fix: Use codemetapy v2.2.2+ API (#2002)

* Update codemetapy to v2.2.2+ in 'current release' workflow to have access to
  the `--no-extras` CLI API in v2.0+ and reproducible runs.
   - c.f. proycon/codemetapy#24
   - c.f. proycon/codemetapy#26
   - Amends PR #1995
* Use the codemetapy v2.0 API which requires `--inputtype python` to be added.
* Update codemeta.json to follow codemetapy v2.0+ general spec.

fix: Add filterwarnings ignore for protobuf DeprecationWarning (#2005)

* Add a ignore to filterwarnings to avoid a protobuf DeprecationWarning

> DeprecationWarning: Call to deprecated create function FileDescriptor().
> Note: Create unlinked descriptors is going to go away. Please use get/find
> descriptors from generated code or query the descriptor_pool.

from TensorFlow's use of protobuf.

fix: Specify encoding as utf-8 to enforce PEP 597 (#2007)

* Explicitly specify the encoding as utf-8 while opening a file to enforce PEP 597.
  This is future-proofing work to some degree as Python 3.15+ will make utf-8 the
  default.
   - c.f. https://peps.python.org/pep-0597/
* Add the flake8-encodings pre-commit hook to enforce PEP 597.

docs: Add FAQ on reasons for need to downgrade dependencies (#1529)

* Add FAQ explaining how reasons why users might have to manually downgrade dependencies.
   - c.f. PR #1979 for context

docs: Seperate docstrings semantically

Apply sourcery suggestion for simplification

Rename to cached for clarity

Add test for auto through upperlimit API

Use None instead of auto to simplify API

Avoid function level globals

Use np.asarray to avoid copy

Use lower and upper to match scipy terms

Split warning for readability

Add test for rtol warning

Remove tmpdir fixture as not needed for these tests given no writing of output

Add check for return_results

More verbose

fix: Correct concatenate lists instead of adding float to all list elements

Test bounds expansion

test: Update test_plot_results_no_axis baseline image (#2009)

* matplotlib v3.6.0 results in a slightly different baseline image than
  matplotlib v3.5.x, so regenerate the baseline image using matplotlib v3.6.0
  with `pytest --mpl-generate-path=tests/contrib/baseline tests/contrib/test_viz.py`.
* Mark the test_plot_results_no_axis test as xfail for Python 3.7 as matplotlib v3.6.0
  is Python 3.8+ and so the image is guaranteed to be different as Python 3.7 runtimes
  will install matplotlib v3.5.x.

Add upperlimit_fixed_scan to API docs

Add return_results test

move to test_upperlimit_with_kwargs

Move the pop out before evaluation to make everything very clean and clear

Note what scan

Rename to auto_scan

docs: fix link

Provide better coverage and use np.allclose

docs: Add Beojan Stanislaus to contributor list

change auto_scan to toms748_scan

rename fixed_scan to linear_grid_scan

Make intervals module and change API to upper_limit

Rename to pyhf.infer.intervals.upper_limits

get upper_limits.upper_limit working

Also bring along old API

limit to just upper_limit by default

Rearrange

feat: Add internal API to warn of deprecation and future removal

* Add internal API pyhf.exceptions._deprecated_api_warning to alert users to API deprecation
  by raising a subclass of DeprecationWarning and future removal.
* Add test for pyhf.exceptions._deprecated_api_warning to ensure it gets picked up as
  DeprecationWarning.

Note deprecated API

Seperate into condifence intervals section

fix: Use function scope to avoid altering hypotest_args fixture

Make test name explicit

Use deprecated Sphinx note

Add versionadded directives

feat: Add internal API to warn of deprecation and future removal (#2012)

* Add internal API pyhf.exceptions._deprecated_api_warning to alert users to API deprecation
  by raising a subclass of DeprecationWarning and future removal.
* Add test for pyhf.exceptions._deprecated_api_warning to ensure it gets picked up as
  DeprecationWarning.

Update lower bound on scipy as toms748 added in scipy v1.2.0

fixup from autoscan test changes
  • Loading branch information
matthewfeickert committed Sep 20, 2022
1 parent 98fbf98 commit 83f5a18
Show file tree
Hide file tree
Showing 59 changed files with 708 additions and 342 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/release_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@ jobs:
- name: Install from PyPI
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install pyhf[backends,xmlio]
python -m pip install 'pytest~=7.0' pytest-cov
python -m pip install --pre pyhf[backends,xmlio]
python -m pip install pytest pytest-cov
python -m pip list
- name: Canary test public API
run: |
pytest tests/test_public_api.py
# FIXME: c.f. https://github.com/proycon/codemetapy/issues/24
- name: Verify requirements in codemeta.json
run: |
python -m pip install jq "codemetapy>=0.3.4"
codemetapy --no-extras pyhf > codemeta_generated.json
diff <(jq -S .softwareRequirements codemeta_generated.json) <(jq -S .softwareRequirements codemeta.json)
python -m pip install jq "codemetapy>=2.2.2"
codemetapy --inputtype python --no-extras pyhf > codemeta_generated.json
diff <(jq -S .softwareRequirements codemeta.json) <(jq -S .softwareRequirements codemeta_generated.json)
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ repos:
hooks:
- id: flake8
args: ["--count", "--statistics"]
additional_dependencies: [flake8-encodings==0.5.0.post1]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
Expand Down
6 changes: 3 additions & 3 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"description": "pure-Python HistFactory implementation with tensors and autodiff",
"license": "Apache-2.0",
"title": "scikit-hep/pyhf: v0.7.0rc3",
"version": "v0.7.0rc3",
"title": "scikit-hep/pyhf: v0.7.0rc4",
"version": "v0.7.0rc4",
"upload_type": "software",
"creators": [
{
Expand Down Expand Up @@ -36,7 +36,7 @@
"related_identifiers": [
{
"scheme": "url",
"identifier": "https://github.com/scikit-hep/pyhf/tree/v0.7.0rc3",
"identifier": "https://github.com/scikit-hep/pyhf/tree/v0.7.0rc4",
"relation": "isSupplementTo"
}
]
Expand Down
8 changes: 4 additions & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ authors:
given-names: "Giordon"
orcid: "https://orcid.org/0000-0001-6616-3433"
affiliation: "SCIPP, University of California, Santa Cruz"
title: "pyhf: v0.7.0rc3"
version: 0.7.0rc3
title: "pyhf: v0.7.0rc4"
version: 0.7.0rc4
doi: 10.5281/zenodo.1169739
repository-code: "https://github.com/scikit-hep/pyhf/releases/tag/v0.7.0rc3"
url: "https://pyhf.readthedocs.io/en/v0.7.0rc3/"
repository-code: "https://github.com/scikit-hep/pyhf/releases/tag/v0.7.0rc4"
url: "https://pyhf.readthedocs.io/en/v0.7.0rc4/"
keywords:
- python
- physics
Expand Down
11 changes: 6 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ the preferred BibTeX entry for citation of ``pyhf`` includes both the
@software{pyhf,
author = {Lukas Heinrich and Matthew Feickert and Giordon Stark},
title = "{pyhf: v0.7.0rc3}",
version = {0.7.0rc3},
title = "{pyhf: v0.7.0rc4}",
version = {0.7.0rc4},
doi = {10.5281/zenodo.1169739},
url = {https://doi.org/10.5281/zenodo.1169739},
note = {https://github.com/scikit-hep/pyhf/releases/tag/v0.7.0rc3}
note = {https://github.com/scikit-hep/pyhf/releases/tag/v0.7.0rc4}
}
@article{pyhf_joss,
Expand All @@ -340,6 +340,7 @@ contributors <https://github.com/scikit-hep/pyhf/graphs/contributors>`__.
Milestones
----------
- 2022-09-12: 2000 GitHub issues and pull requests. (See PR `#2000 <https://github.com/scikit-hep/pyhf/pull/2000>`__)
- 2021-12-09: 1000 commits to the project. (See PR `#1710 <https://github.com/scikit-hep/pyhf/pull/1710>`__)
- 2020-07-28: 1000 GitHub issues and pull requests. (See PR `#1000 <https://github.com/scikit-hep/pyhf/pull/1000>`__)
Expand All @@ -360,7 +361,7 @@ and grant `OAC-1450377 <https://www.nsf.gov/awardsearch/showAward?AWD_ID=1450377
:target: https://scikit-hep.org/
.. |NSF Award Number| image:: https://img.shields.io/badge/NSF-1836650-blue.svg
:target: https://nsf.gov/awardsearch/showAward?AWD_ID=1836650
.. |Docs from latest| image:: https://img.shields.io/badge/docs-v0.7.0rc3-blue.svg
.. |Docs from latest| image:: https://img.shields.io/badge/docs-v0.7.0rc4-blue.svg
:target: https://pyhf.readthedocs.io/
.. |Docs from master| image:: https://img.shields.io/badge/docs-master-blue.svg
:target: https://scikit-hep.github.io/pyhf
Expand All @@ -375,7 +376,7 @@ and grant `OAC-1450377 <https://www.nsf.gov/awardsearch/showAward?AWD_ID=1450377
:target: https://github.com/conda-forge/pyhf-feedstock
.. |Supported Python versions| image:: https://img.shields.io/pypi/pyversions/pyhf.svg
:target: https://pypi.org/project/pyhf/
.. |Docker Hub pyhf| image:: https://img.shields.io/badge/pyhf-v0.7.0rc3-blue?logo=Docker
.. |Docker Hub pyhf| image:: https://img.shields.io/badge/pyhf-v0.7.0rc4-blue?logo=Docker
:target: https://hub.docker.com/r/pyhf/pyhf/tags
.. |Docker Hub pyhf CUDA| image:: https://img.shields.io/badge/pyhf-CUDA-blue?logo=Docker
:target: https://hub.docker.com/r/pyhf/cuda/tags
Expand Down
1 change: 1 addition & 0 deletions binder/runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.10
178 changes: 95 additions & 83 deletions codemeta.json
Original file line number Diff line number Diff line change
@@ -1,133 +1,145 @@
{
"@context": [
"https://doi.org/10.5063/schema/codemeta-2.0",
"http://schema.org"
"https://raw.githubusercontent.com/codemeta/codemeta/2.0/codemeta.jsonld",
"https://w3id.org/software-iodata",
"https://raw.githubusercontent.com/schemaorg/schemaorg/main/data/releases/13.0/schemaorgcontext.jsonld",
"https://w3id.org/software-types"
],
"@id": "https://github.com/scikit-hep/pyhf",
"@type": "SoftwareSourceCode",
"identifier": "pyhf",
"name": "pyhf",
"version": "0.7.0rc3",
"description": "pure-Python HistFactory implementation with tensors and autodiff",
"license": "Apache, OSI Approved :: Apache Software License",
"applicationCategory": [
"Scientific/Engineering",
"Scientific/Engineering > Physics"
],
"audience": {
"@id": "/audience/science-research",
"@type": "Audience",
"audienceType": "Science/Research"
},
"author": [
{
"@id": "https://orcid.org/0000-0002-4048-7584",
"@id": "/person/lukas-heinrich",
"@type": "Person",
"givenName": "Lukas",
"email": "lukas.heinrich@cern.ch",
"familyName": "Heinrich",
"email": "lukas.heinrich@cern.ch"
"givenName": "Lukas",
"identifier": "https://orcid.org/0000-0002-4048-7584",
"position": 1
},
{
"@id": "https://orcid.org/0000-0003-4124-7862",
"@id": "/person/matthew-feickert",
"@type": "Person",
"givenName": "Matthew",
"email": "matthew.feickert@cern.ch",
"familyName": "Feickert",
"email": "matthew.feickert@cern.ch"
"givenName": "Matthew",
"identifier": "https://orcid.org/0000-0003-4124-7862",
"position": 2
},
{
"@id": "https://orcid.org/0000-0001-6616-3433",
"@id": "/person/giordon-stark",
"@type": "Person",
"givenName": "Giordon",
"email": "gstark@cern.ch",
"familyName": "Stark",
"email": "gstark@cern.ch"
"givenName": "Giordon",
"identifier": "https://orcid.org/0000-0001-6616-3433",
"position": 3
}
],
"codeRepository": "https://github.com/scikit-hep/pyhf",
"description": "pure-Python HistFactory implementation with tensors and autodiff",
"developmentStatus": "4 - Beta",
"identifier": "pyhf",
"issueTracker": "https://github.com/scikit-hep/pyhf/issues",
"keywords": "physics fitting numpy scipy tensorflow pytorch jax",
"license": "http://spdx.org/licenses/Apache-2.0",
"name": "pyhf",
"releaseNotes": "https://pyhf.readthedocs.io/en/stable/release-notes.html",
"runtimePlatform": [
"Python 3",
"Python 3 Only",
"Python 3.10",
"Python 3.7",
"Python 3.8",
"Python 3.9",
"Python Implementation CPython"
],
"softwareHelp": {
"@id": "https://pyhf.readthedocs.io/"
},
"softwareRequirements": [
{
"@id": "/dependency/click-ge-8.0.0",
"@type": "SoftwareApplication",
"identifier": "scipy",
"name": "scipy",
"provider": {
"@id": "https://pypi.org",
"@type": "Organization",
"name": "The Python Package Index",
"url": "https://pypi.org"
},
"identifier": "click",
"name": "click",
"runtimePlatform": "Python 3",
"version": ">=1.4.1"
"version": ">=8.0.0"
},
{
"@id": "/dependency/importlib-resources-ge-1.4.0",
"@type": "SoftwareApplication",
"identifier": "click",
"name": "click",
"provider": {
"@id": "https://pypi.org",
"@type": "Organization",
"name": "The Python Package Index",
"url": "https://pypi.org"
},
"identifier": "importlib-resources",
"name": "importlib-resources",
"runtimePlatform": "Python 3",
"version": ">=7.0"
"version": ">=1.4.0"
},
{
"@id": "/dependency/jsonpatch-ge-1.15",
"@type": "SoftwareApplication",
"identifier": "tqdm",
"name": "tqdm",
"provider": {
"@id": "https://pypi.org",
"@type": "Organization",
"name": "The Python Package Index",
"url": "https://pypi.org"
},
"identifier": "jsonpatch",
"name": "jsonpatch",
"runtimePlatform": "Python 3",
"version": ">=4.56.0"
"version": ">=1.15"
},
{
"@id": "/dependency/jsonschema-ge-4.15.0",
"@type": "SoftwareApplication",
"identifier": "jsonschema",
"name": "jsonschema",
"provider": {
"@id": "https://pypi.org",
"@type": "Organization",
"name": "The Python Package Index",
"url": "https://pypi.org"
},
"runtimePlatform": "Python 3",
"version": ">=3.0.0"
"version": ">=4.15.0"
},
{
"@id": "/dependency/pyyaml-ge-5.1",
"@type": "SoftwareApplication",
"identifier": "jsonpatch",
"name": "jsonpatch",
"provider": {
"@id": "https://pypi.org",
"@type": "Organization",
"name": "The Python Package Index",
"url": "https://pypi.org"
},
"identifier": "pyyaml",
"name": "pyyaml",
"runtimePlatform": "Python 3",
"version": ">=1.15"
"version": ">=5.1"
},
{
"@id": "/dependency/scipy-ge-1.1.0",
"@type": "SoftwareApplication",
"identifier": "pyyaml",
"name": "pyyaml",
"provider": {
"@id": "https://pypi.org",
"@type": "Organization",
"name": "The Python Package Index",
"url": "https://pypi.org"
},
"identifier": "scipy",
"name": "scipy",
"runtimePlatform": "Python 3",
"version": ">=5.1"
}
],
"audience": [
"version": ">=1.1.0"
},
{
"@type": "Audience",
"audienceType": "Science/Research"
"@id": "/dependency/tqdm-ge-4.56.0",
"@type": "SoftwareApplication",
"identifier": "tqdm",
"name": "tqdm",
"runtimePlatform": "Python 3",
"version": ">=4.56.0"
},
{
"@id": "/dependency/typing-extensions-ge-3.7.4.3",
"@type": "SoftwareApplication",
"identifier": "typing-extensions",
"name": "typing-extensions",
"runtimePlatform": "Python 3",
"version": ">=3.7.4.3"
}
],
"provider": {
"@id": "https://pypi.org",
"@type": "Organization",
"name": "The Python Package Index",
"url": "https://pypi.org"
"targetProduct": {
"@id": "/commandlineapplication/pyhf",
"@type": "CommandLineApplication",
"description": "The pyhf command line interface.",
"executableName": "pyhf",
"name": "pyhf",
"runtimePlatform": "Python 3"
},
"runtimePlatform": "Python 3",
"url": "https://github.com/scikit-hep/pyhf",
"keywords": "physics fitting numpy scipy tensorflow pytorch jax",
"developmentStatus": "4 - Beta",
"applicationCategory": "Scientific/Engineering, Scientific/Engineering :: Physics",
"programmingLanguage": "Python 3, Python 3.7, Python 3.8, Python 3.9, Python 3.10, Python Implementation CPython"
"version": "0.7.0rc4"
}
13 changes: 11 additions & 2 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,19 @@ Fits and Tests
mle.fit
mle.fixed_poi_fit
hypotest
intervals.upperlimit
intervals.upperlimit_auto
utils.all_pois_floating

Confidence Intervals
~~~~~~~~~~~~~~~~~~~~

.. autosummary::
:toctree: _generated/
:nosignatures:

intervals.upper_limits.upper_limit
intervals.upper_limits.toms748_scan
intervals.upper_limits.linear_grid_scan
intervals.upperlimit

Schema
------
Expand Down
1 change: 1 addition & 0 deletions docs/contributors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ Contributors include:
- Aryan Roy
- Jerry Ling
- Nathan Simpson
- Beojan Stanislaus
2 changes: 1 addition & 1 deletion docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ available by the ``datadir`` fixture. Therefore, one can do:
.. code-block:: python
def test_patchset(datadir):
data_file = open(datadir.join("test.txt"))
data_file = open(datadir.join("test.txt"), encoding="utf-8")
...
which will load the copy of ``text.txt`` in the temporary directory. This also
Expand Down
8 changes: 6 additions & 2 deletions docs/examples/notebooks/ImpactPlot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,13 @@
"outputs": [],
"source": [
"def make_model(channel_list):\n",
" spec = json.load(open(\"1Lbb-probability-models/RegionA/BkgOnly.json\"))\n",
" spec = json.load(\n",
" open(\"1Lbb-probability-models/RegionA/BkgOnly.json\", encoding=\"utf-8\")\n",
" )\n",
" patchset = pyhf.PatchSet(\n",
" json.load(open(\"1Lbb-probability-models/RegionA/patchset.json\"))\n",
" json.load(\n",
" open(\"1Lbb-probability-models/RegionA/patchset.json\", encoding=\"utf-8\")\n",
" )\n",
" )\n",
" patch = patchset[\"sbottom_750_745_60\"]\n",
" spec = jsonpatch.apply_patch(spec, patch)\n",
Expand Down
Loading

0 comments on commit 83f5a18

Please sign in to comment.