-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
High-level API; Remove HEALPix class? #98
Comments
I don't have much time to comment on this today, but I'm 👎 on removing the class. The intent when writing it was that one day we could implement
This may be true but there are still many files out there that just use the standard HEALPix approach with scalar
What about simply making it so that it's optional to specify nside when initializing HEALPix and in that case it can be passed during method calls?
Most of the docs actually use the high-level API at the moment. If we want to simplify the API, my personal preference would be to keep only the classes in the public API and hide the individual functions. Most of the docs actually mention the high-level class, it's just the API docs that show the functions so we aren't really splitting the docs. In addition to making it possible to easily instantiate a HEALPix from a header, the other benefit to me to having a high-level class is that conceptually the class represents a specific tessellation - in a sense this is the same as having a My personal preference is to keep the class approach as the primary way to use the package, and allow nside to optionally be passed during method calls and not during initialization. We can keep the individual functions in the API docs but not mention them anywhere else. If we have to get rid of something I would suggest hiding the healpy functions from the docs. We originally only added that to make it easier to migrate, but I find our main API to be nice and clean and would rather people used that. So the bottom line is that I'd rather get rid of the healpy compatibility layer than our high-level class. Of course this is just my personal opinion and happy to go with the majority decision. |
Another benefit of the high-level class is integration with the In any case, having thought about this a bit more, I do agree that the fewer APIs we have to maintain, the better. One option therefore would be to also get rid of the low level API and keep only the high-level API. Just an idea! |
I think we should only offer one API, the functions or the class. If we choose the class, then I think there's a few options to do it. Another option could be to take more arguments in This API question would certainly benefit from more user feedback; we could even post it on astropy-dev if we don't get many opinions here. |
An intermediate solution is to allow that flexibility only for I agree that this would likely benefit from user opinions. |
I like this option; I'd like to try it out. I am working on some tutorial material on the NUNIQ scheme for our LIGO/Virgo Public Alerts User Guide; this would be a good opportunity to try this out. |
@lpsinger - did you have a chance to try this out? Or shall I just close this as there haven't really been any other complaints about the API and it's not really worth changing it? |
No, I haven't tried it out yet. I just got very busy, that's all. My hot take is:
@israelmcmc has recently done some work on an object-oriented interface for multi-resolution maps. He may have some thoughts to offer. |
As @lpsinger mentioned, I recently implemented an object-oriented wrapper for healpy with support for multi-resolution maps. The documentation https://healpixmap.readthedocs.io includes a quick-start tutorial where you can see the benefits of this approach. As pointed out by @cdeil, having a class for a single-resolution map is convenient for the user, but rather than a drawback, it is even more advantageous in the case of multi-resolution maps. The idea is that the user can write code without thinking about the underlaying grid, whether the map is multi or single-resolution, or its ordering scheme and A multi-resolution map object contains an array with the explicit NUNIQ number for each of the pixels. However, the maps behave as is if they were rasterized to single-resolution maps before an operation (they are not though). For this to work the object needs to have a flag property called Another benefit of the object-oriented approach for multi-resolution maps is that you do have an efficiency benefit by pre-computing the rangesets for pixels and sorting them. These are the list of equivalent pixels in a single resolution map that a given UNIQ pixel would have, and are used to do the operations efficiently. I'm actually not caching these since I haven't decided if is better to save CPU or memory, but it can be done. With this approach, I think the "core" procedural interface can be hidden like @astrofrog suggested. I did find it useful though to expose two separate classes: If people decide to go with this approach for |
Currently we offer the same functionality via three interfaces (see API).
lonlat_to_healpix(lon, lat, nside, return_offsets=False, order='ring')
(nside, order, frame)
data members. One-line methods re-expose functions.astropy_healpix.healpy
. Drop-in replacements for healpy.To help transition code and with internal testing.
I would like us to discuss and make a decision next week at the workshop on the following questions:
astropy.healpix.healpy
from the docs?Remove HEALPix class?
The HEALPix class (see high_level.py contains
nside
,order
andframe
properties, as well as ~ 10 one-line methods re-exposing the function API.The benefit of the class is that it's very nice for users (see docs):
A single-class API is nice to import and remember, and only having to pass some parameters once instead of to multiple function calls is convenient.
However, offering the class also has drawbacks:
nuniq
indexing is becoming more common, and I think we should support arrays for nside (see Support arrays for nside #66 Add support for uniq pixel ID scheme #91). This makes it awkward to passnside
ininit
, it should really be moved to the method calls, leaving onlyorder
andframe
ininit
.nside
. We could of course only support scalarnside
in the class, and only allow arraynside
in the functions, like @lpsinger did in Support arrays for nside #71 .I'm +1 to remove the class, and am volunteering to make a PR removing it and rewriting the docs to use the functions.
Hide
astropy.healpix.healpy
from the docs?Another question that we should decide before making a PR for
astropy.healpix
for the Astropy core repo is whetherastropy.healpix.healpy
should be shown in the public API and docs. At the moment it appears like this: https://astropy-healpix.readthedocs.io/en/latest/healpy_compat.htmlI think that's fine, we should keep it as a compatibility and transition layer and for testing, and also mentioning it in the docs like that is OK. But if others think it would be better to hide it more from the docs, or if that is the preference of the
healpy
maintainers, that seems OK to me as well.@astrofrog @lpsinger @dstndstn all - please comment!
The text was updated successfully, but these errors were encountered: