Say I have two catalogs of points, each in two-dimensional space. For each object in a catalog, I want to find the nearest object(s) in the other catalog. I can do this by computing the distances between every single unique pair of objects and finding the ones within a search radius and possibly doing an additional sort.
... Continue reading.

For a radial profile of \(I( r)\), the enclosed flux within the radius \(r\) is given by
\begin{equation*} F( r) = \int_{0}^{2 \pi} d\phi \int_{0}^{r} dr r I(r, \phi) \ . \end{equation*}
I’m only concerned about azimuthal symmetric cases, so \(F( r) = 2\pi \int_{0}^{r} dr r I( r)\) .
... Continue reading.

Finally got around to finding this out by Googling. Itâ€™s a useful function so I reproduce it here for copy & paste:
def inside_polygon(x, y, points): """ Return True if a coordinate (x, y) is inside a polygon defined by the list of verticies [(x1, y1), (x2, y2), .
... Continue reading.