Skip to content

Conversation

peterfpeterson
Copy link
Member

This is a squashed version of #38448 into ornl-next

This is a squashed version of mantidproject#38448

Create failing test: Abins get_cross_section for Zn65

This isotope currently gives a NaN cross-section. We should ensure
that unsupported isotopes give a noisy error instead.

Implement ValueError for NaN cross-section data

Fix missing return value, test good cases

Begin refactoring Abins isotope handling

- remove "substitution" logic branch
- instead delegate isotope detection and workspace naming to a new class
- in this commit a new Atom is still (unnecessarily) spawned to get cross-section

Continue refactor: streamline _create_workspace

We can now pass on the AtomInfo object rather than its consitituent data.

Continue refactor: move AtomInfo into _fill_s_workspace methods

Simplify get_cross_section from an established AtomInfo

Handle neutron data for atoms where one isotope = mixture

In cases such as F, one isotope is so dominant that essentially we
would always use the properties of the standard mixture. Oddly, in
this case Mantid will not find neutron data if the atomic mass was
provided.

i.e. Atom('F').neutron() works, but Atom('F', 19).neutron() returns a
dict full of NaN, despite them having exactly the same mass.

Update Abins2D to use AtomInfo class

Handle some more Abins isotope challenging cases

Abins input files usually give the element symbol and mass. These
masses often do not match exactly to those in Mantid's data.

- In the case that the nearest isotope has no data, but the "mixture"
  is _quite_ near the target mass (0.01 amu, for now), log a warning and
  use the mixture.

  This helps handle nasty cases like 127I where Mantid has _slightly_
  different masses for the pure isotope and mixture, but essentially
  it is a 100% mixture and there is no neutron-scattering data for the
  isolated isotope.

- If the nearest isotope has no data and the standard mixture is too
  far away, raise an error.

Direct unit test for AtomInfo

Test refactor: move error check closer to source

The error is now raised by the data class when we try to access a
property that uses Atom.

As such it is not really a get_cross_section test any more and can be
moved out.

Add release note

Tweak release note format

Update scripts/abins/abinsalgorithm.py

Co-authored-by: Adri Diaz <146007827+adriazalvarez@users.noreply.github.com>

Move AtomInfo to separate file

Tighten epsilon for "same" mass values, re-use in atominfo

This gets rid of a hard-coded epsilon. Strictly these two comparisons
are not quite doing the same thing, but this precision should be good
for both.
@peterfpeterson peterfpeterson added the ornl-next A copy of a branch into the ornl-next fork label Jan 17, 2025
@peterfpeterson peterfpeterson merged commit c47e4b5 into mantidproject:ornl-next Jan 17, 2025
9 of 10 checks passed
@peterfpeterson peterfpeterson deleted the abins_missing_xs_ornlnext branch January 17, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ornl-next A copy of a branch into the ornl-next fork
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants