Skip to main content
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.

Release files for sweights 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sweights 1.7.0
File Size Uploaded
sweights-1.7.0.tar.gz 1.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for sweights 1.7.0
File Interpreter ABI Platform
sweights-1.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / sweights-1.7.0.tar.gz

Download URL sweights-1.7.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
28ed06b865253c2d86b3897681aeb025a7df6c8f09d8ef48667297dd936e9db7
BLAKE2b-256 checksum
How to use checksums
b327bde1f84d67d004a027fcdd37799342eb8cf5faa32f8928851686e412267b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 19, 2025.

Transparency log

Release files / sweights-1.7.0-py3-none-any.whl

Download URL sweights-1.7.0-py3-none-any.whl
Size 29.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
844525241011a15f00aeff20a844e80c7c3e2d1f4ae0e73650e1220d52d696f2
BLAKE2b-256 checksum
How to use checksums
b0db26600958946918275e19ebfc15f9161e4d5b1e31372fc1b7e5c6abb06f7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 19, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files

1.6.0

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page