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

Prevent std::normal_distribution being called with sigma=0.0 #1486

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

robbietuk
Copy link
Collaborator

@robbietuk robbietuk commented Jul 31, 2024

Changes in this pull request

Add a guard to DetectorCoordinateMap to prevent std::normal_distribution<double>(0.0, 0.0) being called.

Testing performed

Built STIR in debug on windows machine and build project using STIR in debug. Fixes assert 0.0 < sigma issue observed in #1485.

Related issues

Fixes #1485

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have added docstrings/doxygen in line with the guidance in the developer guide
  • [] I have implemented unit tests that cover any new or modified functionality (if applicable)
  • The code builds and runs on my machine
  • [] documentation/release_XXX.md has been updated with any functionality change (if applicable)

@robbietuk robbietuk self-assigned this Jul 31, 2024
@robbietuk robbietuk added the bug label Jul 31, 2024
@robbietuk robbietuk changed the title Prevent std::normal_distribution being called with sigma=0.0 Prevent std::normal_distribution being called with sigma=0.0 Jul 31, 2024
Copy link
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

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

I cannot check from here if the actual calls check first if sigma is zero.

@markus-jehl can you please review?

@robbietuk
Copy link
Collaborator Author

The get_coordinate_for_det_pos() method does but this assert error/fix is in the constructor.

@markus-jehl
Copy link
Contributor

This looks good to me! Makes no sense creating the distributions and generators if they are not needed.

@KrisThielemans KrisThielemans merged commit ca5ad8f into UCL:master Aug 6, 2024
9 checks passed
@robbietuk robbietuk deleted the FixSigma0Issue branch August 23, 2024 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debug assert error caused by normal distribution sigma equals 0.0 - MSVC 14.40
3 participants