H3C HEALPix library for PostgreSQL  (version 1.2)
Installation guide
H3C
-------------------------------------------------------------------------------
ABOUT
G.Landais (CDS) : HEALPix library inspired from Q3C (Sergey Koposov)
-------------------------------------------------------------------------------
PREREQUISITES
To work with H3C you need to have PostgreSQL database installed (version 8.1
or later). For the installation of PostgreSQL refer to the PostgreSQL manual.
Then, you have to download the 64bits library of the Nasa and install
the C and C++ library.
Attention!! -fPIC option had to be set during the Nasa-Healpix compilation
(if not set, export CFLAGS=-fPIC ;export CPPFLAGS=-fPIC)
You can download a version here: http://sourceforge.net/projects/healpix/
(see NOTE (*) below)
-------------------------------------------------------------------------------
INSTALLATION
1) ./configure [options]
2) make init; make
3) make install
4) in PostgreSQL shell:
create extension cds_h3c;
COMPILATION PARAMETERS (configure):
--with-HEALPix64 Use the 64bits HEALPix library (Nasa)
[default=yes]
--with-HEALPix-lib Path to the HEALPix library (libhealpix_cxx.a)
--with-HEALPix-include Path to the HEALPix include (healpix_base.h ..)
--with-HEALPix-src (32bits only) path containing the sources
--with-fitsio Fitsio home directory [default=/usr]
--with-long-double Use long double [default NO]
--with-as4-include libas4 library (CDS) to use box function
(the include directory)
--with-as4-lib libas4 library (CDS) to use box function
(the directory where is located the library)
COMPILATION PARAMETERS (Makefile)
MUTE=-D_H3C_MUTE to be in a mute mode (only errors)
LIMIT_POLYGONE_ORDER_x (x=0,1,2) limit in degree to decrease the HEALPix order
LIMIT_CIRCLE_ORDER_x (x=0,..,4) limit in degree to decrease the HEALPix order
NOTE(*):the default nside is H3C_DEFAULT_NSIDE = 32768 (order=15)
For efficiency, working with order 15 needs to use a particular
version of the 64bits library of the Nasa.
If you don't have it, use the --with-HEALPix64=no
of the configure options.
Then, change the order default value with adding -DH3C_DEFAULT_NSIDE=xxx
(xxx=nside value, <= 8192) in the Makefile (OPT=....)
-------------------------------------------------------------------------------
PREPARATION OF TABLES before using H3C
Index the tables using H3C:
CREATE INDEX idx_name ON table (h3c_ang2ipix(ra,de));
-------------------------------------------------------------------------------
EXAMPLES OF USAGE
/* HEALPix cell on ra=0, de=0 using the default nside */
SELECT h3c_ang2ipix(0,0);
/* HEALPix cell on ra=0, de=0 using nside=8192 */
SELECT h3c_ang2ipix(0,0,8192);
/* cone search arround ra=0, de=0 with radius=2arcmin */
SELECT ra,de FROM table WHERE h3c_radial_query(ra,de,0,0,2/60.);
/* Crossmatch table1 & table2 using the positions */
SELECT table1.ra,table1.de FROM table1, table2 WHERE h3c_join(table1.ra,table1.de,table2.ra,table2.de,2/3600.);