Python package for constructing frequentist limits from unbinned data
Project description
freqfit
Unbinned frequentist analysis
READ ME IS A WORK IN PROGRESS
config format
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.
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.)
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.
You can specify independent datasets that should later be combined combined_datasets. This is useful for LEGEND or other quasi-background free experiments 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.
Test statistic definitions come from G. Cowan, K. Cranmer, E. Gross, and O. Vitells, Eur. Phys. J. C 71, 1554 (2011).
Once you have a config file made, you can load it by doing
from freqfit import Workspace
ws = Workspace.from_file("myconfig.yaml")
inputs needed
per detector per partition
- runtime + unc.
- PSD efficiency + unc.
- mass
- active volume fraction + unc.
- LAr coincidence efficiency + unc.
- containment efficiency + unc.
- enrichment factor + unc.
- multiplicity efficiency + unc.
- data cleaning efficiency + unc.
- muon veto efficiency + unc.
- resolution + unc.
- energy offset + unc.
development help
You can install the repository using pip as an editable file. Just do pip install -e while inside of freqfit/.
running on cenpa-rocks
- Make sure you have a user directory in the LEGEND location on
eliza1:mkdir /data/eliza1/LEGEND/users/$USER - Add the PYTHONUSERBASE to your
~/.bashrc:export PYTHONUSERBASE=/data/eliza1/LEGEND/users/$USER/pythonuserbase - The code is located at
/data/eliza1/LEGEND/sw/freqfit. In order to pip3 install it, run the following - Activate the singularity shell
singularity shell --bind /data/eliza1/LEGEND/:/data/eliza1/LEGEND/ /data/eliza1/LEGEND/sw/containers/python3-10.sif - Pip3 install as an editable file. When located inside the
/data/eliza1/LEGEND/sw/freqfitdirectory, runpip install -e .(NOTE: you may need to run the commandpython3 -m pip install --upgrade pipin order for this pip install to succeed) - Exit the singularity shell and run the code
logging help
Just add these lines to your script.
import logging
logging.basicConfig(level=logging.INFO) # or some other level
Job Submission on CENPA-rocks
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.
negative of the exponent of scientific notation of a number
def negexpscinot(number): base10 = np.log10(abs(number)) return int(-1 * np.floor(base10))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file freqfit-0.5.tar.gz.
File metadata
- Download URL: freqfit-0.5.tar.gz
- Upload date:
- Size: 92.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9dcb5dc9b55d5e9cf30062341375aec0ffdc23e07fedec7c4d65c689e422afc
|
|
| MD5 |
6fde8fc1d972a198f85f06630db0683b
|
|
| BLAKE2b-256 |
591d1b6cff288d22a6bd7efa8c1412bf1a23bbb643d0579bd71e14509c6ba309
|
Provenance
The following attestation bundles were made for freqfit-0.5.tar.gz:
Publisher:
python-publish.yml on cenpa/freqfit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
freqfit-0.5.tar.gz -
Subject digest:
c9dcb5dc9b55d5e9cf30062341375aec0ffdc23e07fedec7c4d65c689e422afc - Sigstore transparency entry: 1724020386
- Sigstore integration time:
-
Permalink:
cenpa/freqfit@05d2411e3019afae220567a63cd56dcdadca1654 -
Branch / Tag:
refs/tags/v0.5 - Owner: https://github.com/cenpa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@05d2411e3019afae220567a63cd56dcdadca1654 -
Trigger Event:
release
-
Statement type:
File details
Details for the file freqfit-0.5-py3-none-any.whl.
File metadata
- Download URL: freqfit-0.5-py3-none-any.whl
- Upload date:
- Size: 81.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5da11ebdd0421ecae0345f3a955851a9920ddd60d0d9436ff30f0b83fc0475eb
|
|
| MD5 |
f88ab82122ddc368b703ee698e5293aa
|
|
| BLAKE2b-256 |
82dd0580bb2b17a1c7f884a970cd28cab6c4965516b37c47694d7701a7220296
|
Provenance
The following attestation bundles were made for freqfit-0.5-py3-none-any.whl:
Publisher:
python-publish.yml on cenpa/freqfit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
freqfit-0.5-py3-none-any.whl -
Subject digest:
5da11ebdd0421ecae0345f3a955851a9920ddd60d0d9436ff30f0b83fc0475eb - Sigstore transparency entry: 1724020582
- Sigstore integration time:
-
Permalink:
cenpa/freqfit@05d2411e3019afae220567a63cd56dcdadca1654 -
Branch / Tag:
refs/tags/v0.5 - Owner: https://github.com/cenpa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@05d2411e3019afae220567a63cd56dcdadca1654 -
Trigger Event:
release
-
Statement type: