Get coordinates for specific value on healpy mollview

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Get coordinates for specific value on healpy mollview



Is it possible to find the coordinates for a specific value of a hitmap from a healpy mollview plot?



For example:
If I have a smoothed out hitmap and want to use the mask:


mask = (hitmap > 2.054) & (hitmap < 2.056)



to find the required values on of the hitmap.



The hitmap is used to create a mollview plot like this:


hp.mollview(hitmap, xsize=2000)



Is it then possible to find the coordinates (lon,lat) corresponding to the pixels in the mollview plot that satisfy the mask by using the mask?



Many thanks in advance!




1 Answer
1



The best way to do this would be via hp.pix2ang():


hp.pix2ang()


import healpy as hp
import numpy as hp

# Get the nside and number of pixels in your map
nside = hp.get_nside(mask)
npix = hp.nside2npix(nside)

# Use pix2ang to get the (l, b) coordinates for each pixel
glons, glats = hp.pix2ang(nside, np.arange(npix), lonlat=True)



This will give you a list of all the coordinates (l, b) for each pixel in your map. To get only the ones in the mask, simply use:


glons_eff = glons[mask]
glats_eff = glats[mask]





Thank you. Is this a good way of overplotting the mollview plot with another plot? For example using: hp.projplot(glons_eff,glats_eff, lonlat=True) I tried using healpy.projaxes.CartesianAxes.contour() to plot a contour at the value 2.055 (between the two values in the mask) But this does not seem to work for me...
– Nanna
Aug 13 at 10:07






There is currently no built-in function to draw contours in healpy, the function you're referring to does not exist in the latest healpy version.
– Daniel Lenz
Aug 13 at 17:37






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS