[Numpy-discussion] Changes to generalized ufunc core dimension checking

Feng Yu rainwoodman at gmail.com
Thu Mar 17 17:04:25 EDT 2016


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.

There are probably functions in numpy that can benefit from this as
well, but I can't immediately think of any.


On Thu, Mar 17, 2016 at 8:09 AM, Joseph Fox-Rabinovitz
<jfoxrabinovitz at gmail.com> wrote:
> On Thu, Mar 17, 2016 at 10:03 AM, Nathaniel Smith <njs at pobox.com> wrote:
>> On Mar 17, 2016 1:22 AM, "Feng Yu" <rainwoodman at gmail.com> wrote:
>>> Hi,
>>> Here is another example.
>>> To write pix2ang (and similar functions) to a ufunc, one may want to have
>>> implicit scalar broadcast on `nested` and `nsides` arguments.
>>> The function is described here:
>>> http://healpy.readthedocs.org/en/latest/generated/healpy.pixelfunc.pix2ang.html#healpy.pixelfunc.pix2ang
>> Sorry, can you elaborate on what that function does, maybe give an example,
>> for those of us who haven't used healpy before? I can't quite understand
>> from that page, but am interested...
>> -n
> Likewise. I just took a look at the library and it looks fascinating.
> I might just use it for something fun to learn about it.
>     -Joe
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list