-
Notifications
You must be signed in to change notification settings - Fork 33
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
Random uniform distribution deflected as rotation with tests #713
Random uniform distribution deflected as rotation with tests #713
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for the changes! Great to see that you also added a plume version. I need to look a bit more into some of the code, but here are already some comments.
- I think it would make sense to move the
matrix_multiply
function to a utilities functionmultiply_3x3_matrices
or something similar. - Add a unit test for the matrix multiply function to make sure that it works as expected.
This looks great, thanks! |
I've moved the matrix_multiply functions in grain model features into utilities and made a unit test for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few more comments. Also can you fix the unit tests? You just need to add a few more approx.
Then we can see how the coverage is doing.
const double feature_max_depth) const override final; | ||
|
||
private: | ||
// uniform grains submodule parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// uniform grains submodule parameters |
|
||
// Then U' = R * U * R^T | ||
std::array<std::array<double,3>,3> result1 = Utilities::multiply_3x3_matrices(rotation_matrices, basis_rotation_matrices[i]); | ||
// std::array<std::array<double,3>,3> rotated_rotation_matrix = matrix_multiply(result1, rot_T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this line go?
} | ||
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Five new lines seems a bit excessive to me.
|
||
// Then U' = R * U * R^T | ||
std::array<std::array<double,3>,3> result1 = multiply_3x3_matrices(rotation_matrices, basis_rotation_matrices[i]); | ||
// std::array<std::array<double,3>,3> rotated_rotation_matrix = multiply_3x3_matrices(result1, rot_T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
|
||
// Then U' = R * U * R^T | ||
std::array<std::array<double,3>,3> result1 = multiply_3x3_matrices(rotation_matrices, basis_rotation_matrices[i]); | ||
// std::array<std::array<double,3>,3> rotated_rotation_matrix = multiply_3x3_matrices(result1, rot_T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this and a few other similar comments and empty lines. I also added approx to all unit test checks.
Some testers fail because |
I've changed std::transform to for loops. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! It looks good to me now. Please squash the commits as discussed and then it should be ready to merge.
Fix indentation
5659647
to
1aa6e0b
Compare
1aa6e0b
to
fed9ae7
Compare
Fix indentation
fed9ae7
to
8319b98
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #713 +/- ##
==========================================
+ Coverage 98.17% 98.27% +0.10%
==========================================
Files 107 108 +1
Lines 7463 7666 +203
==========================================
+ Hits 7327 7534 +207
+ Misses 136 132 -4
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Based on the coverage results, it looks like there is no test for |
The tests I added are called "random_uniform_distribution_deflected_asrotation_seed1.wb" and "random_uniform_distribution_deflected_asrotation_seed1000.wb". Is this the reason that the tests are not detected? |
The tests are run, see https://github.com/GeodynamicWorldBuilder/WorldBuilder/actions/runs/9373443402/job/25807253224?pr=713, but they do not cover the that part of the code. I also just noticed that some comments have not been addressed, can you take another look at them? |
Remove unnessary comments and lines
dc5f50b
to
b044567
Compare
I might have messed up the commits with squash. I've fixed the plume test and addressed the comments above now. |
I've added tests to use rotation matrices for initial textures to improve the coverage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks for also fixing the coverage! One more thing, can you add a changelog entry in Changelog.md?
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Generated= random uniform distribution with a deflection as rotations and apply these rotations to an input orientation represented with Euler angle or rotation matrix. This grain model is added for all features.
I also removed the old tests for this grain model random_uniform_distribution_deflected using two different random number seed and added new tests.
Some sample generated textures (plotted using MTEX in Matlab):
Input Euler angle (0,0,0), deflection=0.001
Input Euler angle (0,0,0), deflection=1
Input Euler angle (0,90,0), deflection=0.001
Input Euler angle (90,90,0), deflection=0.001