8000 Add atomic weights and masses by jl-wynen · Pull Request #613 · scipp/scippneutron · GitHub
[go: up one dir, main page]

Skip to content

Add atomic weights and masses#613

Merged
jl-wynen merged 7 commits intomainfrom
atomic-weights
Mar 24, 2025
Merged

Add atomic weights and masses#613
jl-wynen merged 7 commits intomainfrom
atomic-weights

Conversation

@jl-wynen
Copy link
Member

Fixes #612

The exact choice of which value to use is complicated. But for most applications, going with the standard atomic weight should be fine.

@jl-wynen jl-wynen changed the base branch from main to fix-submodules-import March 24, 2025 09:03
@jl-wynen
Copy link
Member Author

Depends on #615

Base automatically changed from fix-submodules-import to main March 24, 2025 09:24
@github-project-automation github-project-automation bot moved this to In progress in Development Board Mar 24, 2025
@jl-wynen jl-wynen moved this from In progress to Selected in Development Board Mar 24, 2025
"This likely means that there is no standard atomic weight "
"for this element."
)
return self._atomic_weight
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we worried that the caller might modify this in-place, for subtle errors? Should we return a copy?

I think we have a similar in the scipp physical constants.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the risk is low. But I added a copy.

We have the same problem with ScatteringParams. Should I add properties for all fields that return a copy?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. Another alternative might be to make the variables read-only, but I think that mechanism does not have Python bindings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Event if it was available in Python, people could still set the values directly.

with _open_bundled_parameters_file('atomic_weights.csv') as f:
if line_remainder := _find_line_with_isotope(element, f):
z, weight, error = line_remainder.rstrip().split(',')
return int(z), _assemble_scalar(weight, error, 'Da')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is Da?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dalton it's the weight relative to 12C.

@@ -0,0 +1,238 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No one might remember this notebooks exists. Can we add a reference to it in the code or the csv files, so future devs who try updating the tables can find it?

@jl-wynen jl-wynen merged commit cf03e1e into main Mar 24, 2025
5 checks passed
@jl-wynen jl-wynen deleted the atomic-weights branch March 24, 2025 15:06
@github-project-automation github-project-automation bot moved this from Selected to Done in Development Board Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Consider adding atomic masses

2 participants

0