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:
def f(*args: 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
A demo/tutorial of the features is available in the documentation and also available interactively on binder
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.
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.6.1-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ff4c7df7a51cba50a236fb568bbac5641d05aeec0a09814dbfe42b582872d55 |
|
MD5 | d6d7076da2aaf1a721a5ed529a8b754c |
|
BLAKE2b-256 | 4e914bbf7b8695d980a4a48d1096530f14948dbdafbec4c74fe72956413a8e14 |
Hashes for correctionlib-2.6.1-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33e6afa7c8d29b91b191f85292bfe310d05109f7cb86bb2be32348279a70933a |
|
MD5 | 8b31b63a8e3582c642f6e86bfd307f19 |
|
BLAKE2b-256 | a29b8c740e1b19a41e03a59894ef3a762d78fff93bdff64e125ffe037ed5268f |
Hashes for correctionlib-2.6.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d9ef4e8297585ecd5c99e3b46ccec1c96f9bb562fabc70d6ae6fa6eda949b6d |
|
MD5 | f8a91a30261a6928cf8ab501d49507fe |
|
BLAKE2b-256 | 07b5c29f38fdad261b1a57728ae878967e3dce4f822b401207a32e12bdb8c974 |
Hashes for correctionlib-2.6.1-cp312-cp312-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd8fbbd927790e0ea687132dfffc8df5f3f151010d3b9abc94427cfe5fa0c289 |
|
MD5 | 8791d52327d4397547e2459609fa073e |
|
BLAKE2b-256 | 79031441732764e3526699c8231877991e4bf914a7df230b9817d1fd6e22e176 |
Hashes for correctionlib-2.6.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bdb6dd054e256d219605d9d79d90e3eafed7516fbb9b80400cbf49f90034d86 |
|
MD5 | d710901f215de48354a662b95ea12dd6 |
|
BLAKE2b-256 | 4a91d6858735d1a82307645e0835172e8068844634d106b76773c63574c76260 |
Hashes for correctionlib-2.6.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24d1452feb758833fd9672b309bb7fd6f175873b7c0aa30a3892e520f07c49a3 |
|
MD5 | 3f7908f0c25e2be0a8017d886c0d6732 |
|
BLAKE2b-256 | c313baf793df704f82e0b8dc693ca3f62617ef772f912dc458ad18a2bcfdd6c3 |
Hashes for correctionlib-2.6.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 060b9312181f5b0850382b3288378e2a2238f62e9b3be8a65232a67a612a61ba |
|
MD5 | 680847ad780a2d5d076836d3595b14eb |
|
BLAKE2b-256 | df881d7d3b1a776bd7bcdf76419d2043e857bc530de7fe79e60a5f792ce723f0 |
Hashes for correctionlib-2.6.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7efdcd1816aad3221c81158ab7ee20069667454f9e8b760a985d295ecb6ebc9b |
|
MD5 | 9e07e5e09d139a6b2545f338be338a5c |
|
BLAKE2b-256 | 27b216a676d2066dd60c6429a478d6137f64489b562d47bd654eb7e60874bdbf |
Hashes for correctionlib-2.6.1-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e40f195e2d0d06d7977446a36d778428eb50a6fae22beaa6eea9f52871c6ac61 |
|
MD5 | 8d7fbc9925ebaa68e0b154e56b63219a |
|
BLAKE2b-256 | e8f05c6d4c0a07def4fb43af0bab0f273c487be31937bb3f9b8e44ca49b3362e |
Hashes for correctionlib-2.6.1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6afb72f5041a164d7ee911246abdfc158c59a65c20ba8ace14b015de09ef26e8 |
|
MD5 | 566cd8e91c92569712e8006c0fab5bac |
|
BLAKE2b-256 | 21ea4301458273703a7c0520262ecd5880087e2ef6d84ceab21113fbc5700ef6 |
Hashes for correctionlib-2.6.1-cp311-cp311-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ecac7d896d77da63d5123bf5943de0610db5f42824ac75e24806d02fcad64fa |
|
MD5 | 8ab071be7202ad092325399c373a7cae |
|
BLAKE2b-256 | 7f0152a0989a6f01a5d63eb3bf35fbee22f7f169da62cae91fcf67d196d03157 |
Hashes for correctionlib-2.6.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb157e71a07e64771cd7d5a191b9d4ea88ed09db64002065fdf7a366823eff52 |
|
MD5 | efbf0e055d9f5e99386fbb0b0439f8fa |
|
BLAKE2b-256 | ed1f1e176ed4eccefecdc98b40dc387029e3036bf738b0db0ff9073b816fc65f |
Hashes for correctionlib-2.6.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62abef0214094f198773435a97f3b44a5497b2ed3dd7e9b2b55779576b81685d |
|
MD5 | 04c0d33ac154aa92e75110a2891dc282 |
|
BLAKE2b-256 | 7e3a272caa23a65e2c7865079cc472c3e81f7b5ce259e8dee72b377b8e458daa |
Hashes for correctionlib-2.6.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9ed24b78bbf72f291d801de00ee9baa3d7fe18212739361cbb26f49ee34cd93 |
|
MD5 | f015ee59d6397035f86f89edd819861c |
|
BLAKE2b-256 | 6db7dbaec2b663b5ee410c0f12066bba921b1ca08fe2f3af538260b840f6272c |
Hashes for correctionlib-2.6.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90db21fced38fe44f4cec95a3f6ee446a94fff0e8fbc4b8f9f3d3d5254c8750d |
|
MD5 | 11cbe4fb520d7ffda1efa7b0831cc9c2 |
|
BLAKE2b-256 | 33d13ee11e52670f256fbf8df1231ae9052a98ef33a401ce3020718857ff7d6d |
Hashes for correctionlib-2.6.1-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 346a888f7fbc7be1f3396864b2108e177892684ef941652bc101304f409520c2 |
|
MD5 | d714a0e6527fd27799d174f63e1236ac |
|
BLAKE2b-256 | 2c7b4bef64e29c33a85405a188b65372066c24b64761722cc6ec9533c67332e7 |
Hashes for correctionlib-2.6.1-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07fe80dac4a8be9c0e2a377862a197d2a7d196cd7496aa91b898ec92ecc4bcae |
|
MD5 | b49b5b03283de6e99231df69f721e6a6 |
|
BLAKE2b-256 | eb03e8438aad78873a0f0cb2f8d803bd8d896e6d57ce091cd8830d4c9ba6b86b |
Hashes for correctionlib-2.6.1-cp310-cp310-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b0c3a4c45ddc5b1ec6ffd1ce5a9cde120b700f62f4501c12f0683c2b9efea73 |
|
MD5 | f2ea74d77b031a9724087acad246fb0a |
|
BLAKE2b-256 | 1efa56e25280b2795ee217c00c3c0451949030e22aa5ba0941f76ed7ccb22201 |
Hashes for correctionlib-2.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41d218938ed595f62a722c4c713ceb954059d2c2ea0a3a60653a6d6cadcb50a8 |
|
MD5 | ced04061a95004646d9dc5ccb65e8fab |
|
BLAKE2b-256 | 5e38bf9a01799aa607516076b6d29fbcd06c68edee11cc6fafd7c4154ac3dde2 |
Hashes for correctionlib-2.6.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97a3c300fefb6f7a77a25ce22746aa54eeb1d4162a01e3ebb9118ff1d72e0b82 |
|
MD5 | 3cb4183d0ff6ec2f29cda5968069469a |
|
BLAKE2b-256 | 5996b0a42d2d8c130c668f2d84cd76d8ba151abdd60ae20ea66e63eadc23c920 |
Hashes for correctionlib-2.6.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d4936bc24726245b60c54e52006ba66e6343093ab2d32f22e12b8468bb6daac |
|
MD5 | c17d39fe71314d3efb29b60f45218f45 |
|
BLAKE2b-256 | 45f7bd782685b0b3d68d163077fcfa6f48919f4392666d254dfd1161ac44ed00 |
Hashes for correctionlib-2.6.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf8dea55b76fa9dcd0ffeaca0e846a5ad4789818e20949effd2344d08f975bac |
|
MD5 | 5c0bafcbff69254b8d66d5cf1902eb6c |
|
BLAKE2b-256 | 0ee9d55cfaa4a090fe696e22481addd12c4d1e78a8891e505dc83d6ff593e0d1 |
Hashes for correctionlib-2.6.1-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b763c95cdebb13a5457f1cceabab92193caafe5e66afc3bbb6bdda141bf5d58b |
|
MD5 | baaabe3ef9e200f5329ad5ec2802af35 |
|
BLAKE2b-256 | 7892d0ebcc513db1b4716d8cb065e314118ba73648788bbc8ac4599897da50e7 |
Hashes for correctionlib-2.6.1-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9246be60cd90b79b30e349645579cea9ac62ea3a9a70ae544718f87d52b6c1f5 |
|
MD5 | 9f56abd0532b69981828cb2652a3d995 |
|
BLAKE2b-256 | 74ac3490accd17885e6dac7be11c4e38cdff2fdfa18b9bf5b4025a657758053e |
Hashes for correctionlib-2.6.1-cp39-cp39-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e8b7a1a83505db89499d273c9fb9a5a4947d7cd6ec62dc2a956a06d72e5da88 |
|
MD5 | abdc42eab81a436518ade6490d8e9ea2 |
|
BLAKE2b-256 | 00f2f8cfeb36b8c368424fbf69ce98b18027fddd56cf81b6f508c8831fd65dcd |
Hashes for correctionlib-2.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 889e519233420fe34e094a62e8b65bd9918201fa26be70263bc2a65aa541f98d |
|
MD5 | 46cdee261814e55c3d9e09a9310b6ebb |
|
BLAKE2b-256 | a1ee2667bd97109819e301c2a6c7688fd91bf249e4896f04aa4662a286acdb13 |
Hashes for correctionlib-2.6.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 362f617bc979b62097960006aa60580787fd0accb845365d2508b1fececa7bde |
|
MD5 | bde97005d431096f143bf0b3906c0883 |
|
BLAKE2b-256 | 50aa0e192157395e422bfc8b61015b89411f0bc834a3c58ba0907909c6204037 |
Hashes for correctionlib-2.6.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cebe7323638ee68c0055b907a1b2cac9a725d67f5ab91078ef12507ba1ef9e2 |
|
MD5 | 38eae23f9f43d1f0ebc7edf9fd06904e |
|
BLAKE2b-256 | 50bac28004134433184bd291387d6d397f9857594b7a631d8fbb89da58ed0fb3 |
Hashes for correctionlib-2.6.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cae92ea82990104442c4238269da6837c52a85972401ebb2989f83137f4c6a4 |
|
MD5 | f3374beae80712db837812b7b59f8fb8 |
|
BLAKE2b-256 | 49eb73942884dc9793066f817dbbf08e1e908dbd4c8cbd36f44130597fdd4487 |
Hashes for correctionlib-2.6.1-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adf7d151527a346a1afb260075869fd79bcbbdd704b3b76e4208fca59ebb6b44 |
|
MD5 | 1d60abdad2a8a2aaa70e7040cc880fc0 |
|
BLAKE2b-256 | 31cf0eca67c8df5d8e624dd48b2507529cdd72562f3ee1985a0cbeb2cfd101e0 |
Hashes for correctionlib-2.6.1-cp38-cp38-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad46654913f1738ee1f1f925b06d99a774490f2e3ad15ed3571568b0e61c0271 |
|
MD5 | fa6c665e93e8ed524274e4f71f32c8ed |
|
BLAKE2b-256 | 6f6b53d6d6d89386337d9bab0f9cc9ab4823af6d3ae45e4be0d3ca8a49314d26 |
Hashes for correctionlib-2.6.1-cp38-cp38-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fd01fe208802593cf160ca518ec7a4a6162affae4b609b22727aafff5902ab5 |
|
MD5 | c0e9f2d37f9a237f556efe6a5ed21387 |
|
BLAKE2b-256 | e6363c9f8330055899f9ae3755ffbd31043891d3577ab0ae04f531a2a5bc21f7 |
Hashes for correctionlib-2.6.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3501ddb4fa36344fbf4c20ee22c7035d2e6d209a59e4b2555573c4f10506bf54 |
|
MD5 | af84abe9ce17af3b31686fcc598cf6a5 |
|
BLAKE2b-256 | 912fe712a34bc7d164fcfe29a0edb13aa4d65f846b18ac6f95ddcd4a2c42c685 |
Hashes for correctionlib-2.6.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f79957b5fa91c5b4468b650042a2417ff6594bf1ec34d3919a0513bf7c6bca37 |
|
MD5 | d26ce2f8752545fa407ab8c0fb580694 |
|
BLAKE2b-256 | 0f1dc99c5ef788e192d3696ff32853f414b5b096857df1d4c01c94c1116569ad |
Hashes for correctionlib-2.6.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ab96bfa1f3f80d6bb34ad7b0a7a582a76f63fad71b9ab53145277eec8789ecd |
|
MD5 | 897f182ac627eac4199af6f062887a61 |
|
BLAKE2b-256 | 803ef12548add1ee27c529748ac2325972f2a18e0f2c60462b01caeab53a6d7b |
Hashes for correctionlib-2.6.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e02ec0ad60df7a0d48b1ecad409880d087a00f8c9d92ec0f7354f7ffc7cfbc26 |
|
MD5 | 2f411205b24bd91d374b82e5ddfb184e |
|
BLAKE2b-256 | f69fda73e65a08b306464052330ad2262e97ad9eeaf419928d750099dbfef083 |
Hashes for correctionlib-2.6.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a786cfa3080b010e1c1b00c6564011e97b168ea1aa17cee5dadd794e32c55ac |
|
MD5 | 12afe72262252b527172b1ce6a0d65f0 |
|
BLAKE2b-256 | 2928c0246575ec177a3156d90bac29df383a42332b3f004d19e267877f89423b |
Hashes for correctionlib-2.6.1-cp37-cp37m-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2ddba129e7fc282c78e6774ce4d3b19abf37c74f6a513f1a7818984c4dd96b9 |
|
MD5 | 8353d94e4f32bbe4c6d4fa412c23cb64 |
|
BLAKE2b-256 | 4dbe1202b4d68b30f1a1b42edc5b0dae85fc0de96617856ccd1dbec0879476eb |
Hashes for correctionlib-2.6.1-cp37-cp37m-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38f86ba0fe471c6d11db0b7805ae6d36f5f2ac051e74cc5f15d08b4c1ccd019a |
|
MD5 | 07505b751664b0e29496be894a21709a |
|
BLAKE2b-256 | c2f39ee2a6ccbec1cf5c40b418624a6ed946cda45e95bbc60635b29ff88ab885 |
Hashes for correctionlib-2.6.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ade0aa7e133aa144353415b6e42ca416fef1d7e3f88a8e289f9f9c6d09b60c07 |
|
MD5 | 1243238471bcfc3ee912dc257088baf5 |
|
BLAKE2b-256 | cbd0494641487d26066a6593be29c857582f3e509ac32d7f0f766fdd2e2cc7ef |
Hashes for correctionlib-2.6.1-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a68ffb7513f44ae8187613b34990dde18db96968ec58aacf60981889ff078876 |
|
MD5 | 8c45d1f5138f043e5f7ed1d86261cec7 |
|
BLAKE2b-256 | 5414e4b017dfd06e8f9de127897ac3a8eb8ea22b79173ed020588d6d3a45d1d0 |