Tools for producing sweights using classic methods or custom orthogonal weight functions (COWs) and for correcting covariance matrices for weighted data fits.
Project description
We provide a tool to calculate signal weights called sWeights, which can be used to project out the signal component in a mixture of signal and background in a control variable(s), while using fits in an independent discriminating variable. This technique was first popularized under the name sPlot method, but we think this is a misnomer and hence call it sWeights, since it is useful for more than plotting. We found that sWeights are a special case of more general Custom Orthogonal Weight functions (COWs), which extend the range of applicability of classic sWeights. If you use this package, please cite our paper:
If you cannot access this paper for free, checkout the preprint arXiv:2112.04574.
We also provide tools for computing the correct covariance matrix of fits to weighted data, described in section IV of our paper and in more detail in Langenbruch arXiv:1911.01303. The standard method of inverting the Hesse matrix does not work. When in doubt, please use the bootstrap method.
Installation
You can install sweights from PyPI.
pip install sweights
Documentation
You can find our documentation here, which contain tutorials how to use the package and how avoid pitfalls.
Partner projects
numba_stats provides faster implementations of probability density functions than scipy, and a few specific ones used in particle physics that are not in scipy.
boost-histogram from Scikit-HEP provides fast generalized histograms that you can use with the builtin cost functions.
jacobi provides a robust, fast, and accurate calculation of the Jacobi matrix of any transformation function and building a function for generic error propagation.
resample provides a simple API to calculate bootstrap estimate.
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
File details
Details for the file sweights-1.6.0.tar.gz
.
File metadata
- Download URL: sweights-1.6.0.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34b60d21815c25be9a60b1d71e2927389ce0ca47c4492b916882d8b916d99ddb |
|
MD5 | 601a95f6334c004bc690521ab6f416da |
|
BLAKE2b-256 | 0fa96414aa9eeadc9df4fa3fecbdbcaf0011fa8fcdf79d12f8f97754fd6f03b2 |
File details
Details for the file sweights-1.6.0-py3-none-any.whl
.
File metadata
- Download URL: sweights-1.6.0-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb7601378285c8f87472b05746af06fc871ab2d65b65e143cc14915be7077369 |
|
MD5 | 9906535734e12f7ad89b0ed2c9c276d6 |
|
BLAKE2b-256 | 93d131696fe08cba2705e82a8998b84fded6c762d1b6b0f54824675e2ab16ce7 |