1

I am trying to convert CATALOG.FIT into healpix fits image. I am able to read fits catalog and convert ra and dec into theta and phi. But when I use ang2pix, it throws an error"

 Error encountered at /home/faisal/healpy/healpy-healpy-aa5f605/hpbeta  
 /Healpix_cxx/healpix_base.cc, line 829
 (function I T_Healpix_Base<I>::loc2pix(double, double, double, bool) const [with I = 
 long int])

must not happen

terminate called after throwing an instance of 'PlanckError' Abort

-------------------
import numpy as np

import string as s

from scipy.interpolate import interp1d

import matplotlib.pyplot as plt

import healpy as hp

from numpy import sin, cos, arccos, arcsin, arctan2

import astro_util as au


#start healpy---------------------------



nvss_ra=np.arange(1,100,1) 

nvss_dec=np.arange(1,100,1)

print nvss_ra

theta,phi= au.euler(nvss_ra,nvss_dec,1)

print theta

theta1=theta/(57.3248)

phi1=phi/(57.3248)+((3.14159265359)/2)

nvssmap=np.zeros(hp.nside2npix(512))

#Working till this point

pix=hp.pixelfunc.ang2pix(512,theta1, phi1)




nvssmap[pix]=1

hp.fitsfunc.write_map("nvss_map.fits",nvssmap)

Please reply if someone also faced the similar problem.

Thanks

Faisal

4

1 回答 1

0

发现问题,theta定义在 0 和 pi 之间,如果你给ang2pix一个负值,它会失败并出现该错误。

我将在 healpy 源代码中添加更有意义的错误消息。

于 2012-09-18T01:39:27.290 回答