ziotom78 / Healpix.jl

Healpix library written in Julia
GNU General Public License v2.0
51 stars 18 forks source link

Bug in `queryDiscRing` when ring includes a pole #105

Closed jamesgurian closed 1 year ago

jamesgurian commented 1 year ago
using HealPix
using Plots

resol = Resolution(64)
(theta, phi) = (.01,pi/4)

pixidx = queryDiscRing(resol, theta, phi, .1)
m = HealpixMap{Float32, RingOrder}(resol.nside);
m[pixidx] .= 5;
m[ang2pix(m, theta, phi)] = 8  # Highlight the pixel at the center
plot(m,orthographic, Dict(:center=>(pi/2,pi/2)))

I was not able to follow the logic all the way through the method, but did hack together a version that seems to work based on the IDL implementation (https://healpix.sourceforge.io/html/idl_query_disc.htm)) . However, I did not implement the "fact" functionality which I don't need. I'm happy to share this code if it would be helpful.

ziotom78 commented 1 year ago

Thanks for reporting this! There were tree problems in the implementation of the function, but I think I managed to fix them all. The new release 4.2.0 fixes this.