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

Bugfix/wigner6j integer sum #148

Merged

Conversation

petermao
Copy link
Collaborator

Integer sum check in Wigner-6j code was not catching non-integer sums.

1b9eb26:

  1. fix logic
  2. add messaging to detail problematic inputs
  3. provide two options for error messages

5a5b1d8: add similar messaging to triangularity test
b77b250: bypass errors by returning sensible values when tests fail (I acknowledge that the nan could be controversial)

petermao added 3 commits May 10, 2023 08:39
In addition, I added some code to detail which triads were failing the test.
The text is added to the `msg` string with a single call to print if any of the
tests fail.

It would be nice to have some global verbosity flag to allow the user to turn
on/off the message.

Finally, I offer two error messages (coincidentally) of the same length.
No problems with the logic in the triangularity test.  This commit just adds
messaging in the same vein as the integer check.
return 0 for a 6j that violates triagularity

return nan for a 6j with non-integer traid sum(s)
@petermao petermao requested a review from nikolasibalic May 10, 2023 15:51
For consistency with prior code, suppress feedback on 6j triangularity and
integer sum rule violations unless explicitly requested.
@nikolasibalic
Copy link
Owner

Hi @petermao thank you for your efforts on this update!

Is there anything you want to add on this?

From my side, we should just remove unreachable code (that raises error now after return 0), and we can merge to main.

print(msg)
return np.nan
raise ValueError("6j-Symbol is undefined when any triad has a non-integer sum")
raise ValueError("6j-Symbol is defined only when all triads have integer sums")
Copy link
Owner

Choose a reason for hiding this comment

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

Let's remove unreachable code here (two raise statements after return)

Copy link
Owner

Choose a reason for hiding this comment

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

I will fix this in main after merging, before releasing new version.

@nikolasibalic nikolasibalic marked this pull request as ready for review September 30, 2023 21:42
@nikolasibalic nikolasibalic merged commit d1341a9 into nikolasibalic:master Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants