skillfed

mt2

Stransverse mass computation as a numpy ufunc.

mt2 v1.3.1 430.0K downloads/30d#6,732 on PyPI4
Permissive license MIT Active released

What it is and what it does

mt2 is a specialized physics library that computes the stransverse mass (MT2), a kinematic variable used in high-energy particle physics to infer properties of invisible particles in collision events. It wraps an optimized C++ implementation of the Lester-Nachman bisection algorithm, providing both a standard function and a raw numpy ufunc for flexibility.

The package is designed for high-throughput calculations in particle physics analyses. It supports vectorization over numpy arrays, allowing efficient batch computation across grids of parameters—useful for Monte Carlo simulations and parameter scans. The implementation is scale-invariant and reportedly 3x to 4x faster than the original arXiv reference code, with a fallback to the legacy arxiv implementation available for independent verification.

Use it for:

  • Compute MT2 for individual particle collision events in high-energy physics data analysis.
  • Scan parameter grids of invisible particle masses using vectorized numpy arrays for efficiency.
  • Cross-check results against the legacy arXiv implementation using mt2_arxiv for validation.
  • Integrate MT2 calculations into Monte Carlo simulations for physics phenomenology studies.
  • Use as a numpy ufunc with advanced features like conditional computation via the where argument.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Computes stransverse mass (MT2) for particle physics calculations, supporting both symmetric and asymmetric cases with vectorized numpy array operations.

Yes, if you work in particle physics and need MT2 calculations. The package is actively maintained, has no known vulnerabilities, supports modern Python versions (3.9–3.14), and offers significant performance gains over reference implementations. Install friction is moderate due to C++ compilation, but precompiled wheels mitigate this for most platforms. MIT licensing poses no restrictions.

Install

mt2 on PyPI

pip

pip install mt2

uv

uv add mt2

poetry

poetry add mt2

Installing mt2

Before you install

Medium install friction due to compiled C++ components, but precompiled wheels cover Python 3.9–3.14 across macOS, Linux, and Windows. Repository is actively maintained with a recent commit on 2026-08-10 and stable release status.

License in practice

Released under MIT (permissive), allowing use in commercial and academic projects with minimal restrictions. Citation of the underlying papers (arXiv:hep-ph/9906349 and arXiv:1411.4312) is requested but not legally required.

Quickstart

pip install mt2

from mt2 import mt2

val = mt2(
    100, 410, 20,      # Visible 1: mass, px, py
    150, -210, -300,   # Visible 2: mass, px, py
    -200, 280,         # Missing transverse momentum: x, y
    100, 100)          # Invisible 1 mass, invisible 2 mass
print(val)

Requires numpy as a runtime dependency; C++ compilation may be needed if building from source rather than using precompiled wheels.

Verify before relying

  • Whether the 3x to 4x speedup over the arXiv reference implementation holds across all input ranges and precisions.
  • Scale-invariance claims and their practical implications for very large or very small input magnitudes.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 309 days since the last release
Last repo commit
First released
Downloads 430,029/month — #6,732 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mt2-1.3.1-cp310-cp310-macosx_10_9_universal2.whl; mt2-1.3.1-cp310-cp310-macosx_11_0_arm64.whl; mt2-1.3.1-cp310-cp310-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl; mt2-1.3.1-cp310-cp310-musllinux_1_2_x86_64.whl; mt2-1.3.1-cp310-cp310-win_amd64.whl; mt2-1.3.1-cp311-cp311-macosx_10_9_universal2.whl; mt2-1.3.1-cp311-cp311-macosx_11_0_arm64.whl; mt2-1.3.1-cp311-cp311-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl; mt2-1.3.1-cp311-cp311-musllinux_1_2_x86_64.whl; mt2-1.3.1-cp311-cp311-win_amd64.whl; mt2-1.3.1-cp311-cp311-win_arm64.whl; mt2-1.3.1-cp312-cp312-macosx_10_13_universal2.whl; mt2-1.3.1-cp312-cp312-macosx_11_0_arm64.whl; mt2-1.3.1-cp312-cp312-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl; mt2-1.3.1-cp312-cp312-musllinux_1_2_x86_64.whl; mt2-1.3.1-cp312-cp312-win_amd64.whl; mt2-1.3.1-cp312-cp312-win_arm64.whl; mt2-1.3.1-cp313-cp313-macosx_10_13_universal2.whl; mt2-1.3.1-cp313-cp313-macosx_11_0_arm64.whl; mt2-1.3.1-cp313-cp313-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl

Keywords: mt2

Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9

Tags

stransverse mass calculationMT2 computationparticle physics massbisection algorithm MT2numpy vectorized physicstransverse mass calculatorhigh energy physics tools
particle-physicshigh-energy-physicsnumpy-ufunc

More Scientific/Engineering packages