HPDataFrames are a type of data.frame designed to carry
data located on the unit sphere. Each row of a HPDataFrame
is associated with a HEALPix pixel index. The HPDataFrame
also holds an attribute called nside which stores the
HEALPix Nside parameter (i.e., the resolution of the HEALPix grid
that is being used).
Unlike CMBDataFrame, HPDataFrames may have
repeated pixel indices. They are made this way so that
multiple data points falling within a given pixel
can be stored in different rows of any given HPDataFrame.
HPDataFrame(
...,
nside,
ordering = "nested",
auto.spix = FALSE,
spix,
assumedUniquePix = FALSE,
delete.duplicates = FALSE,
save.dots = FALSE,
save.duplicate.indices = FALSE
)A data frame of class HPDataFrame containing the supplied observations and any coordinate columns. HEALPix pixel indices are stored in the pix attribute; further attributes record nside, ordering and whether indices are assumed unique.
Data. Can be named vectors or a data.frame. May include columns (x,y,z) or (theta, phi) representing Cartesian or spherical coordinates of points on the unit sphere.
Integer number \(2^k\), the nside
parameter, i.e, resolution. If nside is unspecified, then
the an attempt is made to use columns x,y and z from the provided
data, as Cartesian coordinates, to calculate an nside that is
sufficient to ensure all points belong to unique pixels.
The HEALPix ordering scheme ("ring" or "nested").
Boolean. If TRUE then spix will be found from
the coordinates provided in the data. That is, each row of
data will be assigned the pixel index of its closest HEALPix
pixel center. There must be columns x,y,z for cartesian or
theta, phi for spherical colatitude and longitude respectively.
If auto.spix = FALSE then nside must be specified.
A vector of HEALPix pixel indices indicating the
pixel locations of the data. Note that spix is ignored
if auto.spix = TRUE.
A boolean. Sets the assumedUniquePix
attribute of the HPDataFrame. This attribute indicates whether
or not the rows of a HPDataFrame can be assumed to belong to
unique pixels.
Boolean. If TRUE then rows corresponding to duplicate pixel indices will be dropped from the returned HPDataFrame, and assumedUniquePix will be set to TRUE.
A logical. If TRUE then the
dot product of each observation with the nearest
child HEALPix pixel
center will be stored as a column called "distance" in the returned
HPDataFrame, provided that auto.spix = TRUE.
Note that a 'child' pixel is any one of the
four pixels contained in the current pixel, in the nested
scheme, at the next highest resolution.
See children.
A logical. If TRUE and
delete.duplicates is also TRUE, then the
row indices of duplicated pixels will be retained
as an attribute called "duplicates". Note
that row index refers to the row position of the
duplicated pixel in the original HPDataFrame,
and not the actual pixel index itself.
HPDataFrame with auto.spix = TRUE can be used to transform any
spherical data (not necessarily CMB) to the Healpix representation, see
Example 3 below.
hp <- HPDataFrame(I = c(1, 2, 3), nside = 1, spix = c(1, 1, 2))
pix(hp)
assumedUniquePix(hp)
coords(hp, new.coords = "cartesian")
## Assign pixels automatically from three distinct locations.
hp.unique <- HPDataFrame(x = c(1, 0, 0), y = c(0, 1, 0), z = c(0, 0, 1),
auto.spix = TRUE)
pix(hp.unique)
assumedUniquePix(hp.unique)
Run the code above in your browser using DataLab