vec2pix

Convert cartesian direction vectors to MEALPix pixel numbers

Contents

Syntax

nPix = vec2pix(nSide,xyz,'Param1',Value1,...);

Input Arguments

nSide     HEALPix resolution parameter
xyz       cell array of [3,1] cartesian direction vectors
Param     Value
'nest'    use nested indexing (true | {false})

Return Arguments

nPix      size(xyz) pixel number array

Example

Find pixels corresponding to a [4,5] set of (unnormalized) cartesian vectors:

nSide = 4;
xyz0 = squeeze(num2cell(2*rand(3,4,5)-1,1));
nPix = vec2pix(nSide,xyz0)

% Find the normalized vectors corresponding to the pixels
xyz1 = pix2vec(nSide,nPix);

% Find angular distance from vectors to pixels
d = angDist(xyz0,xyz1)
nPix =

    28   157     2   112    58
   120    37    44   140   153
    82   121    68   127    25
   165    29    51   140    42


d =

    0.1107    0.0752    0.1586    0.0250    0.1124
    0.0695    0.1483    0.1005    0.1260    0.1347
    0.0588    0.0572    0.0838    0.1210    0.0761
    0.1156    0.1455    0.1688    0.0376    0.1256

See also

ang2pix, pix2ang, pix2vec

Requires

ring2nest

Copyright 2010-2011 Lee Samuel Finn. Terms of Use.