Skip to main content

.

Project description

Framework Logo

Perform complex profile binned maximum likelihood fits by exploiting state-of-the-art differential programming. Computations are based on the tensorflow 2 library and scipy minimizers with multithreading support on CPU (FIXME: and GPU). Implemented approximations in the limit of large sample size to simplify intensive computations.

Install

You can install combinetf2 via pip. It can be installed with the core functionality:

pip install combinetf2

Or with optional dependencies to use the plotting scripts

pip install combinetf2[plotting]

Get the code

If you want to have more control or want to develop CombineTF2 you can check it our as (sub) module.

MY_GIT_USER=$(git config user.github)
git clone git@github.com:$MY_GIT_USER/combinetf2.git
cd combinetf2/
git remote add upstream git@github.com:WMass/combinetf2.git

Get updates from the central repository (and main branch)

git pull upstream main
git push origin main

It can be run within a comprehensive singularity (recommended) or in an environment set up by yourself. It makes use of the wums package for storing hdf5 files in compressed format.

In a python virtual environment

The simplest is to make a python virtual environment. It depends on the python version you are working with (tested with 3.9.18). First, make a python version, e.g. in the combinetf2 base directory (On some machines you have to use python3):

python -m venv env

The activate it and install the necessary packages

source env/bin/activate
pip install wums[pickling,plotting] tensorflow numpy h5py hist scipy matplotlib mplhep seaborn pandas plotly kaleido

The packages matplotlib, mplhep, seaborn, pandas, plotly, and kaleido are only needed for the plotting scripts. In case you want to contribute to the development, please also install the linters isort, flake8, autoflake, black, and pylint used in the pre-commit hooks and the github CI Deactivate the environment with deactivate.

In singularity

The singularity includes a comprehensive set of packages. But the singularity is missing the wums package, you have to check it our as a submodule. It also comes with custom optimized builds that for example enable numpy and scipy to be run with more than 64 threads (the limit in the standard build). Activate the singularity image (to be done every time before running code).

singularity run /cvmfs/unpacked.cern.ch/gitlab-registry.cern.ch/bendavid/cmswmassdocker/wmassdevrolling\:latest

Run the code

Setting up environment variables and python path (to be done every time before running code).

source setup.sh

Making the input tensor

An example can be found in tests/make_tensor.py -o test_tensor.hdf5.

Symmetrization

By default, systematic variations are asymmetric. However, defining only symmetric variations can be beneficial as a fully symmetric tensor has reduced memory consumption, simplifications in the likelihood function in the fit, and is usually numerically more stable. Different symmetrization options are supported:

  • "average": TBD
  • "conservative": TBD
  • "linear": TBD
  • "quadratic": TBD If a systematic variation is added by providing a single histogram, the variation is mirrored.

Run the fit

For example:

combinetf2_fit test_tensor.hdf5 -o results/fitresult.hdf5 -t 0 --doImpacts --globalImpacts --binByBinStat --saveHists --computeHistErrors --project ch1 a --project ch1 b

Fit diagnostics

Nuisance parameter impacts:

combinetf2_print_impacts results/fitresult.hdf5

Contributing to the code

We use pre-commit hooks and linters in the CI. Activate git pre-commit hooks (only need to do this once when checking out)

git config --local include.path ../.gitconfig

I case combineTF2 is included as a submodule, use instead:

git config --local include.path "$(git rev-parse --show-superproject-working-tree)/.gitconfig"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

combinetf2-0.1.1.tar.gz (62.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

combinetf2-0.1.1-py3-none-any.whl (73.9 kB view details)

Uploaded Python 3

File details

Details for the file combinetf2-0.1.1.tar.gz.

File metadata

  • Download URL: combinetf2-0.1.1.tar.gz
  • Upload date:
  • Size: 62.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for combinetf2-0.1.1.tar.gz
Algorithm Hash digest
SHA256 05723e67cc43460ac3dc80535dfe883e2901b4caeab527a1b7f29135dc774fdc
MD5 35363b8dfa4004557d1fdba8a9340e2a
BLAKE2b-256 37124badacc6f94e6c113bf9f3480f372855df2555f921998f8a93b7f1601f19

See more details on using hashes here.

File details

Details for the file combinetf2-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: combinetf2-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 73.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for combinetf2-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 415bc38e5709a8b63667d2d29289d23ab7da7c7fb00f61c518df6a116f50f2ad
MD5 0cbe9d94d18d9b172acbea264c301e27
BLAKE2b-256 723095f506b605664233681b6905a0250c61e99379a8ec55567c5a998f45b89b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page