window.HPDataFrame: Get a sub window from a 'HPDataFrame'

Description Usage Arguments Details Value Examples

View source: R/HPDataFrame.R

Description

This function returns a HPDataFrame containing the data in hpdf restricted to the CMBWindow new.window. If the HPDataFrame has columns x,y,z or theta, phi then these will be used to determine locations with priority over the HEALPix indices in pix(hpdf) unless healpixCentered = TRUE is given. Note that if healpixCentered = TRUE then columns x,y,z or theta, phi will be discarded and replaced with pixel center locations.

Usage

1
2
3
## S3 method for class 'HPDataFrame'
window(x, new.window, intersect = TRUE,
  healpixCentered = FALSE, ...)

Arguments

x

A HPDataFrame.

new.window

Optional. A single CMBWindow object or a list of them.

intersect

A boolean that determines the behaviour when new.window is a list containing BOTH regular type and "minus" type windows together (see details).

healpixCentered

A boolean. If the HPDataFrame has columns x,y,z or theta, phi then these will be used to determine locations with priority over the HEALPix indices in pix(x) unless healpixCentered = TRUE is given. Note that if healpixCentered = TRUE then columns x,y,z or theta, phi will be discarded and replaced with pixel center locations.

...

Unused arguments.

Details

Windows that are tagged with set.minus (see CMBWindow) are treated differently from other windows.

If the argument is a list of CMBWindows, then interiors of all windows whose winType does not include "minus" are united (let A be their union) and exteriors of all windows whose winType does include "minus" are intersected, (let B be their intersection). Then, provided that intersect = TRUE (the default), the returned data.frame will be the points of df in the the intersection of A and B. Otherwise, if intersect = FALSE, the returned data.frame consists of the points of df in the union of A and B.

Note that if A (resp. B) is empty then the returned data.frame will be the points of df in B (resp. A).

Value

A HPDataFrame containing the data in x restricted to the CMBWindow new.window. Or, if new.window is unspecified, then the window attribute of x is returned instead (and may be NULL).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ns <- 16
hpdf <- HPDataFrame(nside = ns, I = 1:(12*ns^2))
hpdf

win1 <- CMBWindow(theta = c(0,pi/2,pi/2), phi = c(0,0,pi/2))
plot(hpdf); plot(win1)

hpdf.win <- window(hpdf, new.window = win1)
plot(hpdf.win, col = "yellow", size = 4, add = TRUE)
attributes(hpdf.win)
window(hpdf.win)
hpdf.win

rcosmo documentation built on Feb. 14, 2020, 5:06 p.m.