Fixed Gaussian2D model when a cov_matrix is input#2199
Conversation
|
@cdeil, since you looked into the rotation issue, do you agree with this? |
|
Here's one way you can show that the current rotation is wrong: |
|
Ok, that looks wrong :) Could you add a regression test? Maybe you could do it with a simple low-res 5-5 array? |
|
@astrofrog I've added the test, updated the change log, and rebased. |
|
I agree this fix is correct to be consistent with the definition in Gaussian2D
It took me a while to convince myself this fix is correct. It could be useful to add in the notes section explaining the relation of the covariance matrix to the formulas given, namely that But ... :-) Should we re-consider the choice of rotation angle direction? |
|
I am in favor of consistently using counter-clockwise rotation (including |
|
I am also in favor of consistently using counter-clockwise rotation. I never liked that it was clockwise. If @astrofrog concurs, then I'll change the rotation. |
|
While we are discussing this, I'd like to bring up one other point. Currently there is a degeneracy in the model such that one can swap |
|
Counter-clockwise makes sense! |
|
OK, I've changed it to counterclockwise rotation. This should be ready to merge. I'll update the |
|
👍 to merge. |
Fixed Gaussian2D model when a cov_matrix is input
|
Any clarifications on the addition of this change to the 0.3.2 milestone? The changelog entry is under 0.4. Also as this constitutes a major change in behavior I would probably leave in as 0.4 anyway. |
This PR fixes the rotation direction of the
Gaussian2Dmodel when acov_matrixis input.thetais calculated fromcov_matrixas the angle of the major-axis eigenvector usingnp.arctan2(), which returns a counterclockwise angle relative to the positivexaxis. However, thethetaused byGaussian2Dis defined in a clockwise direction. This PR corrects the rotation direction.