我正试图将CATALOG.FIT转换成适合于治疗的图像。我能够阅读fits目录,并将ra和dec转换为θ和phi。但是当我使用ang2pix时,它会抛出一个错误“
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])绝不能发生
在抛出“PlanckError”中止实例后调用终止
-------------------
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)如果有人也面临类似的问题,请回复。
谢谢
费萨尔
发布于 2012-09-18 01:39:27
发现问题时,theta被定义在0到pi之间,如果给ang2pix一个负值,它就会失败。
我将添加一个更有意义的错误消息到healpy源代码。
https://stackoverflow.com/questions/12468796
复制相似问题