Create a ParticleCollection
class
#948
Labels
feature request
Issues requesting a new feature or enhancement
plasmapy.particles
Related to the plasmapy.particles subpackage
Milestone
The
Particle
class currently provides a means of representing a single particle, and we also haveCustomParticle
andDimensionlessParticle
. It would be helpful to have aParticleCollection
class that we could use to represent multiple particles together. That class could have attributes likemass
that would return an array with units of mass so that we can do array operations and the like...and the same for other properties likecharge
too.Here's a use case that came from a discussion on Element. Suppose we want to find the thermal velocities of all of the ions in a multi-component plasma. If we have a
ParticleCollection
class, we could do something like:If we make it iterable then we could also do things like:
This class shouldn't include transitory properties like temperature, since that's not what the
Particle
class does. That should be in a different class...perhaps something likeMultiComponentPlasma
and/or we could have something likeSpecies
that keeps track of the plasma parameters for a single species in a plasma...but that is not for this issue.Probably the best way to approach this class would be to split up development into multiple pull requests. The first could create a prototype of the class, the next could add
__iter__
and__next__
to make it iterable, and so on. That'd make code review more manageable.The text was updated successfully, but these errors were encountered: