Open ljwolf opened 4 years ago
Hi @ljwolf I have analyzed the points put forth by you. In my analysis :
A generic hull function is a really good suggestion. This can be efficiently done via a generic hull class importing all other functions.
I agree with the import safe suggestion. This will really help in removing breakpoints in our code.
Sort for mbr may not be a prudent choice (sort being a O(N log N) ). Instead, we can use a comparison in pairs strategy.
We can have a namedtuple each place functions are getting referenced.
I think that numba-ization can be done for skyum. We can do it via parallel threading
Hey thanks! If you want to take a stab at it,
would be a good first steps for this!
Hi @ljwolf I have already made some changes in the code for mbr loop.
Instead of a loop, the tuple array has been divided into 2 arrays and separate max and min have been calculated.
Also, I have renamed mbr to minimum_bounding_rectangle.
Currently, I am working on the wrapper for opencv minimum area rectangle.
I will raise the PR for the same after proper testing.
This is a running list of enhancements burbling up of when writing the
gdsbook/book
chapter on point pattern analysis.additional hulling measures
hull()
should be general, with atype
argument that supports alpha shapes, minimum bounding rectangles, minimum area rectangles, and minimum bounding circles. This would require putting a dedicatedconvex_hull
function elsewhere. Since we could sethull
's default to be the convex hull, this can actually be made API-transparent :smile:mbr
should be expanded tominimum_bounding_rectangle
minimum_area_rectangle
and borrow/import the opencv implementation of the minimum area rectangle.skyum
tominimum_bounding_circle
, or use it as a fallback if we cannot useopencv
's minimum bounding circleskyum
needs to be brought in line with other functions/classes (my bad :disappointed_relieved:)API consistency
centrography
is available directly inpointpats
... is this intentional?skyum
should return in the same manner asellipse
. I think they both should give some kind ofnamedtuple
return value that has(center, radius)
or(center, semimajor, semiminor, rotation)
.Performance
mbr
does a loop in python through all points and explicitly finds the minimum. We should probably use a sort for a faster solution?skyum
can be easily numba-ized, but I'm not sure if it'd matter much.New statistics