A generic correction library
Project description
correctionlib
Introduction
The purpose of this library is to provide a well-structured JSON data format for a wide variety of ad-hoc correction factors encountered in a typical HEP analysis and a companion evaluation tool suitable for use in C++ and python programs. Here we restrict our definition of correction factors to a class of functions with scalar inputs that produce a scalar output.
In python, the function signature is:
from typing import Union
def f(*args: Union[str,int,float]) -> float:
return ...
In C++, the evaluator implements this currently as:
double Correction::evaluate(const std::vector<std::variant<int, double, std::string>>& values) const;
The supported function classes include:
- multi-dimensional binned lookups;
- binned lookups pointing to multi-argument formulas with a restricted
math function set (
exp
,sqrt
, etc.); - categorical (string or integer enumeration) maps;
- input transforms (updating one input value in place); and
- compositions of the above.
Each function type is represented by a "node" in a call graph and holds all of its parameters in a JSON structure, described by the JSON schema. Possible future extension nodes might include weigted sums (which, when composed with the others, could represent a BDT) and perhaps simple MLPs.
The tool should provide:
- standardized, versioned JSON schemas;
- forward-porting tools (to migrate data written in older schema versions); and
- a well-optimized C++ evaluator and python bindings (with numpy vectorization support).
This tool will definitely not provide:
- support for
TLorentzVector
or other object-type inputs (such tools should be written as a higher-level tool depending on this library as a low-level tool)
Formula support currently includes a mostly-complete subset of the ROOT library TFormula
class,
and is implemented in a threadsafe standalone manner. The parsing grammar is formally defined
and parsed through the use of a header-only PEG parser library.
The supported features mirror CMSSW's reco::formulaEvaluator
and fully passes the test suite for that utility with the purposeful exception of the TMath::
namespace.
The python bindings may be able to call into numexpr,
though, due to the tree-like structure of the corrections, it may prove difficult to exploit vectorization
at levels other than the entrypoint.
Detailed instructions for installing and using this package are provided in the documentation.
Creating new corrections
The correctionlib.schemav2
module provides a helpful framework for defining correction objects
and correctionlib.convert
includes select conversion routines for common types. Nodes can be type-checked as they are
constructed using the parse_obj
class method or by directly constructing them using keyword arguments.
Some examples can be found in data/conversion.py
. The tests/
directory may also be helpful.
Developing
See CONTRIBUTING.md
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 Distributions
Hashes for correctionlib-2.2.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4441fa12623bab23e00c84b67ef7a9a058608c17137042b7e7a96d985669d53 |
|
MD5 | faee5af0d74d25fcc9e1c7f3d299b51a |
|
BLAKE2b-256 | 5b04b33687e219312c6d938dd848e742c0d8f9b99d1f4cb3d3a8c3add4759adb |
Hashes for correctionlib-2.2.1-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1039d9a8092c3e3fa4d878610618adb5fa8de4263c18f23ed90ff5b6250f788b |
|
MD5 | 68af75ce79ece97bbd9ff061416131d3 |
|
BLAKE2b-256 | 1d03759952be607b6ce879f3efa9092b41c38146872947892d48c3d0a6f4d882 |
Hashes for correctionlib-2.2.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3b722e9bfd4632e856bb8ebe5d7d7d43979172688121e5cd03075798771a6d2 |
|
MD5 | 40cec43b083e42daaa8a1be4ab0da278 |
|
BLAKE2b-256 | 7f74a7b300c0909f5e8071bc53a1d4775481fcd52f92d002667adbafb8609cb1 |
Hashes for correctionlib-2.2.1-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fa7cb0e9d7d5216290e512fae207034b1790bd2926b160ceeb7e195b09f890c |
|
MD5 | e58003e3e80202418daec389be6ade61 |
|
BLAKE2b-256 | 7ddbd5544c100bc59c7ec6a0e4caa8940d921c6e8f07717fcbe4281235cb75a3 |
Hashes for correctionlib-2.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba25e01e08e8212d1d2fce3dbcae24be94cd7ad77e22946208dcb3457699c8e2 |
|
MD5 | 490da0b5e9f613343c82e37271a95dfa |
|
BLAKE2b-256 | 19f5e25525cce137ee692f535cd95e7aa8e2cab45dff51a666a59d1e88c81dd7 |
Hashes for correctionlib-2.2.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d0c0a0aa618faffac48e46b18a2d58ada20803ba19c4533fff0f1a6d61bf922 |
|
MD5 | 401f09ae8f60939a74f91d7d70a45374 |
|
BLAKE2b-256 | 6d0db94e5f2f1bc149ef5b79555e5178c6c17362b40e9d9ffb293e4bed353ae7 |
Hashes for correctionlib-2.2.1-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5088be9e3f0327a546b7b46c7d235d35248b44cd1b69f1df62036378191caddd |
|
MD5 | 7ded9426e991a6a40b96895b067c7baf |
|
BLAKE2b-256 | f36ceded68682815acad342fcf42f0551bf3c4679c94e4073181e43be93b25f2 |
Hashes for correctionlib-2.2.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9fa236f3a1c2ff7c5b8880d628c64e1b04ec5444be6b1b822d6643dfbaea7c1 |
|
MD5 | 1bca24728efe857a782cbf79dceb9c54 |
|
BLAKE2b-256 | 5e119803f0b26d589aa7f72ee02c6efe0a608e8126538a0b7deff3e04c37bc70 |
Hashes for correctionlib-2.2.1-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 346f3837ee19c8b4c7b3866e6bc1c7e70a6379399f0388cb1321395177d8db86 |
|
MD5 | 22bcf07c1045f878f3a94a923ba5a7d5 |
|
BLAKE2b-256 | a71b0d11c511a47bca56a7b80ce71b155327b2b22c87921560b68c554d4635e4 |
Hashes for correctionlib-2.2.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 219d0e3bc09495ab7dbb8d7a481e23a3bdb889a4a3ea7b8663f91c776a2e844f |
|
MD5 | 58807db00855dc22885f64ae28defd4e |
|
BLAKE2b-256 | 112a4c052d26152a64fe1675275ab8401f5a636dd6d24b458e820c0d0dc519a8 |
Hashes for correctionlib-2.2.1-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 194f00ce0574620ed1ae43afe408268be71befa718e8d9a459bd65ee2630ee4a |
|
MD5 | b590ab01459f5bb90173272019bc32cf |
|
BLAKE2b-256 | 54f7dc531acd9369de69ccd28f4caae863e85d2746e839fe8e640dac3a218931 |
Hashes for correctionlib-2.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f174fcf439f0476bbe22c7411b80b5366b802381ab59b1d31124ee7c7961602e |
|
MD5 | 7f57e4a67e5bb2469aa086721439048f |
|
BLAKE2b-256 | 0f4b2eecaebaad0590fd3c4e4df54c4db648d19ed4c0693ebf76d858be624030 |
Hashes for correctionlib-2.2.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9209beec6586de71747c79aa6ca959b9d7dd5373769f683fc61eda1e45d3ab1f |
|
MD5 | 5da317c4909ee130fd38be457bd9f4ae |
|
BLAKE2b-256 | ab330bf9c6a8f1d245e3e36175efe60f14ba4e6e2311ee0d643d487557b17632 |
Hashes for correctionlib-2.2.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 061fe828ecb16870b8f60c32b8aea6fd22ffe3e04bef5d60324b2161063ca33e |
|
MD5 | c89291ca89bcde3523870f0e602cc463 |
|
BLAKE2b-256 | d32d65046eb9697757dbf835db0ea57dce110addab9f1a9731d4fb997fed4093 |
Hashes for correctionlib-2.2.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58aa87da05ffa9a2d955d5d83426d1e6346586488a6d41128d2a7ced8ebd0c71 |
|
MD5 | cfe0ee6e247e2bd1ddf3b0962b013ce9 |
|
BLAKE2b-256 | ea1726180a153892bba26651e3d48eab725992ab77c7967c24856da674edcc73 |
Hashes for correctionlib-2.2.1-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01f6cdc7c7154b81ea9be5488899bb1253624627c451467c3ba0ba2953892ba7 |
|
MD5 | b87409f0234c2f3efd2499cbc07f9045 |
|
BLAKE2b-256 | beaeef0b764d80589092316cff2655e237c2a22eaa318b94a141e1fbc468a8a7 |
Hashes for correctionlib-2.2.1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b139b5090924336d41ef7120ce8b2af84d8b0303fec278d448204a3af44388a4 |
|
MD5 | 3cb10a4873a9b23866e0f7c80830f3dc |
|
BLAKE2b-256 | 3cbd14753ed25ea96e73908e4107620aae3d689a5f7ed6a33a22f9554e039668 |
Hashes for correctionlib-2.2.1-cp38-cp38-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9f98e67d8ecb2ebdf7b28e4affb1ca8d2462f6f30d444f6573d558c6b9a2977 |
|
MD5 | 7b43e29aaefe4841702fdb263a25d811 |
|
BLAKE2b-256 | 6f0f40c36267d54adb12a80565d6cd904188e32ba3e28aac555bdbb9b488f5af |
Hashes for correctionlib-2.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1fa37693294ad31ac2b0464c2fff8fc99df682d6ba25ad025a125a832126c88 |
|
MD5 | f4f828d3fdac8b08fb976e60b016a344 |
|
BLAKE2b-256 | d48dab3abf2f4da5a2db69336992672ae0a6ab53021d8afbebef63335cea1e2b |
Hashes for correctionlib-2.2.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a585a5e0cbfd7b3ae2dac36676cce0ceac919ac925d4efa8d4b1f2426b39e60f |
|
MD5 | c6f7fe21d034aaa880360004bf8e3d2e |
|
BLAKE2b-256 | 2e2a4af4a8229ce0fb6b8a2203be2da53a2cbffccd37cd9c0b7e2ad07ab96acc |
Hashes for correctionlib-2.2.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a47840f43c14c335edc8f29219883a8a2ee3b12322f19be4a36b8da908c73b89 |
|
MD5 | 68f3a4ed704f645ae8e6bd360d492465 |
|
BLAKE2b-256 | 83a9a6a708f98ac2abdbb98494b561f021b13078389449e3ebadfc71a8804a2e |
Hashes for correctionlib-2.2.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17788e7cc59571044cbd5a06cb9138eb54d6617a131ee020d4dc2679410e1473 |
|
MD5 | 966e7b2193efb41afa8daa0b7dc28e60 |
|
BLAKE2b-256 | 702e3d7c401962b8d90a775068267340b9e7c7cc9c403fba6224f2b960ed487c |
Hashes for correctionlib-2.2.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b8564c9fbd33aa62eb8b231c0366a1b411fba30b17e53c4cccc0653e3e27418 |
|
MD5 | c4e216627450ed9ec55bf45a3a977354 |
|
BLAKE2b-256 | e32d3b0d91def9f0b3c2b8a930f4b2ff67508ef5e939765a33cf6c59ab881847 |
Hashes for correctionlib-2.2.1-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b6cbf0e176c28f20ff858d0a22b9e218d9aa3848f185f0f7f00b482c2dddcde |
|
MD5 | d11a3f19f5c55eed96c3759e20f0fbfa |
|
BLAKE2b-256 | 5fd9c9d1750b9fe098be094ec71d1b3d3ee809c9846add9e5a51260c417e2591 |
Hashes for correctionlib-2.2.1-cp37-cp37m-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d578dcd8eace08a367075d2cafee5bcc5f5d2cb2021910402ab0a943eed9710e |
|
MD5 | 704e07540c4286fda3ee8044aa3396af |
|
BLAKE2b-256 | 3d7048ae41dbe1a9ec41cde86686eeb80d87cb5af352ff76e31d9965c3f7bf55 |
Hashes for correctionlib-2.2.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b84aabf3eebd4f49119904466fb4c4967193ce239db6d6a68243669814045953 |
|
MD5 | 9d312192ce908bfdd1ec0d9858f1b9c5 |
|
BLAKE2b-256 | 970d84164061ec45cdb714787d8bc1b66daea7cd3bda1292227a6dc61038b466 |
Hashes for correctionlib-2.2.1-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e7f016312e5ce5b44870de1c3662985e625afa8766546fc99c2659c595c32da |
|
MD5 | a6627522759c452225b67ffa09cd2d34 |
|
BLAKE2b-256 | 28b110512eee8be938fb9ff910653c15a1507fcaef21a71037e1ac8d238fd142 |
Hashes for correctionlib-2.2.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f014b15abf68e8accdcaa4a6840bd415380d1ac41b414b896af18f53a95473cb |
|
MD5 | a86c66562844c4f75163dfb814773cd7 |
|
BLAKE2b-256 | 03657f7a51dd2942db6492ef12cf63625ae81543d87902c75d04566a3450c03a |
Hashes for correctionlib-2.2.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 788e998dbe04af126992c5021bb2c371454e8714b0f1b0220f58f5d117153bbf |
|
MD5 | aafb1a0a345638552ae580aaafbc2281 |
|
BLAKE2b-256 | 24d0a22606bab47cec2de7135d7eb1d8b7ea0270442f8817fc2a9dca1350583e |
Hashes for correctionlib-2.2.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3cfcc2bef155bc4df554db2375adec844af4227f78731a152cc1954b87a83c7 |
|
MD5 | 6b71c38920d15cf3769a9a57a471590b |
|
BLAKE2b-256 | ff3021ce15df137f2d36c5492e92a2fd90c360e8ddede74de724aea9163d82c5 |
Hashes for correctionlib-2.2.1-cp36-cp36m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 876030076a5df815542e47f27f540039fcb6643133a06eca0395011c7055f851 |
|
MD5 | 8521c2b119658b9bd493aa50d1c1dd8d |
|
BLAKE2b-256 | fdaa9a990a6ff016ba4c604cf61cb65205c2b3b82a5c751a1d08f820687b2bbe |
Hashes for correctionlib-2.2.1-cp36-cp36m-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a86f85bd2d92c27da50031fe9dd77ae7744b02c953dd5bbbe29f28da229d2880 |
|
MD5 | 33944fe2d45c0602d530644fcdf08235 |
|
BLAKE2b-256 | c1d8be7088580075dae829a29fd269f25adcb48faa60a82684a42b9e70f377d5 |
Hashes for correctionlib-2.2.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17878687960baf7e20bd13b8c7011406aefd2deef4d11ea6919fa4ccb36cb324 |
|
MD5 | 2a75b36bc6466cdf8f7dc32a3087dc26 |
|
BLAKE2b-256 | a2e271f54eef05cf84b857445aeb080232b9dcb95f85732215de2217305f85ae |
Hashes for correctionlib-2.2.1-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 917b2aec284c847dec983eac48ad89fd090675116b3c7ccbd528b0063503b045 |
|
MD5 | b088a79e81bfef3948fa1a0812fec498 |
|
BLAKE2b-256 | 933c9d97c9b7fdf9c589bbcba688d105ad769253c4764055a82300b918850f2a |
Hashes for correctionlib-2.2.1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ff9edda6007380693868ef79cddacd977fd1f7c0370b5cca261e525741b8895 |
|
MD5 | bc4ca23f6984fa05ccb5b9234fdb2f59 |
|
BLAKE2b-256 | 6cca77c4c1ec497b5b222681810822bf4d4f88903bd36d2a68d73244a7f90efe |