pdg.utils module

Utilities for PDG API.


Return normalized base part of PDG Identifier.

pdg.utils.best(properties, pedantic=False, quantity=None, is_generic=False)[source]

Return the “best” property from an iterable of properties, or raise an exception.

best does (pedantic=False) or does not (pedantic=True) make assumptions about what the best property might be in cases where the choice may be ambiguous. In the latter case, a PdgAmbiguous exception is raised while in the former case the best property is determined based on data flags and position in the Summary Tables. PdgNoDataError will be raised if there is no property that qualifies as best one.

quantity is an optional string that in case of an exception will describe the property being sought.

pdg.utils.make_id(baseid, edition=None)[source]

Return normalized full PDG Identifier, possibly including edition.


Parse PDG Identifier and return (normalized base identifier, edition).

pdg.utils.pdg_round(value, error)[source]

Return (value, error) as numbers rounded following PDG rounding rules.