Skip to content
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

Healpix mapmaker #179

Merged
merged 18 commits into from
Jun 27, 2024
Merged

Healpix mapmaker #179

merged 18 commits into from
Jun 27, 2024

Conversation

earosenberg
Copy link
Contributor

No description provided.

Case where target ndim smaller than shape-check tuple
This adds flexibility and is needed to match TOAST qpoint
Note we do no checking to avoid duplicates with default args
(accuracy, fast_math, mean_aber, rate_ref) or those from weather.to_qpoint()
(temperature, humidity, pressure)
Remove dummy axis and add RING-NEST option for untiled healpix maps
Add error checking for NSIDE
Comment out print statements in projection
@earosenberg earosenberg requested a review from mhasself May 16, 2024 16:15
Copy link
Member

@mhasself mhasself left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took me a while to get to this. This is appreciated!

A few comments inline. Also:

  • The demo is helpful, but there should be unit tests too (in test/). (See test_proj_eng.py ... I think it's best if unit tests run quickly, i.e. using very small problems for the trials.)
  • Add some basic instructions to the docs (doesn't have to be exhaustive; just a starting point / example).

src/Projection.cxx Outdated Show resolved Hide resolved
@@ -1146,7 +1426,6 @@ bp::object ProjectionEngine<C,P,S>::pixel_ranges(
target_ranges[i_det].append_interval_no_check(domain_start, n_time);
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please restore these lines ... unnecessary reformatting of untouched code is to be avoided.

python/proj/wcs.py Outdated Show resolved Hide resolved
demos/demo_proj_hp.py Outdated Show resolved Hide resolved
demos/demo_proj_hp.py Show resolved Hide resolved
include/healpix_bare.h Show resolved Hide resolved
@earosenberg
Copy link
Contributor Author

Thanks for the detailed comments! With respect to the docs, my restructuring of the Projectionist class means that the automatic reference for Projectionist is now missing the shared methods belonging to the parent class. I could just add all three classes (_ProjectionistBase, Projectionist, ProjectionistHealpix) to the automatic docs, but don't know if there's a preferred solution?

Fix from_map and _guess_comps
Fix RING
Change order of optional arguments for for_healpix constructor
Refactor get_active_tiles
@earosenberg
Copy link
Contributor Author

I believe these commits address all of the above points, except for the docs issue I mentioned in my previous comment

Copy link
Member

@mhasself mhasself left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the additional fixes. This is almost ready.

For the Projectionist docs, I think you just need to put all 3 classes in the autodocs, and then create an explicit link in the docstring for the two subclasses saying "see also the methods defined in base class, ...". I think it's dangerous and annoying to duplicate docstring text ... but helpful to provide clickable links in the rendered documentation to the one source of truth. (This approach is already in there, where method docstrings don't all explain what is meant by arguments "assembly", "comps", etc ... but rather that's explained in the class docstring. All that stuff in the Projectionist docstring should probably go in the base class docstring, then, and just a link remains (along with everything specific to RectPix).)

include/numpy_assist.h Show resolved Hide resolved
python/proj/coords.py Show resolved Hide resolved
Change default method to 'simple' for untiled maps and 'tiles' for tiled
Specific error if method not allowed for Healpix (ie domdir)
mhasself
mhasself previously approved these changes Jun 24, 2024
Copy link
Member

@mhasself mhasself left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few minor comments before merge, but approving now.

I'm really pleased to have these capabilities in so3g -- thanks again for taking this on!

python/proj/wcs.py Show resolved Hide resolved
Comment on lines 732 to 735
""" Construct a Projectionist for Healpix maps.

See class documentation for description of standard arguments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make formatting of docstring a little more consistent with the rest of the module... e.g.:

            """Construct a Projectionist for Healpix maps.

            See class documentation for description of standard arguments.

(No space after """; paragraph edges are in the column of the first ".)

Comment on lines +787 to +789
def get_coords(self, assembly, use_native=False, output=None):
"""Get the spherical coordinates for the provided pointing Assembly.
See parent class documentation for full description.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really necessary to redefine this method, right? There's nothing proj specific about get_coords. I know the default version uses CAR, but that's true, under the hood, for the HP projector too.

So... please remove this, and just update the inherited get_coords docstring if you feel it is not general enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree it's not needed in principle. As written there is a technical problem, in that the inherited get_coords will try to initialize a CAR ProjEng using the Healpix _get_pixelizor_args info (nside, etc) and crash.
I can add a small check to the parent function to call the HP rather than CAR ProjEng, or there are other solutions (eg add a default arg to call 'CAR' with a minimal re-definition in the Healpix case to call 'HP', or a bit more work in the Healpix case to make a proper CAR Projectionist), or else we can leave it as is. Do you have a preference?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. Ok, that's a good enough reason. Leave it in.

@mhasself
Copy link
Member

btw @earosenberg Please squash this on merge (or before).

Copy link
Member

@mhasself mhasself left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great - squash and rebase and we're done.

@earosenberg earosenberg merged commit bbacebd into master Jun 27, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants