update random method to gaussian form. #549
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the change
replaces the
while
loop approach currently used inorix.base.random
with the more common gaussian sampling used elsewhere.functionally identical, but (as shown in #218), is 3 to 5 times faster and removes a `while' loop
Progress of the PR
NOTE: While this DOES test every line, I did not write a unit test to prove random variables are uniformly random, as (to my knowledge) such a test does not exist.
I could potentially:
A) calculate the first few spherical harmonics for 10,000 random rotations and vectors, and show the unimodal term dominates
B) calculate the angular distances with
dot_outer
for groups of random objects and show the distributions match (ie, everything is equally far from everything else)However, I tried both and both are slow (a few seconds each) adding to the already considerable testing time, and I'm not sure they protect against anything.
Minimal example of the bug fix or new feature
For reviewers
__init__.py
.section in
CHANGELOG.rst
.__credits__
inorix/__init__.py
and in.zenodo.json
.