-
Notifications
You must be signed in to change notification settings - Fork 30
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
Average patterns with nearest neighbours #134
Conversation
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
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 looks great. :)
I only added a couple of comments in regards of the clarity of documentation at specific points.
I realised that my implementation, with a few tweaks, can be made a lot more general, with options for the user to:
Have also created a simple drawing tool to plot the kernel and its coefficients, with this output for a Gaussian kernel with |
A natural continuation of this averaging would be to implement different coefficients for each pattern, e.g. ones determined by similarity between the pattern at the kernel origin and its nearest neighbours in e.g. a (5 x 5) window like the ones used in the NLPAR method (https://github.com/USNavalResearchLaboratory/NLPAR). This is actually pretty easy with Dask's |
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
I again realise that my implementation should be even more generalised, in that a kernel class should be made! Kernel objects can then be obtained for pattern averaging, or for detection of peaks in the Hough/Radon transform. These are the two use cases I can think of so far... I will implement the kernel class to work for pattern averaging now, with plans for generalising and/or extending it for peak detection in the future. Have therefore reverted this PR to work in progress. |
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
The macOS build fails because it cannot find pytest, although it is listed among installed packages... Don't know why, but all tests pass on Linux and Windows. |
Note that Travis macOS with pip fails here, however it is fixed in #143. |
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 looks great - the documentation well explains the functionality, and there are several good examples. I have no major comments. You have done a great job on this!
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Updated the documentation with your suggested explanation @tinabe (via personal correspondance, thanks a lot!). Also clarified the docstring for |
Tests fail on all Travis builds because of intensity comparisons for static and dynamic background corrections to predefined answers which apparently are not correct anymore, although they were correct yesterday... Because the data type used in those corrections were changed in PR #148, I will merge this since all other tests pass. |
Description
This PR adds averaging of patterns with its nearest neighbours. The user can decide:
So far, all neighbouring patterns are averaged equally. However, it should be fairly easy to add weighted averaging.
Type of change
Progress
How has this been tested?
Minimal example of the bug fix or new feature
References
Implemented using
scipy.ndimage.correlate
, taking a queue from Stack Overflow user Evan Davis' solution. Also use Dask's overlapping computations functionality.Addresses #13.