Closed Wasim04 closed 2 months ago
Hi @astrofrog, Kindly accept my apology for tagging you. I am wondering if you could kindly check the above problem and advise me a solution.
Many Thanks Wasim
@Wasim04 - sorry for the delay in getting back to you, would you be able to share the input file? (for example via a dropbox or google drive or other link)
Hi Thomas, Thanks for your response. Here is an example input file. It's just a nside 64 probability map. https://github.com/Wasim04/test_repo
Many Thanks Wasim
@Wasim04 - the artifacts are due to the fact some of the output HEALPIX cells don't have a match in the input image (and are therefore set to NaN) - you can make the artifacts disappear by changing the reproject_to_healpix
call with:
healpix_map_reprojected, footprint = reproject_to_healpix(
to capture the footprint, then e.g.
healpix_map_reprojected[footprint == 0] = 0
Note that I had to change nested
to False
to get reasonable results in mollview
.
Why are some pixels not overlapping in the first place? I think the definition of the WCS is slightly wrong, as for example if I try and get the coordinates of the corner of the image the first value should be 180,-90 and the second should be defined, not NaN:
In [13]: print(wcs.pixel_to_world(-0.5, -0.5))
...: print(wcs.pixel_to_world(319.5, 159.5))
<SkyCoord (ICRS): (ra, dec) in deg
(179.4375, -89.4375)>
<SkyCoord (ICRS): (ra, dec) in deg
(nan, nan)>
I think the crpix line should be:
wcs.wcs.crpix = [(shape_out[1]+1) / 2, (shape_out[0]+1) / 2]
which yields sensible results:
In [19]: print(wcs.pixel_to_world(-0.5, -0.5))
...: print(wcs.pixel_to_world(319.5, 159.5))
<SkyCoord (ICRS): (ra, dec) in deg
(180., -90.)>
<SkyCoord (ICRS): (ra, dec) in deg
(180., 90.)>
I still get artifacts in this case, though not if I change coord_system_out='icrs'
interestingly. I will need to investigate this further.
This should be fixed with https://github.com/astropy/reproject/pull/459
Hi,
I was trying to use the reproject_to_healpix function. It did reproject the distribution I anticipated. However, a 'chain' like '--' line artefact appeared. Please let me know how to remove this. following is the small script, to reproduce the issue.