Closed drvdputt closed 4 years ago
Great. Looking forward to the PR!
@drvdputt : is this still a bug or has it been fixed? Or am I still waiting for the PR? :-)
I did a quick search through the issues, and found that @lea-hagen already replaced this code in PR #39. So this can be closed.
I've been using the make_naive_maps script for a while now, and I've always felt like there was something off about the coordinate system.
I believe I have now found the error. There's two mistakes when the RA and Dec of the sources are converted to pixel coordinates of the map WCS.
regions_for_objects
, we havepixcrd = wcs_info.wcs_world2pix(world, 1)
, which asks for a 1-based index instead. This type of pixel coordinate is what's shown in DS9 for example. But when accessing the data array using numpy, 0-based coordinates are needed.So 1.6 would belong belongs to pixel 2, not pixel 1. Therefore, the floating point pixel coordinates should be rounded, not truncated.
This is fixed in my own branch, but there are some other changes. I'll put in a clean pull request once I'm more sure that my own code is correct.