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

Module for scanning a map and filling TOD #131

Merged
merged 15 commits into from
Sep 22, 2021
Merged

Module for scanning a map and filling TOD #131

merged 15 commits into from
Sep 22, 2021

Conversation

paganol
Copy link
Member

@paganol paganol commented Sep 18, 2021

This PR provides a module able to fill obs.tod given pointing information and input map provided by mbs. It also makes obs compatible with mapping.py optionally filling obs.psi and obs.pixind.
For now, no ecliptic-to-galactic coordinate rotation is implemented internally. So maps should be rotated to ecliptic before being fed to the function scan_map_in_observations. Probably having an option in mbs for dealing with that is worthed, I'll open an issue for this.
The memory handling can be improved, in particular, if psi and pixind are not filled.

Some points are still open:

  • Check numba implementation
  • Dealing with e2g rotation (if necessary)
  • Move ang2pix in scan_map_for_one_detector to save some memory?
  • Implement test
  • Update documentation

Copy link
Member

@ziotom78 ziotom78 left a comment

Choose a reason for hiding this comment

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

Very nice work! It looks good to me, we can merge it immediately.

@ziotom78
Copy link
Member

Ooops, I see that the new test in the documentation (file timeordered.rst) fails because of some rounding error:

Expected:
    -3.89414e-07
    -1.44749e-01
    -2.61039e-01
    -3.45981e-01
    -3.97462e-01
    -4.14204e-01
    -3.95788e-01
    -3.42674e-01
    -2.56182e-01
    -1.38462e-01
Got:
    8.74228e-08
    -1.44749e-01
    -2.61039e-01
    -3.45981e-01
    -3.97462e-01
    -4.14204e-01
    -3.95788e-01
    -3.42674e-01
    -2.56182e-01
    -1.38462e-01

Probably the best way to fix this is to change the format of the output numbers from %.5e to %.5f, so that the first number is rounded to zero.

@ziotom78
Copy link
Member

Regarding the point about ang2pix, I would merge this PR as is and open a new issue for it.

Should we decide that it is worth to save some memory, I wrote an implementation of ang2pix in Numba a couple of years ago in this gist. It just provides ang2pix for RING maps and a set of test cases. It's faster than Healpy but slower than DUCC; however, the fact that the function is written in Numba makes it optimal if called within a for loop in another Numba function, as it is the case here. (Numba does not makes calls to C functions as efficient as calls to Numba functions, as the latter can be inlined and included in the LLVM global optimization ran by its JIT compiler.) We might include those lines of code and rewrite the corresponding loop.

@paganol paganol merged commit 9d52fd1 into master Sep 22, 2021
@paganol
Copy link
Member Author

paganol commented Sep 22, 2021

Thanks, @ziotom78. I'm merging it. Let's also open an issue about g2e conversion.

@paganol paganol deleted the map_scanning branch September 22, 2021 19:15
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