-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Fixed test_centerline crashing due to bump in Python library #2754
Conversation
Cannot reproduce failed test on a456fa5 on an Ubuntu 16.04 (bireli). Note: Python's libraries installed are the same (visual comparison from sct_check_dependencies) Cannot reproduce on Docker 18.04 (all tests pass). |
This issue is likely related to #2686. Instead of relaxing (again) the threshold, maybe the proper approach would be to remove the tests where fitting is badly conditioned (ie very few points). Currently the Travis tests fail for these cases:
The following warning suggests this is indeed an issue:
|
Series of investigations on my OSX laptop: Trying to replace
When replacing generation of dummy_centerline
When using Polynomial also in
|
Given the extrapolation issue caused by polynomial fitting, it would probably be wise to replace a poly fit by a bspline fit for the ground-truth centerline. However, we should keep the suggested Polynomial.fit() |
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 great to me and investigations make sense.
Tests all green on my local machine.
Is there anything in particular you would like me to test / look at? Otherwise it looks ready to be merged!
@@ -116,7 +116,7 @@ def get_parser(): | |||
metavar=Metavar.float, | |||
type=float, | |||
help='Size of the output FOV in the RL/AP plane, in mm. The resolution of the destination ' | |||
'image is the same as that of the source image (-i).', | |||
'image is the same as that of the source image (-i). Default: 35.', |
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.
Would it be relevant to display the default value by default in order to reduce maintenance etc?
eg https://stackoverflow.com/a/12151325/13306686
If so, I will open a new issue
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.
Yes that would be awesome!
p = poly1d(polyfit(x, y, deg=deg)) | ||
p = np.polynomial.Polynomial.fit(x, y, deg) |
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.
There is actually specified in np.polyfit documentation:
The Polynomial.fit class method is recommended for new code as it is more stable numerically.
Makes sense :-)
…ordtoolbox#2754) * Removed nurbs dummy centerline (was not used) * Changed output formatting for results * Changed ().I for np.linalg.pinv to address Singular mat error * Display default parameters * Replaced polyfit by Polynomial.fit * Improved clarity of saved files for debugging * Excluded irrelevant or buggy tests * Replaced polyfit by bspline in dummy centerline creation
Since recently,
test_get_centerline
is failing on Travis. This is probably related to an upgrade of a Python library and/or platform-dependent (as noted in #2686)This PR:
numpy.polyfit
bynumpy.polynomial.Polynomial
as per numpy's doc, incenterline.curve_fitting.polyfit_1d()
Fixes #2753