-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MRG, MAINT: Refactor and unify matched-point fitting #7325
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
Conversation
| mu_p = mean(p, axis=0) # eq 23 | ||
| mu_x = mean(x, axis=0) | ||
| Sigma_px = np.dot(p.T, x) / p.shape[0] - np.outer(mu_p, mu_x) # eq 24 | ||
| # (weighted) centroids |
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.
Maybe you can use np.average and the accepts weights ?
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.
This is in jit-ed code, and Numba does not support it. So not worth the speed loss :)
Codecov Report
@@ Coverage Diff @@
## master #7325 +/- ##
=========================================
Coverage ? 89.71%
=========================================
Files ? 450
Lines ? 81353
Branches ? 12932
=========================================
Hits ? 72983
Misses ? 5519
Partials ? 2851 |
|
Still some |
|
Okay this one should be ready to go |
|
Travis failure is just a timeout due to non-BLAS NumPy prerelease wheels |
|
Thx @larsoner |
* MAINT: Refactor and unify matched-point fitting * FIX: Casts * FIX: Try again * ENH: Speed up 3D test a tiny bit * FIX: Verbose * DOC: Fix comment [ci skip] * MAINT: From transforms
* MAINT: Refactor and unify matched-point fitting * FIX: Casts * FIX: Try again * ENH: Speed up 3D test a tiny bit * FIX: Verbose * DOC: Fix comment [ci skip] * MAINT: From transforms
When implementing the cHPI changes, I noticed some places that our use of matched-point fitting could be improved. Specifically:
mne coreguses matched point fitting in ICP. This now routes the code to use the analytical solution when possible._quat_to_eulerand_euler_to_quatfrom standard formulas.mne coregcaused me to look back at the ICP ref, then the original ref for the analytical transform, and realize that 1) it can include weights, and 2) it can compute a uniform scale factor, too. So I implemented those, which expanded the use cases formne coreg.mne.io.ctfcomputed some transforms using its own matched point code, and also its own RAS-to-head. These now use transforms frommne.transformsinstead.So there ended up being more + than - in this PR, but we removed more functional code than we added -- a lot of the +` comefrom new tests.