Conversation
aca8216 to
7e4c606
Compare
|
Depends on #615 |
src/scippneutron/atoms/__init__.py
Outdated
| "This likely means that there is no standard atomic weight " | ||
| "for this element." | ||
| ) | ||
| return self._atomic_weight |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Not sure. Another alternative might be to make the variables read-only, but I think that mechanism does not have Python bindings.
There was a problem hiding this comment.
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') |
| @@ -0,0 +1,238 @@ | |||
| { | |||
There was a problem hiding this comment.
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?
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.