install Polspice

Installed PolSpice v03-06-08 (version on 2020-05-26), but failed with PolSpice v03-06-09 (version on 2020-09-22) (Installation succeeded, but failed to run.)

Install Healpix 3.70

$ ./configure
$ make

Install cfitsio 3.49

$ ./configure –prefix=/home/htanimur/lib/cfitsio/3490
$ make
$ make install

– Add library in LD_LIBRARY_PATH (in .bashrc)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/lib/cfitsio/3490/lib:${HOME}/lib/Healpix/3.70/lib

Install PolSpice

$ cd src
$ cp Makefile_template Makefile

– Set Healpix environment (in .bashrc)
export HEALPIX=${HOME}/lib/Healpix/3.70/
export HEALPIXDATA=${HOME}/lib/Healpix/3.70/data/

– Edit Makefile
USEPKGCONFIG := 0 # 1 if there is $HEALPIX/lib/pkgconfig/healpix.pc
FC = gfortran
CC = gcc
FITSLIB = /home/htanimur/lib/cfitsio/3490/lib

$ make
(It will make spice in ../bin directory.)

– Add environment in .bashrc
export PATH=$PATH:${HOME}/lib/PolSpice/bin
export SPICE_DIR=${HOME}/lib/PolSpice/bin
export PYTHONPATH=$SPICE_DIR:$PYTHONPATH
export PATH=$PATH:$SPICE_DIR

– Test code

—————————————————–
import sys
import ispice as isp
from astropy.io import fits
import matplotlib.pyplot as plt

lmax = 256
input_cl = np.ones(lmax + 1)
np.random.seed(1000)
input_map = hp.synfast(input_cl, nside=256, pixwin=True)
hp.write_map(‘input.fits’, input_map, overwrite=True)

isp.ispice(‘input.fits’, clout=’clout.fits’, nlmax=lmax)

f1 = fits.open(‘clout.fits’)
cl = f1[1].data

plt.figure(figsize=(10,7))
plt.plot(cl)
plt.plot(input_cl, color=”red”, linewidth=3)
plt.xlim([0, lmax+1])
plt.xlabel(“$\ell$”)
plt.ylabel(“$C_\ell$”)
plt.show()

Ref: https://github.com/zonca/python_spice
—————————————————–

Leave a comment