Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First item of periodictable.elements generator is "n"? #45

Closed
jdagdelen opened this issue Jul 12, 2021 · 2 comments
Closed

First item of periodictable.elements generator is "n"? #45

jdagdelen opened this issue Jul 12, 2021 · 2 comments

Comments

@jdagdelen
Copy link

jdagdelen commented Jul 12, 2021

Wondering if this is a bug or intentional. Neutrons aren't necessarily elements.

version: 1.6.0

To reproduce:

import periodictable as pt
[e for e in pt.elements][0]
@pkienzle
Copy link
Collaborator

Yes, intentional.

I probably added it because the neutron scattering tables I am using have an entry for the cross section of a bare neutron. I can't imagine anyone is using it for anything, but no guarantees.

Here's a work-around:

for el in list(pt.elements)[1:]:
   ... # process el

With a small tweak to pt.core.PeriodicTable.__getitem__, we could support:

for el in pt.elements[1:]:
    ... # process el

My inclination is to leave it in place.

A number of files need to be updated should we decide to remove it:

  • pt.core.element_base
  • pt.mass.init()
  • pt.density.element_densities
  • pt.crystal_structure.crystal_structures
  • pt.nsf.nsftable

The scattering cross sections and half life should be made available somewhere, such as pt.constants.

It may also show up in docs and tests.

@pkienzle
Copy link
Collaborator

Changing this would be backwards incompatible. Save it for a breaking release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants