Convert a 3D cartesian map to Healpix projection - astropy

I want to convert a map I have into a healpy map. I am fairly new to working with healpy so any suggestions would be appreciated.
The current map looks like this, in the format GLONxGLATxR(Kpc):

You need to use the healpy.ang2pix function, so given your coordinates you can understand which is the associated pixel.
See https://healpy.readthedocs.io/en/latest/generated/healpy.pixelfunc.ang2pix.html
As an example, see this tutorial:
https://gist.github.com/zonca/680c68c3d60697eb0cb669cf1b41c324

Related

Halcon: Obtain how much is a mm in pixels after calibration

I've successfully calibrated my camera and I can get the dimensions of a XLD in world coordinates with ContourToWorldPlaneXld and then HeightWidthRatioXld. This returns me the measures of a contour extracted from a shape.
Now I need to convert a value inserted by the user in mm (example in mm: 0.1) and get how many pixels the measure is, for example, to draw a line.
I need the pixel value as per request. I tried looking around in the Halcon documentation but I didn't find what I was looking for.
Also I read this answer but it' not exactly what I'm looking for.
I'm using Halcon Progress 21.11.
Edit: A possible solution could be obtaining the dimensions before converting them to world plane and then do something like pixel/world but I would prefer a better method if it exists.

Cartopy aliasing

I have the following issue:
When I transform from one map projection to another using Cartopy, the output picture displays a quite ugly aliasing with "steps" larger than one pixel. I attach the input and output pictures as example.
Input - PlateCarree:
Output - Transformed:
Could anyone explain me why that happens? Is it possible to correct it?

How can I plot this kind of picture using Matplotlib or Mayavi?

I have three 2d arrays: X,Y,Z, which contain irregular 3d points coordinate,respectively.And another 2d array data, which contains the values on those points.
What I want to do is to display this data in 3d space , with 0 value part masked out.Much like this one:
In matlab, I can use function fill3 to achieve this, but how can I plot the same kind of picture in matplotlib or mayavi ? I have tried to use mask array ,plot_surface and colorface together, as the example here:
Plotting a masked surface plot using python, numpy and matplotlib
and it worked, the result is the link below:
but that is really really slow, and will cost too much time. Is there a better way?
Well, today I find out an alternative way to solve the problem. Except using plot_surface, I choose to use scatter3D,
the core code is some what like this
aa=np.shape(X)[0]
bb=np.shape(X)[1]
x=X.reshape(aa*bb)
y=Y.reshape(aa*bb)
z=Z.reshape(aa*bb)
data=data.reshape(aa*bb)
x1=[]
y1=[]
z1=[]
da1=[]
for i in range(aa*bb):
if data[i]>0:
x1.append(x[i])
y1.append(y[i])
z1.append(z[i])
da1.append(data[i])
my_cmap=cm.jet
my_cmap.set_over('c')
my_cmap.set_under('m')
N=da1/max(da1)
fig=plt.figure()
ax=fig.add_subplot(111,projection='3d')
ax.scatter3D(x1,y1,z1,s=6,alpha=0.8,marker=',',facecolors=my_cmap(N),lw=0)
and the result is like this:
this doesn't really solve the problem, but it is a nice substitution.
I'll keep waiting for more answers.

Add one dimension for a 2D distance map in Paraview

I use Paraview to visualize a 2D distance map.
Below what I obtain where geodesics are represented with different colors.
I use the VTK file format RECTILINEAR_GRID.
I would like to add a dimension z where the height would depend on the scalar field value u without having to rewrite an other file.
Example can be found here.
Thanks to lib comment, Warp by Scalar filter indeed answers my question.
It is available in the menu Filter->Alphabetical->Warp by Scalar.
Just leaving the default values gave me what I need.

Retrieve index of nearest surface-points returned from CGAL's surface_neighbor_coordinates_3

I (relatively new to CGAL and not a C++ expert) am trying to extract the index of the nearest-neighbor 3D points returned from CGAL's surface_neighbor_coordinates_3 (which searches a 2D mesh comprised of 3D points to find natural-neighbors of a provided query-point) in this CGAL example. In other examples (3D interpolation with 3D meshes), I have been able to do this by adding info to vertex handles in the triangulation data structure. In the linked example, I simply wish to retrieve the indices of returned coords with respect to where the points in coords reside index-wise within the input list of points.
The other call-options for surface_neighbor_coordinates_3 seem to suggest this may be possible by passing-in an existing triangulation (with perhaps its info-augmented triangulation-data-structure). However, I'm not sure how to specify the info-augmented Delaunay_triangulation_3 for the case of a 2D mesh consisting of 3D points. I'm experimenting with it (using advancing-front triangulations to 2D-mesh my 3D points) but would like to know if there's some easier way to use the native capabilities of surface_neighbor_coordinates_3 if one only seeks to also have an info field associated with the returned points.
Any help would be greatly appreciated ... this has stumped me for a week.