CMBDataFrame: CMBDataFrame class

Description Usage Arguments Value Examples

View source: R/CMBDataFrame.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
CMBDataFrame(
  CMBData,
  coords,
  win,
  include.polar = FALSE,
  include.masks = FALSE,
  spix,
  sample.size,
  nside,
  ordering,
  I,
  ...
)

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.

Value

A CMBDataFrame whose row.names attribute contains HEALPix indices.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Method 1: Read the data while constructing the CMBDataFrame
## download a FITS file and use real data
# downloadCMBMap()
# df <- CMBDataFrame("CMB_map_smica1024.fits")
df <- CMBDataFrame(nside = 16, I = rnorm(12 * 16 ^ 2),
                   ordering = "nested")

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

# Specify a vector of pixel indices using spix
df.subset <- CMBDataFrame(df, spix = c(2,4,6))

# Take a look at the summary
summary(df)

# Access HEALPix pixel indices using pix function
# (these are stored in the row.names attribute)
pix(df.subset)

rcosmo documentation built on Dec. 11, 2021, 9:29 a.m.