cdshealpix.nested.neighbours

cdshealpix.nested.neighbours(ipix, depth, num_threads=0)

Get the neighbouring cells of some HEALPix cells at a given depth.

This method returns a \(N\) x \(9\) np.uint64 numpy array containing the neighbours of each cell of the \(N\) sized ipix array. This method is wrapped around the neighbours method from the cdshealpix Rust crate.

Parameters:
ipixnumpy.ndarray

The HEALPix cell indexes given as a np.uint64 numpy array.

depthint

The depth of the HEALPix cells.

num_threadsint, optional

Specifies the number of threads to use for the computation. Default to 0 means it will choose the number of threads based on the RAYON_NUM_THREADS environment variable (if set), or the number of logical CPUs (otherwise)

Returns:
neighboursnumpy.ndarray

A \(N\) x \(9\) np.int64 numpy array containing the neighbours of each cell. The \(5^{th}\) element corresponds to the index of HEALPix cell from which the neighbours are evaluated. All its 8 neighbours occup the remaining elements of the line.

Raises:
ValueError

When the HEALPix cell indexes given have values out of \([0, 4^{29 - depth}[\).

Examples

>>> from cdshealpix import neighbours
>>> import numpy as np
>>> ipix = np.array([42, 6, 10])
>>> depth = 12
>>> neighbours = neighbours(ipix, depth)