-
Notifications
You must be signed in to change notification settings - Fork 10
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
Improve linear splining #653
Conversation
Closes #607 |
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.
Some probably not very well formed thoughts.
I've made a note to ensure I rebase for the branch I'm working on the pruning on.
Apologies I've not gotten around to looking at this but hope too soon. I just want to check if you've managed to solve the oscillating issue causing whacky traces? I'll try to find a test file to see if this still occurs. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #653 +/- ##
==========================================
+ Coverage 83.53% 83.82% +0.28%
==========================================
Files 21 21
Lines 3061 3072 +11
==========================================
+ Hits 2557 2575 +18
+ Misses 504 497 -7
☔ View full report in Codecov by Sentry. |
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.
Code looks good and clean. Thanks for making this change so quick and sorry for the lack of review on this until now.
One thing I want to ask is why some of the circular molecule lengths have changed? My thought is that it shouldn't be touched as only the params (and therefore splining) of the linear mols have changed? The amounts are small enough that it shouldn't be too much of an issue - is it the step_size?.
I also am curious about the shepherd hooks you have for the minicircles image and why despite they don't terminate on or nearer the trace - is it because of the spline averaging where the last coordinate is only obtained for 1 of 4 splines and as such has less weighting? Or am I overcomplicating this hahaha
…g' into SylviaWhittle/607-linear-splining
Just a note, mainly for future me: The linear molecules look different because previously we just returned the non-splined, fitted traces since we didn't spline the linear traces. We now spline them so they are different. |
I discovered and fixed a bug that caused splining to fail in some cases where there are duplicate, consecutive points in the sampled points arrays. Added a function to remove these duplicates and added tests for it. This results in grains succeeding and hence the change in output columns. |
Oh and @ns-rse I added a contingency (plus test) to your |
I've not digged in to check but if this is a parameter it would make sense for it to be configurable, with a sensible default. |
It's in the config now 👍 |
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.
Sorry I've taken so long to get round to reviewing this, its a big PR.
Some minor comments but nothing blocking this from being merged.
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.
Good to go ✅ 👍
No substantive code changes requested, @SylviaWhittle has addressed aspects of changes in length in other comments.
Closes #607
This PR aims to improve the splining of linear molecules. Previously we just skipped splining for linear molecules, however @Jean-Du got it working through use of the smoothing and periodicity parameters to scipy's splprep (splining) function.
I wanted to make
get_splined_traces()
into a function rather than a method, since it doesn't really need theself
keyword in it and could just as easily take all its arguments as parameters (better for documentation too!) so I've left it in a functional style, but still being a method in case we want to switch it later on.I've also added unit tests for
get_splined_traces()
😄I've had to update a lot of tests for this change. I have NOT sanity checked all of them, but I have plotted the effects on the splined traces of
minicircle.spm
:Previous splines:
Updated splines:
Thanks to @Jean-Du for the code here, I just copied it across, applied pylint adherence and updated / created tests.