Package healpix.essentials
Class HealpixBase
java.lang.Object
healpix.essentials.HealpixTables
healpix.essentials.HealpixBase
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
HealpixMapDouble
,HealpixMapFloat
,HealpixProc
Basic opersations related to the HEALPix pixelisation.
This class is conceptually very similar the the Healpix_Base class
of Healpix_cxx. It supports the NESTED scheme for nside parameters which are
powers of 2, and the RING scheme for arbitrary positive nside parameters.
The maximum supported nside parameter is 2^29.
- Author:
- Martin Reinecke
- See Also:
- Copyright:
- 2011, 2012 Max-Planck-Society
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected double
protected double
protected long
protected long
protected long
protected long
protected long
protected long
static final long
Maximum Nside parameter; equivalent to 2^order_max
.protected long
The Nside parameter.protected int
The order of the map; -1 whennside
is not a power of 2.static final int
Maximum order parameterprotected Scheme
The ordering scheme.Fields inherited from class healpix.essentials.HealpixTables
ctab, facearray, jpll, jrll, swap_cycle, swaparray, utab, xoffset, yoffset
-
Constructor Summary
ConstructorDescriptionInitializes the object to Nside=1 and scheme=NESTED.HealpixBase
(long nside_in, Scheme scheme_in) Initializes the object to a user-supplied Nside and ordering scheme. -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the pixel which contains the supplied Pointing.Vec3[]
boundaries
(long pix, int step) Returns a set of points along the boundary of the given pixel.long
getNpix()
Returns the total number of pixels in the pixelisation.int
getNside()
Returns the current Nside parameter.int
getOrder()
Returns the current order parameter.Returns the current ordering scheme.protected long
loc2pix
(healpix.essentials.Hploc loc) double
Returns the maximum angular distance between a pixel center and its corners.long[]
neighbours
(long ipix) Returns the neighboring pixels of ipix.long
nest2ring
(long ipnest) Returns ring pixel number for the supplied nested pixel number.static long
npix2Nside
(long npix) Calculates the Nside parameter from the number of pixels.static long
nside2Npix
(long nside) Calculates the number of pixels from the Nside parameter.static int
nside2order
(long nside) Calculates the map order from its Nside parameter.static long
order2Npix
(int order) Calculates the number of pixels from the order parameter.pix2ang
(long pix) Returns the Pointing corresponding to the center of the supplied pixel.protected healpix.essentials.Hploc
pix2loc
(long pix) long
pix2ring
(long pix) Compute ring index from pixel number.pix2vec
(long pix) Returns the normalized 3-vector corresponding to the center of the supplied pixel.protected HealpixBase.Xyf
pix2xyf
(long pix) pix2zphi
(long pix) Returns the Zphi corresponding to the center of the supplied pixel.Returns a range set of pixels whose centers lie within a given disk.queryDiscInclusive
(Pointing ptg, double radius, int fact) Returns a range set of pixels which overlap with a given disk.queryPolygon
(Pointing[] vertex) Returns a range set of pixels whose centers lie within the convex polygon defined by thevertex
array.queryPolygonInclusive
(Pointing[] vertex, int fact) Returns a range set of pixels that overlap with the convex polygon defined by thevertex
array.queryStrip
(double theta1, double theta2, boolean inclusive) Returns a range set of pixels whose centers lie within a given latitude range (ifinclusive==false
), or which overlap with this range (ifinclusive==true
).long
ring2nest
(long ipring) Returns nested pixel number for the supplied ring pixel number.double
ring2theta
(long ring) Returns the colatitude for the requested ring.protected HealpixBase.Xyf
ring2xyf
(long pix) double
ring2z
(long ring) Returns the z-coordinate (equivalent to the cosine of the colatitude) for the requested ring.void
setNside
(long nside_in) Adjusts the object to nside_in.void
setNsideAndScheme
(long nside_in, Scheme scheme_in) Adjusts the object to nside_in and scheme_in.void
Adjusts the object to scheme.long
Returns the pixel which contains the supplied Vec3.protected long
xyf2pix
(int ix, int iy, int face_num) protected long
xyf2pix
(HealpixBase.Xyf xyf) long
Returns the pixel which contains the supplied Zphi.
-
Field Details
-
order_max
public static final int order_maxMaximum order parameter- See Also:
-
ns_max
public static final long ns_maxMaximum Nside parameter; equivalent to 2^order_max
.- See Also:
-
order
protected int orderThe order of the map; -1 whennside
is not a power of 2. -
nside
protected long nsideThe Nside parameter. -
nl2
protected long nl2 -
nl3
protected long nl3 -
nl4
protected long nl4 -
npface
protected long npface -
npix
protected long npix -
ncap
protected long ncap -
fact1
protected double fact1 -
fact2
protected double fact2 -
scheme
The ordering scheme.
-
-
Constructor Details
-
HealpixBase
public HealpixBase()Initializes the object to Nside=1 and scheme=NESTED. -
HealpixBase
Initializes the object to a user-supplied Nside and ordering scheme.- Parameters:
nside_in
- the Nside parameterscheme_in
- the ordering scheme- Throws:
Exception
-
-
Method Details
-
ring2xyf
-
pix2xyf
-
xyf2pix
protected long xyf2pix(int ix, int iy, int face_num) -
xyf2pix
-
nside2order
Calculates the map order from its Nside parameter.- Parameters:
nside
- the Nside parameter- Returns:
- the map order corresponding to
nside
; -1 ifnside
is not a power of 2. - Throws:
Exception
-
npix2Nside
Calculates the Nside parameter from the number of pixels.- Parameters:
npix
- the number of pixels- Returns:
- the computed Nside parameter
- Throws:
Exception
-
nside2Npix
Calculates the number of pixels from the Nside parameter.- Parameters:
nside
- the Nside parameter- Returns:
- the computed number of pixels
- Throws:
Exception
-
order2Npix
Calculates the number of pixels from the order parameter.- Parameters:
order
- the order parameter- Returns:
- the computed number of pixels
- Throws:
Exception
-
setNside
Adjusts the object to nside_in.- Parameters:
nside_in
- the new Nside parameter- Throws:
Exception
-
setNsideAndScheme
Adjusts the object to nside_in and scheme_in.- Parameters:
nside_in
- the new Nside parameterscheme_in
- the new ordering scheme- Throws:
Exception
-
getScheme
Returns the current ordering scheme.- Returns:
- the current ordering scheme
-
getNside
public int getNside()Returns the current Nside parameter.- Returns:
- the current Nside parameter
-
getNpix
public long getNpix()Returns the total number of pixels in the pixelisation.- Returns:
- the current total number of pixels
-
setScheme
Adjusts the object to scheme.- Parameters:
scheme_in
- the new ordering scheme- Throws:
Exception
-
getOrder
public int getOrder()Returns the current order parameter.- Returns:
- the current map order parameter.
-
ang2pix
Returns the pixel which contains the supplied Pointing.- Parameters:
ptg
- the requested location on the sphere.- Returns:
- the pixel number containing the location.
- Throws:
Exception
-
pix2ang
Returns the Pointing corresponding to the center of the supplied pixel.- Parameters:
pix
- the requested pixel number.- Returns:
- the pixel's center coordinates.
- Throws:
Exception
-
vec2pix
Returns the pixel which contains the supplied Vec3.- Parameters:
vec
- the requested location on the sphere (need not be normalized).- Returns:
- the pixel number containing the location.
- Throws:
Exception
-
pix2vec
Returns the normalized 3-vector corresponding to the center of the supplied pixel.- Parameters:
pix
- the requested pixel number.- Returns:
- the pixel's center coordinates.
- Throws:
Exception
-
ring2nest
Returns nested pixel number for the supplied ring pixel number.- Parameters:
ipring
- the requested pixel number in RING scheme.- Returns:
- the corresponding pixel number in NESTED scheme.
- Throws:
Exception
-
nest2ring
Returns ring pixel number for the supplied nested pixel number.- Parameters:
ipnest
- the requested pixel number in NESTED scheme.- Returns:
- the corresponding pixel number in RING scheme.
- Throws:
Exception
-
loc2pix
protected long loc2pix(healpix.essentials.Hploc loc) -
zphi2pix
Returns the pixel which contains the supplied Zphi.- Parameters:
zphi
- the requested location on the sphere.- Returns:
- the pixel number containing the location.
-
pix2loc
protected healpix.essentials.Hploc pix2loc(long pix) -
pix2zphi
Returns the Zphi corresponding to the center of the supplied pixel.- Parameters:
pix
- the requested pixel number.- Returns:
- the pixel's center coordinates.
-
neighbours
Returns the neighboring pixels of ipix. This method works in both RING and NEST schemes, but is considerably faster in the NEST scheme.- Parameters:
ipix
- the requested pixel number.- Returns:
- array with indices of the neighboring pixels. The returned array contains (in this order) the pixel numbers of the SW, W, NW, N, NE, E, SE and S neighbor of ipix. If a neighbor does not exist (this can only happen for the W, N, E and S neighbors), its entry is set to -1.
- Throws:
Exception
-
maxPixrad
public double maxPixrad()Returns the maximum angular distance between a pixel center and its corners.- Returns:
- maximum angular distance between a pixel center and its corners.
-
ring2z
public double ring2z(long ring) Returns the z-coordinate (equivalent to the cosine of the colatitude) for the requested ring. This method also accepts the not-really-existing ring indices 0 and 4*Nside, which correspond to North and South Poles, respectively.- Parameters:
ring
- ring index: the northernmost ring in the map has index 1; ring indices are increasing towards the South pole.- Returns:
- z-coordinate of the ring.
-
ring2theta
public double ring2theta(long ring) Returns the colatitude for the requested ring. This method also accepts the not-really-existing ring indices 0 and 4*Nside, which correspond to North and South Poles, respectively.- Parameters:
ring
- ring index: the northernmost ring in the map has index 1; ring indices are increasing towards the South pole.- Returns:
- z-coordinate of the ring.
-
queryStrip
Returns a range set of pixels whose centers lie within a given latitude range (ifinclusive==false
), or which overlap with this range (ifinclusive==true
).The latitude range is defined as follows:
- if
theta1<theta2
, it is the range betweentheta1
andtheta2
- otherwise it is the range between 0 and
theta2
, and betweentheta1
and pi.
- Throws:
Exception
- if
-
queryDisc
Returns a range set of pixels whose centers lie within a given disk.This method is more efficient in the RING scheme.
- Parameters:
ptg
- the angular coordinates of the disk centerradius
- the radius (in radians) of the disk- Returns:
- the requested set of pixel number ranges
- Throws:
Exception
-
queryDiscInclusive
Returns a range set of pixels which overlap with a given disk.This method is more efficient in the RING scheme.
This method may return some pixels which don't overlap with the polygon at all. The higher
fact
is chosen, the fewer false positives are returned, at the cost of increased run time.- Parameters:
ptg
- the angular coordinates of the disk centerradius
- the radius (in radians) of the diskfact
- The overlapping test will be done at the resolutionfact*nside
. For NESTED ordering,fact
must be a power of 2, else it can be any positive integer. A typical choice would be 4.- Returns:
- the requested set of pixel number ranges
- Throws:
Exception
-
queryPolygon
Returns a range set of pixels whose centers lie within the convex polygon defined by thevertex
array.This method is more efficient in the RING scheme.
- Parameters:
vertex
- an array containing the vertices of the requested convex polygon.- Returns:
- the requested set of pixel number ranges
- Throws:
Exception
-
queryPolygonInclusive
Returns a range set of pixels that overlap with the convex polygon defined by thevertex
array.This method is more efficient in the RING scheme.
This method may return some pixels which don't overlap with the polygon at all. The higher
fact
is chosen, the fewer false positives are returned, at the cost of increased run time.- Parameters:
vertex
- an array containing the vertices of the requested convex polygon.fact
- The overlapping test will be done at the resolutionfact*nside
. For NESTED ordering,fact
must be a power of 2, else it can be any positive integer. A typical choice would be 4.- Returns:
- the requested set of pixel number ranges
- Throws:
Exception
-
pix2ring
public long pix2ring(long pix) Compute ring index from pixel number. Works in both RING and NESTED schemes- Parameters:
pix
- pixel number- Returns:
- ring index (1 to 4Nside-1)
-
boundaries
Returns a set of points along the boundary of the given pixel. Step 1 gives 4 points on the corners. The first point corresponds to the northernmost corner, the subsequent points follow the pixel boundary through west, south and east corners.
-