cds.tools.pixtools
Class PixTools

java.lang.Object
  extended by cds.tools.pixtools.PixTools

public abstract class PixTools
extends java.lang.Object

contains methods translated from HEALPix Fortran90 with increased map resolution in comparison to original Fortran code.

Author:
N Kuropatkin

Constructor Summary
PixTools()
           
 
Method Summary
static long ang2pix_nest(long nside, double theta, double phi)
          renders the pixel number pix (NESTED scheme) for a pixel which contains a point on a sphere at coordinates theta and phi, given map resolution parameter nside.
static long ang2pix_ring(long nside, double theta, double phi)
          renders the pixel number ipix (RING scheme) for a pixel which contains a point with coordinates theta and phi, given the map resolution parameter nside.
static java.lang.Object[] convert_inplace_long(java.lang.String subcall, java.lang.Object[] map)
          converts a 8 byte Object map from RING to NESTED and vice versa in place, ie without allocation a temporary map (Has no reason for Java).
static java.lang.Object[] convert_nest2ring(long nside, java.lang.Object[] map)
          make the conversion NEST to RING
static java.lang.Object[] convert_ring2nest(long nside, java.lang.Object[] map)
          makes the conversion RING to NEST
static long getHealpixMax(int n1, long n, int n2, boolean nside)
           
static long getHealpixMin(int n1, long n, int n2, boolean nside)
           
static java.util.ArrayList getNeighbours(long nside, long ipix)
           
static long GetNSide(double pixsize)
          calculate requared nside given pixel size in arcsec
static java.util.ArrayList InRing(long nside, long iz, double phi0, double dphi, boolean nest)
          returns the list of pixels in RING or NEST scheme with latitude in [phi0 - dpi, phi0 + dphi] on the ring iz in [1, 4*nside -1 ] The pixel id numbers are in [0, 12*nside^2 - 1] the indexing is in RING, unless nest is set to 1
static double[] intrs_intrv(double[] d1, double[] d2)
          computes the intersection di of 2 intervals d1 (= [a1,b1]) and d2 (= [a2,b2]) on the periodic domain (=[A,B] where A and B arbitrary) ni is the resulting number of intervals (0,1, or 2) if a1 b1 then d1 = {x | a1 <=x <= B U A <=x <=b1}
