PlasmaPy / PlasmaPy

An open source Python package for plasma research and education
http://docs.plasmapy.org
BSD 3-Clause "New" or "Revised" License
559 stars 335 forks source link

Add `aliases` attribute for `Particle` class #1042

Open namurphy opened 3 years ago

namurphy commented 3 years ago

There are a lot of ways to represent particles in plasmapy.particles. Like...an electron can be "electron", "e-" ,"e", "β-", and so on. Documenting all of the special cases would be difficult and the chance of an omission is rather likely. I was thinking it'd be helpful to have add Particle.aliases as a tuple that would contain the valid aliases for a particular particle.

If we add a way for users to define new particle aliases, akin to #1040, then we'd probably be better off with something mutable like a list.

Doing this might also give us a chance to clean up some of the code that handles particle aliases too.

StanczakDominik commented 3 years ago

Sounds like a lovely idea, decently simple and a good refactor!