On Thu, Mar 17, 2016 at 2:04 PM, Feng Yu <rainwood...@gmail.com> wrote: > Hi, > > ang2pix is used in astronomy to pixelize coordinate in forms of > (theta, phi). healpy is a binding of healpix > (http://healpix.sourceforge.net/, introduction there too), plus a lot > of more extra features or bloat (and I am not particular fond of this > aspect of healpy). It gets the work done. > > You can think of the function ang2pix as nump.digitize for angular input. > > 'nside' and 'nest' controls the number of pixels and the ordering of > pixels (since it is 2d to linear index). > > The important thing here is ang2pix is a pure function from (nside, > nest, theta, phi) to pixelid, so in principle it can be written as a > ufunc to extend the functionality to generate pixel ids for different > nside and nest settings in the same function call.
Thanks for the details! >From what you're saying, it sounds like ang2pix actually wouldn't care either way about the gufunc broadcasting changes we're talking about. When we talk about *g*eneralized ufuncs, we're referring to ufuncs where the "core" minimal operation that gets looped over is already intrinsically something that operates on arrays, not just scalars -- so operations like matrix multiply, sum, mean, mode, sort, etc., which you might want to apply simultaneously to a whole bunch of arrays, and the question is about how to handle these "inner" dimensions. In this case it sounds like (nside, nest, theta, phi) are 4 scalars, right? So this would just be a regular ufunc, and the whole issue doesn't arise. Broadcast all you like :-) -n -- Nathaniel J. Smith -- https://vorpus.org _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion