-
Notifications
You must be signed in to change notification settings - Fork 32
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
Improve IAU/COSMO documentation in enmap.read_map #144
Comments
If stakeholders agree on above, I am happy to submit a PR with documentation/more user-supplied arguments, e.g. the desired output convention. However, I think it's worth discussing if the default behavior -- to try to put the data in the COSMO convention -- should be changed to IAU? |
It's not arbitrary which representation the read-in map ends up with. Several hamonic conversion functions break if they do not get data in the convention they expect, which is COSMO. Changing these functions would break lots of existing code. I am not very keen on adding arguments to all those functions to make them support both conventions. It is much cleaner to convert once on input and then work with a consistent convention than it is to need to worry about which particular convention some particular map somewhere in the code has. So I'm against changing the default output from COSMO. I'm OK with adding an argument to the reading function to control this, with options like "cosmo", "iau" and "raw". But I don't think it will be useful to most people, as they will need to convert to cosmo to do harmonic operations. Documenting the behavior is a good idea, though.
That's not right, is it? If POLCCONV has an unrecognized value, then it's assumed to be COSMO, and therefore doesn't need to be converted. |
Hey Sigurd, thanks for taking a look. I agree it's not arbitrary, it's just that it's not as clear as it could be. Definitely agree that adding arguments to harmonic operations is not the right approach, but do think allowing more user control/visibility just on reading data from disk would be good. I think with documentation, we can trust users to do the right thing for their application. I'm OK with keeping COSMO as the default, wasn't aware of the depth of the dependencies on this! In short, specifically, I propose: (1) documenting the behavior, (2) adding an argument with default
Sorry, correct, should have said "assume data in COSMO and do no conversion." If the above suggestions look OK, I can submit a PR. Thanks! |
I'd like to add to this issue with a suggestion and question: Suggestion
Question (@msyriac)This issue is pertinent to the SSIA specification that LAT products are saved in IAU but always loaded by |
The motivation was that this is an official recommendation from IAU, one that astronomers outside the cosmological community seem to adhere to. We use FITS and WCS, so someone could use astropy or similar (e.g. https://docs.astropy.org/en/stable/generated/examples/io/plot_fits-image.html ) to load our maps. They may then potentially incorrectly interpret our polarization maps if we have them save them to disk using COSMO. |
Ah right, nice. Sorry, had it in my mind that someone might never see an “IAU SO map” if they were stuck with pixell, but yeah clearly that’s not true :) Anyway, my bigger point still stands: read_map and write_map need a little work to be more explicit and safe (and I can be the one to propose new code! Just want to be sure folks agree) |
Description
Currently
enmap.read_map
flips the U component of anndmap
in an opaque way, depending on the contents of the fits header. The fits header needs to have specific cards/values for the introspection to flip the component. These conditions (all evaluated inenmap.get_stokes_flips
) should be documented. Also, the default behavior of the function (to convert to COSMO) should be documented, or amended and documented if we want to run with IAU going forward.Even better, it would be nice to have some user arguments supply optional information about the data, e.g. which axes might need to be flipped, and what the desired output convention is, which could help handle the case of "simple" fits headers (as are produced with the
enmap.write_map
defaults) when the automatic introspection of the polarization convention, according to the conditions, might fail.What I Did
Playing with fits header of a file with a known polarization convention. I believe all these conditions (see
enmap.get_stokes_flips
) must be true forenmap.read_fits
to flip the polarization convention:(3-crval)/cdelt+crpix - 1
gives the 0-indexed index of the U component in "NAXISn".1.0
such that(3-crval)/cdelt+crpix - 1
is 2).I agree there is no clean way of avoiding the need for specific set of cards/values for automatic introspection, but the behavior should be made clear for new users I think.
The text was updated successfully, but these errors were encountered: