{"id":5359,"library":"particle","title":"Particle","description":"Particle is a core library within the Scikit-HEP ecosystem, providing a Pythonic interface to the Particle Data Group (PDG) particle data tables and Monte Carlo (MC) identification codes. It offers extended particle information, identification queries via PDGID, and powerful search capabilities for particle properties. The library is under active development and frequently updated with new PDG data releases.","status":"active","version":"0.26.1","language":"python","source_language":"en","source_url":"https://github.com/scikit-hep/particle","tags":["physics","high-energy physics","PDG","particle data"],"install":[{"cmd":"pip install particle","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for data handling and internal data tables.","package":"pandas","optional":false},{"reason":"Provides classes without boilerplate, similar to Python's DataClasses.","package":"attrs","optional":false},{"reason":"Provides units for the Scikit-HEP packages, used for physical quantities.","package":"hepunits","optional":false}],"imports":[{"note":"Main class for interacting with PDG particle data.","symbol":"Particle","correct":"from particle import Particle"},{"note":"Class for querying properties of PDG identification numbers.","symbol":"PDGID","correct":"from particle import PDGID"},{"note":"Provides aliases for PDGID instances, e.g., `pdgid_literals.pi_plus`.","symbol":"pdgid.literals","correct":"import particle.pdgid.literals as pdgid_literals"},{"note":"Provides aliases for Particle instances, e.g., `particle_literals.phi_1020`.","symbol":"literals","correct":"import particle.literals as particle_literals"}],"quickstart":{"code":"from particle import PDGID, Particle\nfrom hepunits import GeV\n\n# Working with PDG IDs\npid_pion = PDGID(211)\nprint(f\"PDGID 211 is a meson: {pid_pion.is_meson}\")\n\n# Getting a Particle object from its PDG ID\npion = Particle.from_pdgid(211)\nprint(f\"Pion mass: {pion.mass / GeV:.3f} GeV\")\n\n# Searching for particles by properties\nneutral_beauty_hadrons = Particle.findall(lambda p: p.charge == 0 and p.has_bottom and p.mass > 5.2 * GeV and p.mass < 5.3 * GeV)\nfor p in neutral_beauty_hadrons:\n    print(f\"Found neutral beauty hadron: {p.name} (mass={p.mass / GeV:.3f} GeV)\")\n","lang":"python","description":"This quickstart demonstrates how to create `PDGID` and `Particle` objects, access their properties, and perform searches for particles based on specific criteria. It also shows the integration with `hepunits` for handling physical units."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher. The current version (0.26.1) requires Python >=3.9.","message":"Python 3.7 and 3.8 support has been dropped in recent versions. Python 3.7 support was removed in v0.24.0, and Python 3.8 support was removed in v0.26.0.","severity":"breaking","affected_versions":">=0.24.0"},{"fix":"Consult the changelog or documentation for version 0.24.0 to identify and update any calls to removed methods.","message":"Deprecated methods were removed in version 0.24.0 of the library.","severity":"breaking","affected_versions":">=0.24.0"},{"fix":"If your analysis requires a specific older PDG data table, you may need to explicitly load it or use an older version of the `particle` library. Always be aware of which PDG data year is being used by default.","message":"The default PDG data table is updated annually with new releases (e.g., v0.26.0 defaults to 2025 data, v0.25.0 to 2024 data). Older superseded data files are removed.","severity":"gotcha","affected_versions":"All versions with yearly PDG updates"},{"fix":"Exercise caution when manually defining particles. Ensure that any custom PDG IDs are consistent with the standard PDG numbering scheme if you expect quantum numbers and other properties to be correctly inferred.","message":"When creating user-defined particles, assigning 'random' PDG IDs can result in particles with undefined or incorrect internal quantum numbers and properties.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'activ':52 'capabl':44 'carlo':28 'code':31 'core':5 'data':20,24,60,69 'develop':53 'ecosystem':12 'energi':65 'extend':34 'frequent':55 'group':21 'hep':11 'high':64 'high-energi':63 'identif':30,37 'inform':36 'interfac':16 'librari':6,49 'mc':29 'mont':27 'new':58 'offer':33 'particl':1,2,19,23,35,46,68 'pdg':22,59,67 'pdgid':40 'physic':62,66 'power':42 'properti':47 'provid':13 'python':15 'queri':38 'releas':61 'scikit':10 'scikit-hep':9 'search':43 'tabl':25 'updat':56 'via':39 'within':7","created_at":"2026-04-14T01:30:27.060224+00:00","updated_at":"2026-04-16T17:54:04.527904+00:00","problems":[{"fix":"Install the library using pip: `pip install particle`","cause":"The 'particle' library is not installed in your Python environment or the Python interpreter cannot locate it in its search path.","error":"ModuleNotFoundError: No module named 'particle'"},{"fix":"Consult the `particle` library's documentation to verify available attributes and methods, or ensure you are not misinterpreting an object's capabilities. For properties like momentum, one might access `p.momentum` or calculate sums manually if `MomentumSum` is not a defined method.","cause":"You are attempting to access an attribute or method ('MomentumSum' in this case) that does not exist on the `Particle` object.","error":"AttributeError: 'Particle' object has no attribute 'MomentumSum'"},{"fix":"If you intend to work with multiple particles, ensure you are using methods that return collections (e.g., `Particle.findall()`) or explicitly create a collection. If you are trying to unpack a single particle, ensure the syntax is correct (e.g., `(p,) = Particle.finditer(...)` if only one is expected, or just `p = Particle.from_pdgid(...)` for a single object).","cause":"You are trying to iterate directly over a single `Particle` object where an iterable (like a list or tuple of particles) is expected, for example, in a loop or an unpacking assignment.","error":"TypeError: 'Particle' object is not iterable"},{"fix":"Ensure correct casing and module path. The `PDGID` class is typically imported as `from particle import PDGID`.","cause":"The name 'PDGID' is either misspelled, or it is not directly available for import from the top-level 'particle' package, or the version of the library you are using has changed its import path.","error":"ImportError: cannot import name 'PDGID' from 'particle'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.0.0","cli_name":"particle","cli_version":"sh: 1: particle: not found","type":"library","homepage":null,"github":"https://github.com/scikit-hep/particle","docs":null,"changelog":null,"pypi":"https://pypi.org/project/particle/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}