Skip to main content

Tools for producing sweights using classic methods or custom orthogonal weight functions (COWs) and for correcting covariance matrices for weighted data fits.

Project description

https://img.shields.io/pypi/v/sweights.svg https://github.com/sweights/sweights/actions/workflows/docs.yml/badge.svg?branch=main https://img.shields.io/badge/arXiv-2112.04574-b31b1b.svg

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:

Dembinski, H., Kenzie, M., Langenbruch, C. and Schmelling, M., Custom Orthogonal Weight functions (COWs) for event classification, NIMA 1040 (2022) 167270

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


Download files

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

Source Distribution

sweights-1.7.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

sweights-1.7.0-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file sweights-1.7.0.tar.gz.

File metadata

  • Download URL: sweights-1.7.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for sweights-1.7.0.tar.gz
Algorithm Hash digest
SHA256 28ed06b865253c2d86b3897681aeb025a7df6c8f09d8ef48667297dd936e9db7
MD5 ab4b678ed9897e1d932c1fab06ea6c3f
BLAKE2b-256 b327bde1f84d67d004a027fcdd37799342eb8cf5faa32f8928851686e412267b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sweights-1.7.0.tar.gz:

Publisher: release.yml on sweights/sweights

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sweights-1.7.0-py3-none-any.whl.

File metadata

  • Download URL: sweights-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for sweights-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 844525241011a15f00aeff20a844e80c7c3e2d1f4ae0e73650e1220d52d696f2
MD5 c7044a896e930b104de3086eee53c420
BLAKE2b-256 b0db26600958946918275e19ebfc15f9161e4d5b1e31372fc1b7e5c6abb06f7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sweights-1.7.0-py3-none-any.whl:

Publisher: release.yml on sweights/sweights

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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