Skip to main content

PDG-powered particle data tool with multi-name variant support

Project description

# particlespell

A lightweight, PDG-powered particle data tool with multi-variant name support and real-time data synchronization.

## Overview
particlespell simplifies particle property retrieval by unifying local fast lookup and PDG's authoritative API. It natively supports multiple particle name variants (LaTeX, EvtGen, Unicode, etc.) and automatically fetches updated data from PDG, making particle physics data access intuitive and efficient.

## Installation
Requires Python 3.12+:
```bash
pip install particlespell

Quick Start

from particlespell import Particle

# 1. Query by name (supports multiple variants)
p = Particle(name="π⁺")  # Or "pi+", "\\pi^+", "pi_plus", "π<sup>+</sup>"
print(f"Mass: {p.mass} ± {p.mass_err} MeV/c²")
print(f"Lifetime: {p.lifetime} s")
print(f"Quantum J/P: {p.quantum_J}/{p.quantum_P}")

# 2. Query by PDG MCID
p_proton = Particle(mcid=2212)
print(f"Name: {p_proton.name}, Charge: {p_proton.charge}")

# 3. Access decay properties
print("Top 2 branching fractions:")
for bf in p.branching_fractions[:2]:
    print('%-60s    %4s    %s' % (
        bf.get('description', ''),
        bf.get('is_limit', ''),
        bf.get('value', '')
    ))

Core Features

  • Multi-Variant Name Compatibility: Seamlessly match particles by standard name, LaTeX, EvtGen, HTML, Unicode, or custom aliases.
  • Comprehensive Particle Properties: Retrieve mass, lifetime, charge, branching fractions, quantum numbers (J/P/C/I/G), and particle type flags (baryon/meson/lepton/etc.).
  • PDG Data Synchronization: Automatically supplements local data with up-to-date PDG API results, with built-in caching to avoid redundant requests.
  • Dual Query Modes: Look up particles by name (flexible) or PDG MCID (precise).
  • Robust Fallback: Retains local data access even if PDG API is unavailable.

Key Properties

Category Properties
Basic Info name, mcid, programmatic_name, latex_name, evtgen_name
Dynamic Data mass/mass_err, lifetime/lifetime_err, width/width_err
Decay Data branching_fractions, inclusive_branching_fractions, exclusive_branching_fractions
Classification charge, is_baryon, is_meson, is_lepton, is_boson, is_quark
Quantum Numbers quantum_J, quantum_P, quantum_C, quantum_I, quantum_G

Dependencies

  • pdg >= 0.1.4 (PDG official API client)
  • particle >= 0.25.3 (particle name variant support)
  • Python 3.12+

Contributors

License

Copyright (c) 2025 Zhang Bolun, Liao Yipu

This project is licensed under the MIT License — see the LICENSE file for full details.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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

particlespell-0.0.2.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

particlespell-0.0.2-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file particlespell-0.0.2.tar.gz.

File metadata

  • Download URL: particlespell-0.0.2.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for particlespell-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d186d4699c80bfd563f24d4d59ee611432cb2b4b7247257e09ceddd045b3636b
MD5 6519bd751bd45bd6915478cd0d824804
BLAKE2b-256 0c6dde84560a8bac736886639041ee7512a114e22969099eb37e0ccd2ca791b1

See more details on using hashes here.

File details

Details for the file particlespell-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: particlespell-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for particlespell-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d20f8735a72a53eccf1a73b0bb17f8eec4b81f3d84cf1d085f7e4a5211f5326e
MD5 0e8429e29a2f26616372e926dfb9e1f8
BLAKE2b-256 1c5511912b82e3f749d1a0ebf529de28e96a14c49c3784cd4f7859fe7f8ee4bd

See more details on using hashes here.

Supported by

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