openmc icon indicating copy to clipboard operation
openmc copied to clipboard

Correction for histogram interpolation of Tabular distributions

Open pshriwise opened this issue 1 year ago • 0 comments

Description

The openmc.stats.Tabular class assumes that the length of the probabilities provided is equal to the length of the table values. This causes errors when one passes N -1 probabilities for N table values in histogram interpolation

image

because we index into the probabilities as [:-1]. This changes that index based on the size of the table values.

Several warnings have also been added in the Tabular.p property setter to check its length against the size of the table values (if they are set).

Checklist

  • [x] I have performed a self-review of my own code ~- [ ] I have run clang-format (version 15) on any C++ source files (if applicable)~
  • [x] I have followed the style guidelines for Python source files (if applicable) ~- [ ] I have made corresponding changes to the documentation (if applicable)~
  • [x] I have added tests that prove my fix is effective or that my feature works (if applicable)

pshriwise avatar Apr 26 '24 21:04 pshriwise