Git Product home page Git Product logo

Comments (7)

namurphy avatar namurphy commented on May 23, 2024

Here are some antimatter matters with inconsistent or undesirable behavior:

>>> charge_state('p-')
-1
>>> charge_state('e+')
ValueError: Invalid element or isotope information in charge_state
>>> charge_state('positron')
ValueError: Invalid element or isotope information in charge_state
>>> charge_state('antiproton')
ValueError: Invalid element or isotope information in charge_state

from plasmapy.

namurphy avatar namurphy commented on May 23, 2024

We may want charge_state to allow electrons, even though it was intended for ions.

>>> charge_state('electron')
ValueError: Invalid element or isotope information in charge_state
>>> charge_state('e-')
ValueError: Invalid element or isotope information in charge_state

from plasmapy.

namurphy avatar namurphy commented on May 23, 2024

Some more thoughts while I'm talking to myself: 😸 💬

  • It would probably helpful to have a function called charge that would give the physical value of the charge for various particles. This would be easy to add.
  • I'm wondering if it would be worth considering particles like muons, pions, etc. These do not come up that often for most plasma physicists, but may come up if people are studying cosmic rays and things like that and would also be straightforward to add.
  • There are still lots of half-lives for different isotopes that are missing.

from plasmapy.

StanczakDominik avatar StanczakDominik commented on May 23, 2024

It would be pretty handy to have charge_state and even ion_mass to allow electrons and perhaps more exotic particles - as it stands with Species in #54 , I would like to permit initializing those with a string and avoid having special cases for electrons. This seems like a better place for that.

A charge function seems trivial to pull off, as most of the exceptions are already in charge_state (did anybody say, low hanging fruit? 😃 )

Oh yeah, one more thing: I think we could do some automated testing here using pytest fixtures, given that all the data is already really neatly placed into python data structures.

from plasmapy.

namurphy avatar namurphy commented on May 23, 2024

One more bug:

>>> plasmapy.constants.ion_mass('He-3 2+')
<Quantity 6.64465723e-27 kg>
>>> plasmapy.constants.ion_mass('He-4 2+')
<Quantity 6.64465723e-27 kg>

'He-3 2+' is giving the wrong mass, since it's interpreting it as an alpha particle.

from plasmapy.

namurphy avatar namurphy commented on May 23, 2024

Of the bugs I mentioned, I believe all have been fixed except for this one:

>>> charge_state('H-1-')

from plasmapy.

namurphy avatar namurphy commented on May 23, 2024

This was resolved in: #122

The original title of this issue (to allow ions to be represented as a tuple) did not get implemented since something like ('H', 1) would leave it ambiguous about whether the 1 meant the charge state or the isotope. The Species class is an improvement over this idea.

from plasmapy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.