### Install Additional Packages Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Installs necessary packages for running the tutorial examples, including numpy, matplotlib, and jupyter. ```bash pip install numpy matplotlib jupyter ``` -------------------------------- ### Install PDG Package Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Installs the 'pdg' package and its dependencies using pip. This command should be run after activating a virtual environment. ```bash python -m pip install pdg ``` -------------------------------- ### Install PDG Package to User Site-Packages Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Installs the 'pdg' package to the user's site-packages directory. Use this if your system Python installation is not marked as externally managed and you prefer not to use a virtual environment. ```bash python -m pip install --user pdg ``` -------------------------------- ### Install PDG Python API Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Installs the PDG Python API package using pip. Ensure you have a Python virtual environment set up and activated. ```bash python -m venv ~/pdg.venv source ~/pdg.venv/bin/activate pip install pdg ``` -------------------------------- ### Example Limit Type Values Source: https://github.com/particledatagroup/api/blob/main/docs/source/schema.md Illustrates the possible values and their corresponding descriptions for the 'LIMIT_TYPE' column in the PDG database. ```text | value | description | |-------|---------------------------------------------| | | NULL means not a limit (i.e. a measurement) | | L | lower Limit | | R | range | | U | upper Limit | | X | range exclusion | ``` -------------------------------- ### Get Quantum Numbers for pi0 Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Access quantum numbers of a particle directly as attributes of the PdgParticle object. This example retrieves quantum numbers for the pi0 particle. ```python p = api.get_particle_by_name('pi0') p.charge, p.quantum_I, p.quantum_G, p.quantum_J, p.quantum_P, p.quantum_C ``` -------------------------------- ### Get Quantum Numbers for pi+ Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Access quantum numbers of a particle directly as attributes of the PdgParticle object. This example retrieves quantum numbers for the pi+ particle. ```python p = api.get_particle_by_name('pi+') p.charge, p.quantum_I, p.quantum_G, p.quantum_J, p.quantum_P, p.quantum_C ``` -------------------------------- ### Import Dependencies and Connect to PDG API Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Imports required libraries and establishes a connection to the default PDG database. This is a prerequisite for running most examples. ```python import pdg import matplotlib.pyplot as plt import numpy as np api = pdg.connect() ``` -------------------------------- ### Create and Activate Python Virtual Environment Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Creates a Python 3 virtual environment named 'pdg.venv' and activates it. This is the recommended way to install the PDG Python API to avoid conflicts with system packages. ```bash python3 -m venv pdg.venv source pdg.venv/bin/activate ``` -------------------------------- ### Get Database Edition Information Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Access the 'edition' property of the API object to get the publication year of the Review of Particle Physics data used. ```python api.edition ``` -------------------------------- ### Get Particle MC ID, Mass, and Spin Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Retrieve and print the Monte Carlo particle number, mass, and spin of the negative pion using its name. ```python import pdg api = pdg.connect() pi_minus = api.get_particle_by_name('pi-') print('MC ID = ', pi_minus.mcid) print('mass = ', pi_minus.mass, 'GeV') print('spin J = ', pi_minus.quantum_J) ``` -------------------------------- ### Getting Branching Fraction Description Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Retrieve the descriptive string for a specific branching fraction, which typically represents the decay channel. ```python decay.description ``` -------------------------------- ### get Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.api.md Retrieves a PdgData object for a given PDG Identifier and optionally a specific edition. ```APIDOC ## get(pdgid: str, edition: str | None = None) ### Description Get PdgData object for given PDG Identifier. ### Parameters * **pdgid** (str) - Required - PDG Identifier to look up. * **edition** (str | None) - Optional - Can be set to a specific edition, from which the data should later be retrieved. ### Returns [PdgData](pdg.data.md#pdg.data.PdgData) - An object of the most appropriate class (based on what the PDG Identifier refers to) derived from the [`PdgData`](pdg.data.md#pdg.data.PdgData) base class. For example, for a PDG Identifier describing a particle, an object of class [`PdgParticleList`](pdg.particle.md#pdg.particle.PdgParticleList) is returned, while for a branching fraction a [`PdgBranchingFraction`](pdg.decay.md#pdg.decay.PdgBranchingFraction) object is returned. ``` -------------------------------- ### Get Metadata Source: https://github.com/particledatagroup/api/blob/main/docs/source/restapi.md Retrieves metadata about the PDG API, including edition, citation, version, and license information. ```APIDOC ## GET /info ### Description Get metadata (edition, citation, version, license) for the PDG API. ### Method GET ### Endpoint /info ### Response #### Success Response (200) - **edition** (string) - The current edition of the PDG data. - **citation** (string) - The recommended citation for the PDG data. - **version** (string) - The version of the API. - **license** (string) - The license under which the data is provided. ``` -------------------------------- ### Retrieve Particles by Name, MCID, and PDGID Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Examples of retrieving particle data using different identifiers: ASCII name, Monte Carlo particle ID (MCID), and PDG Identifier (PDGID). ```python by_name = api.get_particle_by_name('H') ``` ```python by_mcid = api.get_particle_by_mcid(25) ``` ```python by_pdgid = api.get('S126')[0] ``` -------------------------------- ### GET /listings Source: https://github.com/particledatagroup/api/blob/main/docs/source/restapi.md Retrieves data published for a given quantity in the Particle Listings. This includes an annotated list of relevant measurements and information on how PDG arrived at its averages, fits, or best limits. ```APIDOC ## GET /listings ### Description Retrieves data published for a given quantity in the Particle Listings. This includes an annotated list of relevant measurements and information on how PDG arrived at its averages, fits, or best limits. Note that Summary Table information is not included and must be obtained separately via ‘/summaries’. ### Method GET ### Endpoint /listings ### Parameters #### Query Parameters - **pdgid** (String) - Required - PDG Identifier/particle property for which data is returned. ### Response #### Success Response (200) - **pdgid** (String) - PDG Identifier/particle property for which data is returned. - **description** (String) - Plain-ASCII description of the quantity the PDG Identifier refers to. - **note** (String) - Explanatory note in ASCII format, typically shown in the header of the data table. - **parent_pdgid** (String) - Parent PDG Identifier/particle of the returned data. - **parent_description** (String) - Plain-ASCII description of parent PDG Identifier/particle. - **measurements** (Array) - An array of JSON objects, each describing a measurement of the corresponding quantities. - **related_data** (Array) - An array of JSON objects for PDG Identifiers whose data contributes to the corresponding quantity. Each entry contains the JSON that /listings would return for that PDG Identifier. ### Response Example { "pdgid": "example_pdgid", "description": "Example description", "note": "Example note", "parent_pdgid": "example_parent_pdgid", "parent_description": "Example parent description", "measurements": [ { "document_id": "AAD 2023BP", "publication_name": "PRL 131 251802", "publication_year": 2023, "doi": "10.1103/PhysRevLett.131.251802", "inspire_id": "1234567", "title": "Example Publication Title", "technique": "ATLS", "comment": "p p, 13 TeV, gamma gamma, Z Z* -> 4 lepton", "is_changed": true, "measurement_values": [], "footnotes": [] } ], "related_data": [] } ``` -------------------------------- ### Get Summary Data by PDGID and Edition Source: https://github.com/particledatagroup/api/blob/main/docs/source/restapi.md Retrieves summary data for a given PDGID from a specific earlier edition of the PDG data. ```APIDOC ## GET /summaries/PDGID/EDITION ### Description Get summary data for a specified PDG Identifier (PDGID) from an earlier edition. ### Method GET ### Endpoint /summaries/{PDGID}/{EDITION} ### Parameters #### Path Parameters - **PDGID** (string) - Required - The Particle Data Group Identifier for which to retrieve summary data. - **EDITION** (string) - Required - The specific edition of the PDG data (e.g., '2020'). ### Response #### Success Response (200) - The response contains summary data from the specified edition for the given PDGID. Specific fields depend on the PDGID and edition provided. ``` -------------------------------- ### Get Particle Listings Source: https://github.com/particledatagroup/api/blob/main/docs/source/restapi.md Retrieves Particle Listings (measurements) data for a given Particle Data Group Identifier (PDGID). ```APIDOC ## GET /listings/PDGID ### Description Get Particle Listings (i.e., measurements) data for a specified PDG Identifier (PDGID). ### Method GET ### Endpoint /listings/{PDGID} ### Parameters #### Path Parameters - **PDGID** (string) - Required - The Particle Data Group Identifier for which to retrieve listings data. ### Response #### Success Response (200) - The response contains detailed measurement data for the specified PDGID. ``` -------------------------------- ### Plotting Mass vs. Lifetime of D+ Decay Products Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb This example creates a 2D scatter plot of mass versus lifetime for the decay products of the D+ particle. It filters for particles with both mass and lifetime entries and plots them on a logarithmic y-axis. ```python masses, lifetimes = [], [] p = api.get_particle_by_name('D+') for decay in p.exclusive_branching_fractions(): for prod in decay.decay_products: if not prod.item.has_particle: continue if not prod.item.particle.has_mass_entry: continue mass, lifetime = prod.item.particle.mass, prod.item.particle.lifetime if mass and lifetime and (mass not in masses): masses.append(prod.item.particle.mass) lifetimes.append(prod.item.particle.lifetime) plt.scatter(masses, lifetimes) plt.yscale('log') plt.title('$D+$ decay products') plt.xlabel('Mass [GeV]') plt.ylabel('Lifetime [s]'); ``` -------------------------------- ### GET /summaries Source: https://github.com/particledatagroup/api/blob/main/docs/source/restapi.md Retrieves data published for a given quantity in the Summary Tables of the Review of Particle Physics. The response structure varies based on whether the PDG Identifier denotes a single particle property/branching fraction or a particle. ```APIDOC ## GET /summaries ### Description Retrieves data published for a given quantity in the Summary Tables of the *Review of Particle Physics*. The response structure varies based on whether the PDG Identifier denotes a single particle property/branching fraction or a particle. ### Method GET ### Endpoint /summaries ### Parameters #### Query Parameters - **pdgid** (String) - Required - PDG Identifier/particle property or particle for which data is returned. ### Response #### Success Response (200) - **pdgid** (String) - PDG Identifier/particle property or particle for which data is returned. - **description** (String) - Plain-ASCII description of the quantity or particle. - **mode_number** (String) - Only for branching fractions: number of this decay in current edition. - **section** (String) - Only for branching fractions: section, if any, where mode appears. - **pdg_values** (Array) - Array of JSON objects, each describing a summary value. - **summaries** (Array) - For particles: A JSON objects with keys “properties” and/or “branching_fractions”, each containing a list of JSON objects for the PDG Identifier(s) describing particle properties or branching fractions for this particle. Each JSON object describing a summary value may contain the following data: - **value** (Number) - Central value or limit. - **error_positive** (Number) - Positive error or null. - **error_negative** (Number) - Negative error or null. - **value_text** (String) - Plain-text representation of the value with errors or limit. - **unit** (String) - Units. - **scale_factor** (Number) - Error scale factor when applied to errors. - **is_limit** (Boolean) - true if value is a limit, omitted otherwise. - **is_upper_limit** (Boolean) - true if value is an upper limit, omitted otherwise. - **is_lower_limit** (Boolean) - true if value is a lower limit, omitted otherwise. - **confidence_level** (Number) - Confidence level for limits or null. - **type** (String) - Type of data (“OUR FIT” etc) ### Request Example ```json { "pdgid": "e+" } ``` ### Response Example ```json { "pdgid": "e+", "description": "positron", "summaries": { "properties": [ { "value": 0.510998950, "error_positive": 0.000000000, "error_negative": 0.000000000, "value_text": "0.510998950(0)", "unit": "MeV", "scale_factor": 1, "is_limit": false, "type": "PDG" } ] } } ``` ``` -------------------------------- ### Getting Descriptions of Particle Mass Properties Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Iterate through a particle's mass properties and extract their descriptions. This helps in understanding the context of different mass measurements or definitions. ```python [m.description for m in p.masses()] ``` -------------------------------- ### Get Branching Fractions for Charged Pions Source: https://github.com/particledatagroup/api/blob/main/docs/source/schema.md Retrieves a table of branching fractions for charged pions from the PDG SQLite database. Joins 'pdgid' and 'pdgdata' tables, filtering by parent PDG ID, data type, and edition. ```sql SELECT pdgid.pdgid, description, value AS branching_fraction, limit_type, value_type FROM pdgid JOIN pdgdata ON pdgdata.pdgid_id = pdgid.id WHERE pdgid.parent_pdgid = 'S008' AND data_type = 'BFX' AND edition = '2024' ORDER BY pdgid.sort; ``` -------------------------------- ### Connect to PDG Database Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Import the PDG package and connect to the default database. The connect function can optionally take a database URL and a boolean for pedantic mode. ```python import pdg api = pdg.connect() ``` -------------------------------- ### charge Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.particle.md Get the charge of the particle in units of the elementary charge (e). ```APIDOC ## charge ### Description Charge of particle in units of e. ### Returns float: Charge of particle in units of e. ``` -------------------------------- ### Retrieve Top Quark Mass (Default vs. Pedantic) Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Demonstrates the difference in retrieving the top quark mass between default and pedantic modes. Default mode returns a value, while pedantic mode raises an error for ambiguity. ```python pdg.connect().get_particle_by_name('t').mass ``` ```python pdg.connect(pedantic=True).get_particle_by_name('t').mass ``` -------------------------------- ### Get Neutralino Properties Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Fetches and filters properties related to neutralinos from the PDG API. ```python parent = api.get('S046') props = [p for p in parent.get_children() if 'neutralino' in p.description.lower()] ``` ```python props ``` ```python [p.description for p in props] ``` ```python props[0].best_summary() ``` -------------------------------- ### Accessing Pion Decay Products Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Demonstrates how to access basic information about the decay products of a pion, such as its multiplier and item name. ```python pion_decay = api.get('S008.1') pion_decay.description # 'pi+ --> mu+ nu_mu' len(pion_decay.decay_products) # 2 pion_decay.decay_products[0].multiplier # 1 pion_decay.decay_products[0].item.name # 'mu+' pion_decay.decay_products[0].item.particle.mcid # -13 ``` -------------------------------- ### Get Muon g-2 Anomaly Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Fetches the summary for the muon g-2 anomaly using its PDG identifier. ```python api.get('S004MM').best_summary() ``` -------------------------------- ### Inspecting Decay Products Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Access the list of products for a given decay. Each product includes the item, its multiplier, and any subdecay information. ```python products = decay.decay_products products ``` -------------------------------- ### Iterate and Print All PDG Identifiers and Descriptions Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md A complete code snippet that connects to the API, iterates over all PDG Identifiers using get_all(), and prints each identifier along with its description. ```python import pdg api = pdg.connect() for item in api.get_all(): print('%-20s %s' % (item.pdgid, item.description)) ``` -------------------------------- ### Get Summary Data by PDGID Source: https://github.com/particledatagroup/api/blob/main/docs/source/restapi.md Retrieves summary data for a given Particle Data Group Identifier (PDGID). ```APIDOC ## GET /summaries/PDGID ### Description Get summary data for a specified PDG Identifier (PDGID). ### Method GET ### Endpoint /summaries/{PDGID} ### Parameters #### Path Parameters - **PDGID** (string) - Required - The Particle Data Group Identifier for which to retrieve summary data. ### Response #### Success Response (200) - The response contains summary data related to the specified PDGID. Specific fields depend on the PDGID provided. ``` -------------------------------- ### Connect to a Specific SQLite Database Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Connect to a specific SQLite database file by providing its path to the connect function. This is useful when using a custom or downloaded database. ```python api = pdg.connect('sqlite:///pdgall-2023-v0.1.sqlite') ``` -------------------------------- ### Connecting to Historical PDG Database Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Establishes a connection to a local SQLite database file containing historical PDG data. This is necessary for analyzing particle properties across different PDG editions. ```python api_all = pdg.connect("sqlite:///pdgall-2024-v0.1.4.sqlite") ``` -------------------------------- ### Listing Multiple Mass Properties for a Particle Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Fetch a particle by name and list all its associated mass properties. This is useful for particles like the top quark which have multiple mass measurements or definitions. ```python p = api.get_particle_by_name('t') list(p.masses()) ``` -------------------------------- ### Get Masses for pi+ Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Retrieve the mass properties for a given particle. The `masses` method returns an iterator, which can be converted to a list. ```python p = api.get_particle_by_name('pi+') list(p.masses()) ``` -------------------------------- ### Plotting K+ Mass Over Time (PDG Editions) Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Visualizes the historical mass of the K+ particle across different PDG editions. It retrieves the mass and its error for each edition and displays it using an error bar plot. ```python xs, ys, yerrs = [], [], [] for edition in api_all.editions: p = api_all.get_particle_by_name('K+', edition=edition) if p.has_mass_entry and p.mass is not None: xs.append(int(edition)) ys.append(p.mass) yerrs.append(p.mass_error) plt.errorbar(xs, ys, yerrs) plt.xlabel('PDG edition') plt.ylabel('Mass [GeV]') plt.title('$K^+$ mass over time'); ``` -------------------------------- ### pdg.connect Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.md Connects to the PDG database and returns a configured PdgApi object. Allows specifying a custom database URL and enabling pedantic mode. ```APIDOC ## pdg.connect(database_url: str | None = None, pedantic: bool = False) ### Description Connect to PDG database and return configured PDG API object. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method None ### Endpoint None ### Returns A [`PdgApi`](pdg.api.md#pdg.api.PdgApi) object. ### Parameters * **database_url** (str | None) - Optional - SQLAlchemy-style URL of the PDG database. If None, the bundled SQLite file will be used. * **pedantic** (bool) - Optional - Whether to enable the API’s “pedantic” mode. ``` -------------------------------- ### Get Mass Object by Identifier Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Retrieve a specific mass property using its PDG identifier. The returned object is an instance of PdgMass. ```python m = api.get('S008M') m ``` -------------------------------- ### List Top Quark Masses (Standard Mode) Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Retrieves all available mass properties for the top quark in standard API mode. ```python top = api.get_particle_by_name('t') list(top.masses()) ``` ```python top.mass ``` -------------------------------- ### lifetime_error Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.particle.md Get the symmetric error on the particle's lifetime in seconds. Returns None if lifetime error is asymmetric or the lifetime is a limit. ```APIDOC ## lifetime_error ### Description Symmetric error on lifetime of particle in seconds. ### Returns float | None: Lifetime error, or None if lifetime error are asymmetric or lifetime is a limit. ### Raises * **PdgNoDataError** – If there is no best lifetime and the API is in pedantic mode. ``` -------------------------------- ### Get Single Particle by Name Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Retrieves a specific particle ('pi+') by its name. This method returns a PdgParticle object if a unique match is found. ```python api.get_particle_by_name('pi+') ``` -------------------------------- ### Get Particle List by Identifier Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Retrieve a list of particles associated with a PDG identifier. The result is a PdgParticleList, which can be cast to a Python list for easier viewing. ```python plist = api.get('S008/2024') plist ``` -------------------------------- ### Get Multiple Particles by Name Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Retrieves a list of particles ('pi') by their name. This method always returns a list of PdgParticle objects, resolving aliases. ```python api.get_particles_by_name('pi') ``` -------------------------------- ### Connect in Pedantic Mode Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Connect to the database in pedantic mode by setting the 'pedantic' argument to True. This mode raises errors for ambiguous values instead of making assumptions. ```python api = pdg.connect(pedantic=True) ``` -------------------------------- ### inclusive_branching_fractions Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.particle.md Get an iterator over inclusive branching fraction data. This function allows control over including subdecay modes and whether summary data is required. ```APIDOC ## inclusive_branching_fractions ### Description Get iterator over inclusive branching fraction data. ### Parameters * **include_subdecays** (bool) - Optional - Can be set to True (default is False) to also include subdecay modes (i.e. modes shown indented in the Summary Tables). * **require_summary_data** (bool) - Optional - Can be set to False to include branching fractions where the current edition has no summary value(s) in the Particle Listings or Summary Table. ### Returns Iterator over PdgBranchingFraction objects. ``` -------------------------------- ### info Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.api.md Retrieves metadata information for a given key. A list of available keys can be obtained using `info_keys()`. ```APIDOC ## info(key: str) -> str ### Description Get metadata info specified by key. ### Parameters #### Path Parameters * **key** (str) - Required - Metadata key to look up. A list of keys can be obtained using `info_keys()`. ### Returns * **str** - Metadata info. ``` -------------------------------- ### PdgProperty.display_value_text Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.data.md Provides a shortcut to access the display text of the 'best' summary value, formatted for presentation. ```APIDOC ## display_value_text: str ### Description Shortcut for best_summary().display_value_text. ### Returns * str - The display text of the best summary value. ``` -------------------------------- ### exclusive_branching_fractions Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.particle.md Get an iterator over exclusive branching fraction data. This function allows control over including subdecay modes and whether summary data is required. ```APIDOC ## exclusive_branching_fractions ### Description Get iterator over exclusive branching fraction data. ### Parameters * **include_subdecays** (bool) - Optional - Can be set to True (default is False) to also include subdecay modes (i.e. modes shown indented in the Summary Tables). * **require_summary_data** (bool) - Optional - Can be set to False to include branching fractions where the current edition has no summary value(s) in the Particle Listings or Summary Table. ### Returns Iterator over PdgBranchingFraction objects. ``` -------------------------------- ### cp_charge Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.particle.md Get the charge of the nominal "particle" (as opposed to "antiparticle") for this species. This is useful for distinguishing particle and antiparticle pairs. ```APIDOC ## cp_charge ### Description The charge of the nominal “particle” (as opposed to “antiparticle”) for this species. E.g., for the proton and antiproton, this is 1. Useful for distinguishing e.g. the \(\Sigma_b^+\) (and \(\bar\Sigma_b^-\)) from the \(\Sigma_b^-\) (and \(\bar\Sigma_b^+\)). ### Returns int: The charge of the nominal particle. ``` -------------------------------- ### get_all Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.api.md Returns an iterator over all PDG Identifiers and quantities, optionally filtered by data type key and edition. ```APIDOC ## get_all(data_type_key=None, edition=None) ### Description Get iterator over all PDG Identifiers / quantities. ### Parameters * **data_type_key** (any) - Optional - If set, only quantities of the given type are returned. See [`doc_data_type_keys()`](#pdg.api.PdgApi.doc_data_type_keys) for the list of possible data type codes. * **edition** (any) - Optional - Can be set to a specific edition, from which data should later be retrieved. ### Returns Iterator[[PdgData](pdg.data.md#pdg.data.PdgData)] - Iterator over objects of class [`PdgProperty`](pdg.data.md#pdg.data.PdgProperty) or derived classes. ``` -------------------------------- ### info_keys Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.api.md Retrieves a list of all available metadata keys. ```APIDOC ## info_keys() -> list[str] ### Description Get list of all metadata keys. ### Returns * **list[str]** - List of keys, each of which can be passed to `info()`. ``` -------------------------------- ### Accessing an Exclusive Branching Fraction Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Get the first exclusive branching fraction from a particle's decay modes. This allows inspection of a specific decay channel. ```python decay = next(p.exclusive_branching_fractions()) decay ``` -------------------------------- ### Get Encoded Value and Units Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Access the encoded numerical value and its units from a summary value object. The `get_value` method allows conversion to specified units. ```python v = m.summary_values()[0] v.value, v.units, v.get_value('GeV') ``` -------------------------------- ### Print B0 Decays to J/psi Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Lists all observed B0 decays that result in a J/psi particle. The output includes branching fractions. ```text Output: B0 --> J/psi(1S) K0 (8.91+-0.21)E-4 B0 --> J/psi(1S) K+ pi- (1.15+-0.05)E-3 B0 --> J/psi(1S) eta K0S (5.4+-0.9)E-5 B0 --> J/psi(1S) eta^' K0S <2.5E-5 B0 --> J/psi(1S) phi K0 (4.9+-1.0)E-5 B0 --> J/psi(1S) omega K0 (2.3+-0.4)E-4 B0 --> J/psi(1S) K(1270)0 (1.3+-0.5)E-3 B0 --> J/psi(1S) pi0 (1.66+-0.10)E-5 B0 --> J/psi(1S) eta (1.08+-0.23)E-5 B0 --> J/psi(1S) pi+ pi- (3.99+-0.15)E-5 B0 --> J/psi rho(1700)0 , rho()0 --> pi+ pi- (2.0+-1.3)E-6 B0 --> J/psi(1S) omega (1.8+0.7-0.5)E-5 B0 --> J/psi(1S) K+ K- (2.53+-0.35)E-6 B0 --> J/psi(1S) phi <1.1E-7 B0 --> J/psi(1S) eta^'(958) (7.6+-2.4)E-6 B0 --> J/psi(1S) K0 pi+ pi- (4.5+-0.4)E-4 B0 --> J/psi(1S) K0 K+ K- (2.5+-0.7)E-5 B0 --> J/psi(1S) K^*(892)+ pi- (8+-4)E-4 B0 --> J/psi(1S) pi+ pi- pi+ pi- (1.44+-0.12)E-5 B0 --> J/psi(1S) K^*(892)0 pi+ pi- (6.6+-2.2)E-4 B0 --> T_c_cbar_1(4430)+- K-+ , T_c_cbar_1()+- --> J/psi pi+- (5.4+4.0-1.2)E-6 B0 --> T_c_cbar_1(3900)+- K-+ , T_c_cbar_1()+- --> J/psi pi+- <9E-7 B0 --> T_c_cbar_1(4200)+- K-+ , T_c_cbar_1()+- --> J/psi pi+- (2.2+1.3-0.8)E-5 B0 --> J/psi(1S) p pbar (4.5+-0.6)E-7 B0 --> J/psi(1S) gamma <1.5E-6 B0 --> J/psi mu+ mu- , J/psi --> mu+ mu- <1.0E-9 B0 --> J/psi mu+ mu- , J/psi --> mu+ mu- <1.0E-9 B0 --> J/psi(1S) Dbar0 <1.3E-5 B0 --> psi(4230)0 K0 , psi0 --> J/psi pi+ pi- <1.7E-5 ``` -------------------------------- ### Get Summary Values for Mass Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Access summary values for a mass property. The `summary_values` method returns a list of objects containing detailed information about the mass. ```python m.summary_values() ``` -------------------------------- ### Print PDG API Information Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Prints the details of the connected PDG API instance, including the data release version and API version. This helps verify the connection and data source. ```python print(api) ``` -------------------------------- ### Access Top Quark Mass (Pedantic Mode) Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Demonstrates handling ambiguous mass values for the top quark in pedantic API mode, requiring explicit selection. ```python api_pedantic = pdg.connect(pedantic=True) try: api_pedantic.get_particle_by_name('t').mass except Exception as e: print(type(e), e) ``` ```python api_pedantic.get('Q007TP').best_summary().get_value('GeV') ``` -------------------------------- ### PdgProperty.value_text Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.data.md Provides a shortcut to access the text representation of the 'best' summary value. ```APIDOC ## value_text: str ### Description Shortcut for best_summary().value_text. ### Returns * str - The text representation of the best summary value. ``` -------------------------------- ### branching_fractions Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.particle.md Get an iterator over specified types of branching fraction data. This function allows filtering by data type key and whether to include summary data. ```APIDOC ## branching_fractions ### Description Get iterator over given type(s) of branching fraction data. ### Parameters * **data_type_key** (str) - Optional - Can be set to e.g. ‘BFX2’ to select only those exclusive branching fractions that are two levels deep in the subdecay hierarchy. With a data_type_key of ‘BF%’ (the default), all branching fractions, including subdecay modes, are returned. * **require_summary_data** (bool) - Optional - Can be set False to include branching fractions where the current edition has no summary value(s) in the Particle Listings or Summary Table. ### Returns Iterator over PdgBranchingFraction objects. ``` -------------------------------- ### Get Error Information Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Access error information for a summary value, including absolute and relative errors. The `get_error` method allows conversion of the error to specified units. ```python v.error, v.error_positive, v.error_negative, v.get_error('GeV') ``` -------------------------------- ### Retrieving Summary Values for a Branching Fraction Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Fetch the detailed summary values associated with a branching fraction, including its ID, value, errors, and display text. ```python decay.summary_values() ``` -------------------------------- ### Get Lifetimes for pi+ Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Retrieve the lifetime properties for a given particle. The `lifetimes` method returns an iterator, which can be converted to a list. A particle may have width or lifetime properties, but not both. ```python list(p.lifetimes()) ``` -------------------------------- ### Query Limit Type Descriptions Source: https://github.com/particledatagroup/api/blob/main/docs/source/schema.md Fetches descriptions for different limit types from the 'pdgdoc' table, useful for interpreting the 'limit_type' column in other queries. ```sql SELECT value, description FROM pdgdoc WHERE table_name = 'PDGDATA' AND column_name = 'LIMIT_TYPE'; ``` -------------------------------- ### Get Widths for pi+ Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Retrieve the width properties for a given particle. The `widths` method returns an iterator, which can be converted to a list. A particle may have width or lifetime properties, but not both. ```python list(p.widths()) ``` -------------------------------- ### PdgProperty.units Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.data.md Provides a shortcut to access the units of the 'best' summary value. ```APIDOC ## units: str ### Description Shortcut for best_summary().units. ### Returns * str - The units of the best summary value. ``` -------------------------------- ### Get Names of Charged Pions using PDGID Source: https://github.com/particledatagroup/api/blob/main/docs/source/pythonapi.md Iterate over a PdgParticleList obtained using a PDGID ('S008') to retrieve the names of all associated particle charge states, such as 'pi+' and 'pi-'. ```python [p.name for p in api.get('S008')] ``` -------------------------------- ### Listing Inclusive Branching Fractions Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Retrieve only the inclusive branching fractions for a particle. For some particles, this list might be empty if all decays are specified exclusively. ```python list(p.inclusive_branching_fractions()) ``` -------------------------------- ### Get Particle by MCID Source: https://github.com/particledatagroup/api/blob/main/examples/tutorial.ipynb Retrieves a specific particle ('p') using its Monte Carlo ID (2212). This method returns a PdgParticle object directly due to the unambiguous nature of MCIDs. ```python api.get_particle_by_mcid(2212) ``` -------------------------------- ### PdgProperty.value Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.data.md Provides a shortcut to access the numerical value of the 'best' summary value. ```APIDOC ## value: float ### Description Shortcut for best_summary().value. ### Returns * float - The numerical value of the best summary value. ``` -------------------------------- ### PdgDecayProduct Source: https://github.com/particledatagroup/api/blob/main/docs/source/pdg.decay.md Represents information about one product of a decay. The constructor is intended for internal API use. ```APIDOC ## Class: pdg.decay.PdgDecayProduct ### Description Class for all information about one product of a decay. This information includes the decay product’s `PdgItem` (which may resolve to one or more `pdg.particle.PdgParticle` objects), its multiplier, and its subdecay (if any). ### Parameters * **item** (`PdgItem`) - Corresponding `PdgItem`. * **multiplier** (int) - Multiplicity of this product in the decay. * **subdecay** (`PdgBranchingFraction` | None, optional) - Optional description of this product’s further decay. ```