freqfit 0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- freqfit-0.3/.github/workflows/python-app.yml +48 -0
- freqfit-0.3/.github/workflows/python-publish.yml +70 -0
- freqfit-0.3/.gitignore +114 -0
- freqfit-0.3/.pre-commit-config.yaml +106 -0
- freqfit-0.3/.readthedocs.yaml +32 -0
- freqfit-0.3/PKG-INFO +213 -0
- freqfit-0.3/README.md +173 -0
- freqfit-0.3/docs/Makefile +21 -0
- freqfit-0.3/docs/source/conf.py +90 -0
- freqfit-0.3/docs/source/extensions/numbadoc.py +169 -0
- freqfit-0.3/docs/source/index.rst +4 -0
- freqfit-0.3/docs/toys.drawio +390 -0
- freqfit-0.3/examples/example_plotting_notebook.ipynb +506 -0
- freqfit-0.3/pyproject.toml +104 -0
- freqfit-0.3/setup.cfg +4 -0
- freqfit-0.3/src/freqfit/__init__.py +18 -0
- freqfit-0.3/src/freqfit/_version.py +21 -0
- freqfit-0.3/src/freqfit/dataset.py +413 -0
- freqfit-0.3/src/freqfit/experiment.py +757 -0
- freqfit-0.3/src/freqfit/fc.py +384 -0
- freqfit-0.3/src/freqfit/initial_guesses.py +421 -0
- freqfit-0.3/src/freqfit/limit.py +707 -0
- freqfit-0.3/src/freqfit/logging.py +41 -0
- freqfit-0.3/src/freqfit/models/__init__.py +41 -0
- freqfit-0.3/src/freqfit/models/box_model_0vbb.py +636 -0
- freqfit-0.3/src/freqfit/models/constants.py +67 -0
- freqfit-0.3/src/freqfit/models/correlated_efficiency_0vbb.py +819 -0
- freqfit-0.3/src/freqfit/models/correlated_efficiency_0vbb_correlate_delta.py +852 -0
- freqfit-0.3/src/freqfit/models/correlated_efficiency_0vbb_exponential_background.py +603 -0
- freqfit-0.3/src/freqfit/models/correlated_efficiency_0vbb_exponential_with_offset_background.py +607 -0
- freqfit-0.3/src/freqfit/models/correlated_efficiency_0vbb_linear_background.py +636 -0
- freqfit-0.3/src/freqfit/models/correlated_efficiency_NME_0vbb.py +732 -0
- freqfit-0.3/src/freqfit/models/gaussian_on_uniform.py +557 -0
- freqfit-0.3/src/freqfit/models/linear_bkg.py +272 -0
- freqfit-0.3/src/freqfit/models/mjd_0vbb.py +714 -0
- freqfit-0.3/src/freqfit/models/mjd_NME_0vbb.py +767 -0
- freqfit-0.3/src/freqfit/models/number_of_counts_0vbb.py +515 -0
- freqfit-0.3/src/freqfit/models/onebin_poisson.py +96 -0
- freqfit-0.3/src/freqfit/models/truncated_correlated_efficiency_0vbb.py +654 -0
- freqfit-0.3/src/freqfit/plot.py +697 -0
- freqfit-0.3/src/freqfit/statistics.py +563 -0
- freqfit-0.3/src/freqfit/superset.py +340 -0
- freqfit-0.3/src/freqfit/toy.py +702 -0
- freqfit-0.3/src/freqfit/utils.py +208 -0
- freqfit-0.3/src/freqfit.egg-info/PKG-INFO +213 -0
- freqfit-0.3/src/freqfit.egg-info/SOURCES.txt +61 -0
- freqfit-0.3/src/freqfit.egg-info/dependency_links.txt +1 -0
- freqfit-0.3/src/freqfit.egg-info/not-zip-safe +1 -0
- freqfit-0.3/src/freqfit.egg-info/requires.txt +18 -0
- freqfit-0.3/src/freqfit.egg-info/top_level.txt +1 -0
- freqfit-0.3/submission/l200_brazil.py +68 -0
- freqfit-0.3/submission/l200_brazil.sh +25 -0
- freqfit-0.3/submission/l200_s_grid.py +67 -0
- freqfit-0.3/submission/l200_toys.py +62 -0
- freqfit-0.3/submission/run_l200.sh +27 -0
- freqfit-0.3/submission/submit_l200.sh +6 -0
- freqfit-0.3/tests/config_test.yaml +128 -0
- freqfit-0.3/tests/config_test_highbkg.yaml +84 -0
- freqfit-0.3/tests/config_test_highbkg_bkg_only.yaml +84 -0
- freqfit-0.3/tests/config_test_highsignal.yaml +90 -0
- freqfit-0.3/tests/models/test_gaussian_on_uniform.py +149 -0
- freqfit-0.3/tests/test_criticalts.py +143 -0
- freqfit-0.3/tests/test_dataset.py +74 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
+
|
|
4
|
+
name: Python application
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ "main" ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ "main" ]
|
|
11
|
+
release:
|
|
12
|
+
branches: ["main"]
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
|
|
20
|
+
name: Test freqfit with python
|
|
21
|
+
runs-on: ${{ matrix.os }}
|
|
22
|
+
strategy:
|
|
23
|
+
matrix:
|
|
24
|
+
python-version: ["3.10", "3.11"]
|
|
25
|
+
os: [ubuntu-latest, macOS-latest]
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v3
|
|
29
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
30
|
+
uses: actions/setup-python@v4
|
|
31
|
+
with:
|
|
32
|
+
python-version: ${{ matrix.python-version }}
|
|
33
|
+
- name: Install dependencies
|
|
34
|
+
run: |
|
|
35
|
+
python -m pip install --upgrade pip
|
|
36
|
+
pip install flake8 pytest
|
|
37
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
38
|
+
- name: Lint with flake8
|
|
39
|
+
run: |
|
|
40
|
+
# stop the build if there are Python syntax errors or undefined names
|
|
41
|
+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
42
|
+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
|
43
|
+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
44
|
+
- name: Test with pytest
|
|
45
|
+
run: |
|
|
46
|
+
pip install pytest
|
|
47
|
+
python -m pip install --upgrade .
|
|
48
|
+
python -m pytest --import-mode=append tests/
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# This workflow will upload a Python Package to PyPI when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
+
# They are provided by a third-party and are governed by
|
|
6
|
+
# separate terms of service, privacy policy, and support
|
|
7
|
+
# documentation.
|
|
8
|
+
|
|
9
|
+
name: Upload Python Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
release-build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.x"
|
|
28
|
+
|
|
29
|
+
- name: Build release distributions
|
|
30
|
+
run: |
|
|
31
|
+
# NOTE: put your own distribution build steps here.
|
|
32
|
+
python -m pip install build
|
|
33
|
+
python -m build
|
|
34
|
+
|
|
35
|
+
- name: Upload distributions
|
|
36
|
+
uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: release-dists
|
|
39
|
+
path: dist/
|
|
40
|
+
|
|
41
|
+
pypi-publish:
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
needs:
|
|
44
|
+
- release-build
|
|
45
|
+
permissions:
|
|
46
|
+
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
47
|
+
id-token: write
|
|
48
|
+
|
|
49
|
+
# Dedicated environments with protections for publishing are strongly recommended.
|
|
50
|
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
|
|
51
|
+
environment:
|
|
52
|
+
name: pypi
|
|
53
|
+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
|
|
54
|
+
# url: https://pypi.org/p/YOURPROJECT
|
|
55
|
+
#
|
|
56
|
+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
|
|
57
|
+
# ALTERNATIVE: exactly, uncomment the following line instead:
|
|
58
|
+
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
|
|
59
|
+
|
|
60
|
+
steps:
|
|
61
|
+
- name: Retrieve release distributions
|
|
62
|
+
uses: actions/download-artifact@v4
|
|
63
|
+
with:
|
|
64
|
+
name: release-dists
|
|
65
|
+
path: dist/
|
|
66
|
+
|
|
67
|
+
- name: Publish release distributions to PyPI
|
|
68
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
69
|
+
with:
|
|
70
|
+
packages-dir: dist/
|
freqfit-0.3/.gitignore
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# New additions go at the top!
|
|
2
|
+
*.c
|
|
3
|
+
.DS_Store
|
|
4
|
+
*.npz
|
|
5
|
+
*.pdf
|
|
6
|
+
*.csv
|
|
7
|
+
*.jpg
|
|
8
|
+
*.png
|
|
9
|
+
*.h5
|
|
10
|
+
|
|
11
|
+
src/legendfreqfit/_version.py
|
|
12
|
+
|
|
13
|
+
# -------------------- github-generated stuff -------------------
|
|
14
|
+
# Byte-compiled / optimized / DLL files
|
|
15
|
+
__pycache__/
|
|
16
|
+
*.py[cod]
|
|
17
|
+
*$py.class
|
|
18
|
+
|
|
19
|
+
# C extensions
|
|
20
|
+
*.so
|
|
21
|
+
|
|
22
|
+
# Distribution / packaging
|
|
23
|
+
.Python
|
|
24
|
+
build/
|
|
25
|
+
develop-eggs/
|
|
26
|
+
dist/
|
|
27
|
+
downloads/
|
|
28
|
+
eggs/
|
|
29
|
+
.eggs/
|
|
30
|
+
lib64/
|
|
31
|
+
parts/
|
|
32
|
+
sdist/
|
|
33
|
+
var/
|
|
34
|
+
wheels/
|
|
35
|
+
*.egg-info/
|
|
36
|
+
.installed.cfg
|
|
37
|
+
*.egg
|
|
38
|
+
MANIFEST
|
|
39
|
+
|
|
40
|
+
# PyInstaller
|
|
41
|
+
# Usually these files are written by a python script from a template
|
|
42
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
43
|
+
*.manifest
|
|
44
|
+
*.spec
|
|
45
|
+
|
|
46
|
+
# Installer logs
|
|
47
|
+
pip-log.txt
|
|
48
|
+
pip-delete-this-directory.txt
|
|
49
|
+
|
|
50
|
+
# Unit test / coverage reports
|
|
51
|
+
htmlcov/
|
|
52
|
+
.tox/
|
|
53
|
+
.coverage
|
|
54
|
+
.coverage.*
|
|
55
|
+
.cache
|
|
56
|
+
nosetests.xml
|
|
57
|
+
coverage.xml
|
|
58
|
+
*.cover
|
|
59
|
+
.hypothesis/
|
|
60
|
+
.pytest_cache/
|
|
61
|
+
|
|
62
|
+
# Translations
|
|
63
|
+
*.mo
|
|
64
|
+
*.pot
|
|
65
|
+
|
|
66
|
+
# Django stuff:
|
|
67
|
+
*.log
|
|
68
|
+
local_settings.py
|
|
69
|
+
db.sqlite3
|
|
70
|
+
|
|
71
|
+
# Flask stuff:
|
|
72
|
+
instance/
|
|
73
|
+
.webassets-cache
|
|
74
|
+
|
|
75
|
+
# Scrapy stuff:
|
|
76
|
+
.scrapy
|
|
77
|
+
|
|
78
|
+
# Sphinx documentation
|
|
79
|
+
/docs/build/
|
|
80
|
+
/docs/source/api
|
|
81
|
+
|
|
82
|
+
# PyBuilder
|
|
83
|
+
target/
|
|
84
|
+
|
|
85
|
+
# Jupyter Notebook
|
|
86
|
+
.ipynb_checkpoints
|
|
87
|
+
|
|
88
|
+
# pyenv
|
|
89
|
+
.python-version
|
|
90
|
+
|
|
91
|
+
# celery beat schedule file
|
|
92
|
+
celerybeat-schedule
|
|
93
|
+
|
|
94
|
+
# SageMath parsed files
|
|
95
|
+
*.sage.py
|
|
96
|
+
|
|
97
|
+
# Environments
|
|
98
|
+
.env
|
|
99
|
+
.venv
|
|
100
|
+
env/
|
|
101
|
+
venv/
|
|
102
|
+
ENV/
|
|
103
|
+
env.bak/
|
|
104
|
+
venv.bak/
|
|
105
|
+
|
|
106
|
+
# Spyder project settings
|
|
107
|
+
.spyderproject
|
|
108
|
+
.spyproject
|
|
109
|
+
|
|
110
|
+
# Rope project settings
|
|
111
|
+
.ropeproject
|
|
112
|
+
|
|
113
|
+
# mypy
|
|
114
|
+
.mypy_cache/
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autoupdate_commit_msg: "chore: update pre-commit hooks"
|
|
3
|
+
autoupdate_schedule: "quarterly"
|
|
4
|
+
autofix_commit_msg: "style: pre-commit fixes"
|
|
5
|
+
|
|
6
|
+
repos:
|
|
7
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
8
|
+
rev: "v4.5.0"
|
|
9
|
+
hooks:
|
|
10
|
+
- id: check-added-large-files
|
|
11
|
+
args: ['--maxkb=2000']
|
|
12
|
+
- id: check-case-conflict
|
|
13
|
+
- id: check-executables-have-shebangs
|
|
14
|
+
- id: check-merge-conflict
|
|
15
|
+
- id: check-symlinks
|
|
16
|
+
- id: check-yaml
|
|
17
|
+
args: ['--unsafe']
|
|
18
|
+
- id: check-json
|
|
19
|
+
- id: check-toml
|
|
20
|
+
- id: check-docstring-first
|
|
21
|
+
- id: debug-statements
|
|
22
|
+
- id: end-of-file-fixer
|
|
23
|
+
- id: forbid-new-submodules
|
|
24
|
+
- id: mixed-line-ending
|
|
25
|
+
- id: requirements-txt-fixer
|
|
26
|
+
- id: trailing-whitespace
|
|
27
|
+
|
|
28
|
+
- repo: https://github.com/asottile/setup-cfg-fmt
|
|
29
|
+
rev: "v2.5.0"
|
|
30
|
+
hooks:
|
|
31
|
+
- id: setup-cfg-fmt
|
|
32
|
+
|
|
33
|
+
- repo: https://github.com/PyCQA/isort
|
|
34
|
+
rev: "5.13.2"
|
|
35
|
+
hooks:
|
|
36
|
+
- id: isort
|
|
37
|
+
|
|
38
|
+
- repo: https://github.com/asottile/pyupgrade
|
|
39
|
+
rev: "v3.15.0"
|
|
40
|
+
hooks:
|
|
41
|
+
- id: pyupgrade
|
|
42
|
+
args: ["--py38-plus"]
|
|
43
|
+
|
|
44
|
+
- repo: https://github.com/psf/black
|
|
45
|
+
rev: "23.12.1"
|
|
46
|
+
hooks:
|
|
47
|
+
- id: black-jupyter
|
|
48
|
+
|
|
49
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
50
|
+
rev: "v1.8.0"
|
|
51
|
+
hooks:
|
|
52
|
+
- id: mypy
|
|
53
|
+
files: src
|
|
54
|
+
stages: [manual]
|
|
55
|
+
|
|
56
|
+
- repo: https://github.com/hadialqattan/pycln
|
|
57
|
+
rev: "v2.4.0"
|
|
58
|
+
hooks:
|
|
59
|
+
- id: pycln
|
|
60
|
+
args: [--all]
|
|
61
|
+
|
|
62
|
+
- repo: https://github.com/PyCQA/flake8
|
|
63
|
+
rev: "6.1.0"
|
|
64
|
+
hooks:
|
|
65
|
+
- id: flake8
|
|
66
|
+
additional_dependencies: [
|
|
67
|
+
flake8-bugbear>=23.1.17,
|
|
68
|
+
flake8-print,
|
|
69
|
+
pep8-naming
|
|
70
|
+
]
|
|
71
|
+
args: ["--extend-ignore", "E203,E501,N803,N806,N801,B007,B028,F841,E402"]
|
|
72
|
+
|
|
73
|
+
- repo: https://github.com/kynan/nbstripout
|
|
74
|
+
rev: "0.6.1"
|
|
75
|
+
hooks:
|
|
76
|
+
- id: nbstripout
|
|
77
|
+
args: ["--drop-empty-cells",
|
|
78
|
+
"--extra-keys", "metadata.kernelspec metadata.language_info"]
|
|
79
|
+
|
|
80
|
+
- repo: https://github.com/mgedmin/check-manifest
|
|
81
|
+
rev: "0.49"
|
|
82
|
+
hooks:
|
|
83
|
+
- id: check-manifest
|
|
84
|
+
stages: [manual]
|
|
85
|
+
|
|
86
|
+
- repo: https://github.com/codespell-project/codespell
|
|
87
|
+
rev: "v2.2.6"
|
|
88
|
+
hooks:
|
|
89
|
+
- id: codespell
|
|
90
|
+
additional_dependencies:
|
|
91
|
+
- tomli
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
- repo: https://github.com/pre-commit/pygrep-hooks
|
|
95
|
+
rev: "v1.10.0"
|
|
96
|
+
hooks:
|
|
97
|
+
- id: python-no-log-warn
|
|
98
|
+
- id: rst-backticks
|
|
99
|
+
- id: rst-directive-colons
|
|
100
|
+
- id: rst-inline-touching-normal
|
|
101
|
+
|
|
102
|
+
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
103
|
+
rev: "v4.0.0-alpha.8"
|
|
104
|
+
hooks:
|
|
105
|
+
- id: prettier
|
|
106
|
+
types_or: [json]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
sphinx:
|
|
4
|
+
configuration: docs/source/conf.py
|
|
5
|
+
|
|
6
|
+
formats:
|
|
7
|
+
- epub
|
|
8
|
+
- pdf
|
|
9
|
+
|
|
10
|
+
build:
|
|
11
|
+
os: "ubuntu-22.04"
|
|
12
|
+
apt_packages:
|
|
13
|
+
- pandoc
|
|
14
|
+
tools:
|
|
15
|
+
python: "3.10"
|
|
16
|
+
jobs:
|
|
17
|
+
pre_build:
|
|
18
|
+
- rm -rf docs/source/api
|
|
19
|
+
- sphinx-apidoc
|
|
20
|
+
--private
|
|
21
|
+
--module-first
|
|
22
|
+
--force
|
|
23
|
+
--output-dir docs/source/api
|
|
24
|
+
src/legendfreqfit
|
|
25
|
+
src/legendfreqfit/_version.py
|
|
26
|
+
|
|
27
|
+
python:
|
|
28
|
+
install:
|
|
29
|
+
- method: pip
|
|
30
|
+
path: .
|
|
31
|
+
extra_requirements:
|
|
32
|
+
- all
|
freqfit-0.3/PKG-INFO
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: freqfit
|
|
3
|
+
Version: 0.3
|
|
4
|
+
Summary: Python package for constructing frequentist limits from unbinned data
|
|
5
|
+
Author:
|
|
6
|
+
Maintainer:
|
|
7
|
+
Project-URL: Homepage, https://github.com/cenpa/freqfit
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/cenpa/freqfit/issues
|
|
9
|
+
Project-URL: Discussions, https://github.com/cenpa/freqfit/discussions
|
|
10
|
+
Project-URL: Changelog, https://github.com/cenpa/freqfit/releases
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Operating System :: POSIX
|
|
17
|
+
Classifier: Operating System :: Unix
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: h5py>=3.2
|
|
25
|
+
Requires-Dist: colorlog
|
|
26
|
+
Requires-Dist: iminuit==2.26
|
|
27
|
+
Requires-Dist: matplotlib
|
|
28
|
+
Requires-Dist: numba==0.58.1
|
|
29
|
+
Requires-Dist: numpy>=1.21
|
|
30
|
+
Requires-Dist: tabulate>=0.9.0
|
|
31
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
32
|
+
Requires-Dist: scipy>=1.10.1
|
|
33
|
+
Requires-Dist: jinja2>=3.1.5
|
|
34
|
+
Provides-Extra: all
|
|
35
|
+
Requires-Dist: freqfit[test]; extra == "all"
|
|
36
|
+
Provides-Extra: test
|
|
37
|
+
Requires-Dist: pre-commit; extra == "test"
|
|
38
|
+
Requires-Dist: pytest>=6.0; extra == "test"
|
|
39
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
40
|
+
|
|
41
|
+
# freqfit
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
[](https://doi.org/10.5281/zenodo.15185401)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
Unbinned frequentist analysis
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### config format
|
|
52
|
+
|
|
53
|
+
Config files are `.yaml` files that contain several different dictionaries, described below. There are 5 primary dictionaries at the top level: `datasets`, `combined_datasets`, `parameters`, `constraints`, and `options`.
|
|
54
|
+
|
|
55
|
+
Note that the default value for options not explicitly provided is (usually) `False`.
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
datasets: # the collection of datasets
|
|
59
|
+
ds1: # name of dataset
|
|
60
|
+
costfunction: ExtendedUnbinnedNLL # which cost function to use (only ExtendedUnbinnedNLL and UnbinnedNLL are supported)
|
|
61
|
+
data: [...] # list of data
|
|
62
|
+
model: freqfit.models.mymodel # name/location of model to use
|
|
63
|
+
model_parameters: # parameter of the model: name given to this parameter
|
|
64
|
+
a: a_ds1
|
|
65
|
+
b: global_b # shared parameter names indicate the same parameter across different datasets
|
|
66
|
+
|
|
67
|
+
ds2:
|
|
68
|
+
try_to_combine: True # whether to attempt to combine this dataset with others (see further details below)
|
|
69
|
+
combined_dataset: empty_ds # name of the group to attempt to join
|
|
70
|
+
costfunction: ExtendedUnbinnedNLL
|
|
71
|
+
data: [] # this dataset has no data
|
|
72
|
+
model: freqfit.models.mymodel
|
|
73
|
+
model_parameters:
|
|
74
|
+
a: a_ds2
|
|
75
|
+
b: global_b
|
|
76
|
+
|
|
77
|
+
ds3:
|
|
78
|
+
try_to_combine: True
|
|
79
|
+
combined_dataset: empty_ds
|
|
80
|
+
costfunction: ExtendedUnbinnedNLL
|
|
81
|
+
data: []
|
|
82
|
+
model: freqfit.models.mymodel
|
|
83
|
+
model_parameters:
|
|
84
|
+
a: a_ds3
|
|
85
|
+
b: global_b
|
|
86
|
+
|
|
87
|
+
combined_datasets: # details of how we should attempt to combine datasets
|
|
88
|
+
empty_ds: # name of the combined datasets
|
|
89
|
+
costfunction: ExtendedUnbinnedNLL
|
|
90
|
+
model: freqfit.models.mymodel # model for the combined group (must match the datasets being added for now)
|
|
91
|
+
model_parameters:
|
|
92
|
+
a: a_empty_ds
|
|
93
|
+
b: global_b
|
|
94
|
+
|
|
95
|
+
parameters: # the collection of parameters
|
|
96
|
+
a_ds1: # parameter name
|
|
97
|
+
value: 0.0 # parameter value (note it will be a fixed parameter by default)
|
|
98
|
+
a_ds2:
|
|
99
|
+
value: 0.0 # initial guess for the parameter (since it is a fitted parameter)
|
|
100
|
+
includeinfit: true # whether to include in the fit
|
|
101
|
+
fix_if_no_data: true # if the dataset has no data, then we will skip trying to fit this parameter
|
|
102
|
+
vary_by_constraint: true # if we run toys, we will vary the true value of this parameter by the provided constraint
|
|
103
|
+
fixed: false # you can fix parameters that are included in the fit (the only time this option is used, default is false)
|
|
104
|
+
a_ds3:
|
|
105
|
+
value: 0.0
|
|
106
|
+
a_empty_ds: # parameters from combined_datasets also need to appear (nuisance parameters are varied at the level of datasets, not combined datasets)
|
|
107
|
+
value_from_combine: true # will use the value from the combined datasets here, which is particularly important for fixed parameters
|
|
108
|
+
includeinfit: false # in this case, we want to fix the value of this parameter after combining the datasets
|
|
109
|
+
global_b:
|
|
110
|
+
value: 0.0
|
|
111
|
+
includeinfit: true
|
|
112
|
+
|
|
113
|
+
constraints: # the collection of constraints (a Gaussian constraint term in the likelihood)
|
|
114
|
+
constraint_a_ds2: # name of the constraint
|
|
115
|
+
parameters: a_ds2 # which parameter(s) the constraint applies to
|
|
116
|
+
uncertainty: 1.0 # 1 sigma uncertainty on the parameter(s)
|
|
117
|
+
values: 0.0 # should be the same value(s) as in `parameters`
|
|
118
|
+
|
|
119
|
+
options: # a collection of global options (only one option so far)
|
|
120
|
+
try_to_combine_datasets: true # whether to attempt to combine datasets
|
|
121
|
+
name: experiment name
|
|
122
|
+
test_statistic: t_mu # can be "t_mu", "t_mu_tilde", "q_mu", "q_mu_tilde"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
For `constraints`, there are some additional options for how to specify these constraints. You can provide a list of parameters, values, and uncertainties:
|
|
126
|
+
|
|
127
|
+
```yaml
|
|
128
|
+
constraints:
|
|
129
|
+
myconstraint:
|
|
130
|
+
parameters: [a, b, c]
|
|
131
|
+
uncertainty: [1, 5, 3]
|
|
132
|
+
values: [0, 10, 5]
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
or you can apply a single uncertainty to several parameters (note that each needs a separate value currently)
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
constraints:
|
|
139
|
+
myconstraint:
|
|
140
|
+
parameters: [a, b, c]
|
|
141
|
+
uncertainty: 1.0
|
|
142
|
+
values: [0, 10, 5]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
or you can provide a covariance matrix (which must be positive semi-definite, i.e. a proper covariance matrix). Note that the syntax changes from `uncertainty` to `covariance` in this case. (Using both will generate an error.)
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
constraints:
|
|
149
|
+
myconstraint:
|
|
150
|
+
parameters: [a, b]
|
|
151
|
+
covariance: [[1, -0.5], [-0.5, 1]]
|
|
152
|
+
values: [2, 3]
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Constraints will be combined into a single `NormalConstraint` as this dramatically improves computation time. This takes the form of a multivariate Gaussian with central values and covariance matrix calculated from the supplied constraints. Only constraints that refer to fit parameters are used. (Parameters in a single provided constraint must all be fit parameters.)
|
|
156
|
+
|
|
157
|
+
Constraints are also used to specify how nuisance parameters should be varied for toys. All parameters in a single constraint must be included as a parameter of a dataset, but do not necessarily need to be parameters in the fit.
|
|
158
|
+
|
|
159
|
+
You can specify independent datasets that should later be combined `combined_datasets`. This is useful for LEGEND where we have many, independent datasets with their own nuisance parameters. For our fit, it is much faster to simply combine all datasets that have no events (are empty). However, in generating our toys, we would like to vary the nuisance parameters and draw events randomly for all datasets. We therefore would like to combine datasets during our toys on the fly. Since, for each toy, we do no a prior know which datasets are empty and can be combined, we have written the code in such a way as to attempt to combine datasets. This is a very niche use case and probably only relevant for the 0vbb fit.
|
|
160
|
+
|
|
161
|
+
Test statistic definitions come from [G. Cowan, K. Cranmer, E. Gross, and O. Vitells, Eur. Phys. J. C 71, 1554 (2011)](https://doi.org/10.1140/epjc/s10052-011-1554-0).
|
|
162
|
+
|
|
163
|
+
Once you have a config file made, you can load it by doing
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
from freqfit import Experiment
|
|
167
|
+
|
|
168
|
+
myexperiment = Experiment.file("myconfig.yaml")
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
### inputs needed
|
|
174
|
+
per detector per partition
|
|
175
|
+
- runtime + unc.
|
|
176
|
+
- PSD efficiency + unc.
|
|
177
|
+
- mass
|
|
178
|
+
- active volume fraction + unc.
|
|
179
|
+
- LAr coincidence efficiency + unc.
|
|
180
|
+
- containment efficiency + unc.
|
|
181
|
+
- enrichment factor + unc.
|
|
182
|
+
- multiplicity efficiency + unc.
|
|
183
|
+
- data cleaning efficiency + unc.
|
|
184
|
+
- muon veto efficiency + unc.
|
|
185
|
+
- resolution + unc.
|
|
186
|
+
- energy offset + unc.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
### development help
|
|
191
|
+
You can install the repository using `pip` as an editable file. Just do `pip install -e` while inside of `freqfit/`.
|
|
192
|
+
|
|
193
|
+
### running on cenpa-rocks
|
|
194
|
+
1. Make sure you have a user directory in the LEGEND location on `eliza1`: `mkdir /data/eliza1/LEGEND/users/$USER`
|
|
195
|
+
2. Add the PYTHONUSERBASE to your `~/.bashrc`: `export PYTHONUSERBASE=/data/eliza1/LEGEND/users/$USER/pythonuserbase`
|
|
196
|
+
3. The code is located at `/data/eliza1/LEGEND/sw/freqfit`. In order to pip3 install it, run the following
|
|
197
|
+
4. Activate the singularity shell `singularity shell --bind /data/eliza1/LEGEND/:/data/eliza1/LEGEND/ /data/eliza1/LEGEND/sw/containers/python3-10.sif`
|
|
198
|
+
5. Pip3 install as an editable file. When located inside the `/data/eliza1/LEGEND/sw/freqfit` directory, run `pip install -e .` (NOTE: you may need to run the command `python3 -m pip install --upgrade pip` in order for this pip install to succeed)
|
|
199
|
+
6. Exit the singularity shell and run the code
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
### logging help
|
|
203
|
+
Just add these lines to your script.
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
import logging
|
|
207
|
+
logging.basicConfig(level=logging.INFO) # or some other level
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
### Job Submission on CENPA-rocks
|
|
213
|
+
Job submission scripts for L200 are located in the `submission` subfolder in this repo. `submit_l200.sh` is a script that creates the S-grid to scan over by calling `l200_s_grid.py` and then submits jobs to the cluster to generate toys at those s-points by calling `run_l200.sh` which uses `l200_toys.py` to run the toys. Toys at 0-signal are generated and tested against this s-grid of alternative hypotheses using the `l200_brazil.sh` submission script which calls `l200_brazil.py` to actually run these 0-signal toys.
|