When used as a type hint annotation,
ParticleLikeindicates that an argument should represent a physical particle. Particle-like objects can include strings, integers, or instances of the
Real world particles are typically represented as instances of the
Particleclass in PlasmaPy.
>>> from plasmapy.particles import Particle >>> Particle("proton") Particle("p+")
An element may also be represented by a string that contains the atomic symbol (case-sensitive) or the name of the element, or an integer representing the atomic number. The element iron can be represented as
An isotope may be represented by a string that contains an atomic symbol or element name, followed by a hyphen and the mass number (with no spaces in between). The isotope 56Fe can be represented as
Particle("Fe-56"). 1H can be represented by
"protium", 2H can be represented by
"deuterium", and 3H can be represented by
An ion or ionic level may be represented by a string that contains a representation of an element or isotope, followed by charge information. For example,
"helium 1+", and
"He II"all represent singly ionized helium.
Charge information is typically separated from the element or isotope by a space, and given as an integer paired with a plus or minus sign. The sign can either precede or follow the integer (e.g.,
"Fe +0"). The charge information can also be given as a series of plus signs or of minus signs that immediately follow the element or isotope (e.g.,
Ions can also be represented using Roman numeral notation, where the Roman numeral indicates the integer charge plus one (e.g.,
"H I"represents H0+ and
"He-4 II"represents 4He1+).
D1+ can also be represented by
"deuteron", T1+ can be represented by
"triton", and 4He2+ can be represented by
A special particle may be represented by a string that contains the name of the particle (case-insensitive) or a standard symbol for it (case-sensitive). A neutron can be represented as
"neutron"; a proton can be represented as
"Proton"; and an electron can be represented by
CustomParticleinstances are particle-like because particle properties are provided in physical units.
DimensionlessParticleinstances are not particle-like because, without normalization information, they do not uniquely identify a physical particle.
ParticleLikeas a type hint annotation indicates that an argument or variable should represent a physical particle.
>>> from plasmapy.particles import ParticleLike, Particle >>> def is_electron(particle: ParticleLike): ... return particle == Particle("e-")
alias of Union[str, numbers.Integral, plasmapy.particles.particle_class.Particle, plasmapy.particles.particle_class.CustomParticle]