static java.util.ArrayList neighbours_nest(long nside, long ipix)
          returns 7 or 8 neighbours of any pixel in the nested scheme The neighbours are ordered in the following way: First pixel is the one to the south ( the one west of the south direction is taken for pixels that don't have a southern neighbour).
static long nest2ring(long nside, long ipnest)
          converts from NESTED to RING pixel numbering
static long next_in_line_nest(long nside, long ipix)
          calculates the pixel that lies on the East side (and the same latitude) as the given NESTED pixel number - ipix
static long Npix2Nside(long npix)
          returns nside such that npix = 12*nside^2, nside should be power of 2 and smaller than ns_max if not return -1
static long Nside2Npix(long nside)
          calculates npix such that npix = 12*nside^2 ,nside should be a power of 2, and smaller than ns_max otherwise return -1
static double[] pix2ang_nest(double[] res, long nside, long ipix)
           
static double[] pix2ang_nest(long nside, long ipix)
          Renders theta and phi coordinates of the normal pixel center for the pixel number ipix (NESTED scheme) given the map resolution parameter nside.
static double[] pix2ang_ring(long nside, long ipix)
          renders theta and phi coordinates of the nominal pixel center for the pixel number ipix (RING scheme) given the map resolution parameter nside
static double PixRes(long nside)
          calculates angular resolution of the pixel map in arc seconds.
static double[] PolarToRaDec(double[] polar)
          returns ra, dec in degrees given polar coordinates in radians
static double[] PolarToRaDec(double[] polar, double[] radec)
           
static java.util.ArrayList query_strip(long nside, double theta1, double theta2, long nest)
          finds pixels having a colatitude (measured from North pole) : theta1 < colatitude < theta2 with o <= theta1 < theta2 <= Pi if theta2 < theta1 then pixels with 0 <= colatitude < theta2 or theta1 < colatitude < Pi are returned
static double[] RaDecToPolar(double[] radec)
          returns polar coordinates in radians given ra, dec in degrees
static long ring2nest(long nside, long ipring)
          converts pixel number from ring numbering schema to the nested one
static long RingNum(long nside, double z)
          returns the ring number in {1, 4*nside - 1} calculated from z coordinate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PixTools

public PixTools()
Method Detail

query_strip

public static java.util.ArrayList query_strip(long nside,
                                              double theta1,
                                              double theta2,
                                              long nest)
                                       throws java.lang.Exception
finds pixels having a colatitude (measured from North pole) : theta1 < colatitude < theta2 with o <= theta1 < theta2 <= Pi if theta2 < theta1 then pixels with 0 <= colatitude < theta2 or theta1 < colatitude < Pi are returned

Parameters:
nside - long the map resolution parameter
theta1 - lower edge of the colatitude
theta2 - upper edge of the colatitude
nest - long if = 1 result is in NESTED scheme
Returns:
ArrayList of pixel numbers (long)
Throws:
java.lang.Exception
java.lang.IllegalArgumentException

intrs_intrv

public static double[] intrs_intrv(double[] d1,
                                   double[] d2)
computes the intersection di of 2 intervals d1 (= [a1,b1]) and d2 (= [a2,b2]) on the periodic domain (=[A,B] where A and B arbitrary) ni is the resulting number of intervals (0,1, or 2) if a1 b1 then d1 = {x | a1 <=x <= B U A <=x <=b1}

Parameters:
d1 - double[] first interval
d2 - double[] second interval
Returns:
double[] one or two intervals intersections

pix2ang_ring

public static double[] pix2ang_ring(long nside,
                                    long ipix)
renders theta and phi coordinates of the nominal pixel center for the pixel number ipix (RING scheme) given the map resolution parameter nside

Parameters:
nside - long map resolution
ipix - long pixel number
Returns:
double[] theta,phi

ang2pix_ring

public static long ang2pix_ring(long nside,
                                double theta,
                                double phi)
renders the pixel number ipix (RING scheme) for a pixel which contains a point with coordinates theta and phi, given the map resolution parameter nside.

Parameters:
nside - long map resolution parameter
theta - double theta
phi - - double phi
Returns:
long ipix

pix2ang_nest

public static double[] pix2ang_nest(long nside,
                                    long ipix)
Renders theta and phi coordinates of the normal pixel center for the pixel number ipix (NESTED scheme) given the map resolution parameter nside.

Parameters:
nside - map resolution parameter - long
ipix - long pixel number
Returns:
double[] (theta, phi)
Throws:
java.lang.IllegalArgumentException

pix2ang_nest

public static double[] pix2ang_nest(double[] res,
                                    long nside,
                                    long ipix)

ang2pix_nest

public static long ang2pix_nest(long nside,
                                double theta,
                                double phi)
renders the pixel number pix (NESTED scheme) for a pixel which contains a point on a sphere at coordinates theta and phi, given map resolution parameter nside. The computation is made to the highest resolution available and then degraded to requared resolution by integer division. It makes sure that the treatment of roun-off will be consistent for every resolution.

Parameters:
nside - the map resolution parameter
theta - double theta coordinate
phi - double phi coordinate
Returns:
pixel number long
Throws:
java.lang.IllegalArgumentException

convert_nest2ring

public static java.lang.Object[] convert_nest2ring(long nside,
                                                   java.lang.Object[] map)
make the conversion NEST to RING

Parameters:
nside - the map resolution parameter
map - Object[] the map in NESTED scheme
Returns:
- Object[] a map in RING scheme
Throws:
java.lang.IllegalArgumentException

convert_ring2nest

public static java.lang.Object[] convert_ring2nest(long nside,
                                                   java.lang.Object[] map)
makes the conversion RING to NEST

Parameters:
nside - long resolution
map - map in RING
Returns:
map in NEST
Throws:
java.lang.IllegalArgumentException

convert_inplace_long

public static java.lang.Object[] convert_inplace_long(java.lang.String subcall,
                                                      java.lang.Object[] map)
converts a 8 byte Object map from RING to NESTED and vice versa in place, ie without allocation a temporary map (Has no reason for Java). This method is more general but slower than convert_nest2ring. This method is a wrapper for functions ring2nest and nest2ring. Their names are supplied in the subcall argument.

Parameters:
subcall - String name of the method to use.
map - Object[] map
Returns:
resulting Object[] map.
Throws:
java.lang.IllegalArgumentException

neighbours_nest

public static java.util.ArrayList neighbours_nest(long nside,
                                                  long ipix)
returns 7 or 8 neighbours of any pixel in the nested scheme The neighbours are ordered in the following way: First pixel is the one to the south ( the one west of the south direction is taken for pixels that don't have a southern neighbour). From then on the neighbors are ordered in the clockwise direction.

Parameters:
nside - the map resolution
ipix - long pixel number
Returns:
ArrayList
Throws:
java.lang.IllegalArgumentException

InRing

public static java.util.ArrayList InRing(long nside,
                                         long iz,
                                         double phi0,
                                         double dphi,
                                         boolean nest)
returns the list of pixels in RING or NEST scheme with latitude in [phi0 - dpi, phi0 + dphi] on the ring iz in [1, 4*nside -1 ] The pixel id numbers are in [0, 12*nside^2 - 1] the indexing is in RING, unless nest is set to 1

Parameters:
nside - long the map resolution
iz - long ring number
phi0 - double
dphi - double
nest - boolean format flag
Returns:
ArrayList of pixels
Throws:
java.lang.IllegalArgumentException

next_in_line_nest

public static long next_in_line_nest(long nside,
                                     long ipix)
calculates the pixel that lies on the East side (and the same latitude) as the given NESTED pixel number - ipix

Parameters:
nside - long resolution
ipix - long pixel number
Returns:
long next pixel in line
Throws:
java.lang.IllegalArgumentException

ring2nest

public static long ring2nest(long nside,
                             long ipring)
converts pixel number from ring numbering schema to the nested one

Parameters:
nside - long resolution
ipring - long pixel number in ring schema
Returns:
long pixel number in nest schema
Throws:
java.lang.IllegalArgumentException

nest2ring

public static long nest2ring(long nside,
                             long ipnest)
converts from NESTED to RING pixel numbering

Parameters:
nside - long resolution
ipnest - long NEST pixel number
Returns:
ipring long RING pixel number
Throws:
java.lang.IllegalArgumentException

RingNum

public static long RingNum(long nside,
                           double z)
returns the ring number in {1, 4*nside - 1} calculated from z coordinate

Parameters:
nside - long resolution
z - double z coordinate
Returns:
long ring number

Npix2Nside

public static long Npix2Nside(long npix)
returns nside such that npix = 12*nside^2, nside should be power of 2 and smaller than ns_max if not return -1

Parameters:
npix - long the number of pixels in the map
Returns:
long nside the map resolution parameter

Nside2Npix

public static long Nside2Npix(long nside)
calculates npix such that npix = 12*nside^2 ,nside should be a power of 2, and smaller than ns_max otherwise return -1

Parameters:
nside - long the map resolution
Returns:
npix long the number of pixels in the map

PixRes

public static double PixRes(long nside)
calculates angular resolution of the pixel map in arc seconds.

Parameters:
nside -
Returns:
double resolution in arcsec

GetNSide

public static long GetNSide(double pixsize)
calculate requared nside given pixel size in arcsec

Parameters:
pixsize - in arcsec
Returns:
long nside parameter

RaDecToPolar

public static double[] RaDecToPolar(double[] radec)
returns polar coordinates in radians given ra, dec in degrees

Parameters:
radec - double array containing ra,dec in degrees
Returns:
res double array containing theta and phi in radians res[0] = theta res[1] = phi

PolarToRaDec

public static double[] PolarToRaDec(double[] polar)
returns ra, dec in degrees given polar coordinates in radians

Parameters:
polar - double array polar[0] = phi in radians polar[1] = theta in radians
Returns:
double array radec radec[0] = ra in degrees radec[1] = dec in degrees

PolarToRaDec

public static double[] PolarToRaDec(double[] polar,
                                    double[] radec)

getHealpixMax

public static long getHealpixMax(int n1,
                                 long n,
                                 int n2,
                                 boolean nside)

getHealpixMin

public static long getHealpixMin(int n1,
                                 long n,
                                 int n2,
                                 boolean nside)

getNeighbours

public static java.util.ArrayList getNeighbours(long nside,
                                                long ipix)


Copyright © 2009 UDS/CNRS