PlasmaPy icon indicating copy to clipboard operation
PlasmaPy copied to clipboard

Make `particle` a required keyword to `ParticleTracker.load_particles`?

Open pheuer opened this issue 1 year ago • 3 comments

Feature description

Right now this method assumes that the particles being added are protons, but I wonder if that's really a good default? Maybe that keyword should be required, just to be explicit?

@particle_input
    def load_particles(
        self,
        x,
        v,
        particle: Particle = Particle("p+"), 

Motivation

Avoid anyone accidentally creating particles with the wrong mass/charge

Implementation strategy

No response

Additional context

No response

pheuer avatar Jun 18 '24 13:06 pheuer

I'm in favor of this! Having implicit particle defaults makes silent errors more likely.

Related to: #453.

namurphy avatar Jun 18 '24 19:06 namurphy

Ok sounds good, should I implement this in #2712 ? Or should this get its own PR

JaydenR2305 avatar Jun 21 '24 13:06 JaydenR2305

Ok sounds good, should I implement this in #2712 ? Or should this get its own PR

Maybe make it it's own, small PR, since it is a potential breaking change to the interface.

pheuer avatar Jun 21 '24 13:06 pheuer