Learn R Programming

rcosmo (version 1.1.6)

CMBDataFrame: CMBDataFrame class

Description

The function CMBDataFrame creates objects of class CMBDataFrame. These are a special type of data.frame that carry metadata about, e.g., the HEALPix ordering scheme, coordinate system, and nside parameter.

Usage

CMBDataFrame(
  CMBData,
  coords,
  win,
  include.polar = FALSE,
  include.masks = FALSE,
  spix,
  sample.size,
  nside,
  ordering,
  I,
  ...
)

Value

A CMBDataFrame whose row.names attribute contains HEALPix indices.

Arguments

CMBData

Can be a string location of FITS file, another CMBDataFrame, a CMBDat object, a HPDataFrame or unspecified.

coords

Can be "spherical," "cartesian", or unspecified (HEALPix only).

win

optional CMBWindow object that specifies a spherical polygon within which to subset the full sky CMB data.

include.polar

TRUE if polarisation data is required, otherwise FALSE.

include.masks

TRUE if TMASK and PMASK are required, otherwise FALSE.

spix

Optional vector of sample pixel indices, or a path to a file containing comma delimited sample pixel indices. The ordering scheme is given by ordering. If ordering is unspecified then CMBData must be either a CMBDataFrame or a FITS file and the ordering scheme is then assumed to match that of CMBData.

sample.size

If a positive integer is given, a simple random sample of size equal to sample.size will be taken from CMBData. If spix is specified then sample.size must be unspecified.

nside

Optionally specify the nside parameter manually nside=\(2^k\) (usually 1024 or 2048).

ordering

Specifies the desired HEALPix ordering scheme ("ring" or "nested") for the output CMBDataFrame. If ordering is unspecified then the ordering scheme will be taken from the CMBData object. If ordering information cannot be found the default will be "nested". This parameter also specifies the ordering scheme of spix.

I

A vector of intensities to be included if CMBData is unspecified. Note that length(I) must equal \(12*nside^2\) if either spix or sample.size are unspecified.

...

Optional names data columns of length nrow(CMBData) to add to the CMBDataFrame.

Examples

Run this code
## Construct a small synthetic sky map.
df <- CMBDataFrame(nside = 16, I = rnorm(12 * 16 ^ 2),
                   ordering = "nested")

## Take a random sample.
df.sample <- CMBDataFrame(df, sample.size = 80)
plot(df.sample)

## Select pixels by index.
df.subset <- CMBDataFrame(df, spix = c(2,4,6))

## Inspect the map and the selected pixel indices.
summary(df)

pix(df.subset)



Run the code above in your browser using DataLab