Skip to main content
 首页 » 编程设计

python之使用 `healpy` : Why does the output map appear "patchy" 平滑 HEALPix 贴图

2024年10月24日24haluo1

我有一张 HEALPix 全天 map ,来自 AKARI Far Infrared Surveyor 数据库(公开发布)。我尝试使用 healpy 来“平滑” map ,但结果看起来很奇怪。有没有更好的办法?然而,我的问题与任何全天空 HEALPix map (即 IRAS、Planck、WISE、WMAP)有关。

我的目标是将此 AKARI map 的有效点扩散函数“平滑”到 1 度的角分辨率(原始数据的 PSF 约为 1 角分)。这样我就可以将远红外 AKARI map 与分辨率较低的微波 map (特别是那些异常微波前景)进行比较。

在我下面的例子中,我使用了 map 的降级版本,所以它足够小可以上传到 Github。这意味着像素约为 3.42 弧分。通常情况下,在 PSF 平滑之前,我不会将像素比例降低太多——但这只是一个例子:

#Load the packages needed for visualization, and HEALPix processing 
%matplotlib inline 
import matplotlib 
import numpy as np 
import matplotlib.pyplot as plt 
import healpy as hp 
import healpy.projector as pro 
 
#Loads the HEALPix .FITS file into an array 
map_in = hp.read_map("akari_WideL_1_1024.fits", nest = True) 
 
#Visualizes the all-sky map, before any processing is done. 
hp.mollview(map_in, title='AKARI All-Sky Map:', nest = True, norm = 'hist') 
 
#Smoothes the map with a 1-degree FWHM Gaussian (fwhm given in radians). 
map_out = hp.sphtfunc.smoothing(map_out, fwhm = 0.017, iter = 1) 
 
#Visualizes the the map after smoothing 
hp.mollview(map_out, title='AKARI All-Sky Map:', nest = True, norm = 'hist') 

我已经尝试过 healpy.sphtfunct.smoothing 例程(https://healpy.readthedocs.org/en/latest/generated/healpy.sphtfunc.smoothing.html#healpy.sphtfunc.smoothing).As 据我所知,smoothing 将贴图转换为球谐函数,然后与高斯卷积,然后将其转换回空间图。

我已将 ipython 笔记本和低分辨率 .FITS HEALpix map 保存在 github 存储库中,此处:

https://github.com/aaroncnb/healpy_smoothing_test

(你需要安装healpy包)

通过在 notebook 中运行代码,您可以很容易地想象出我遇到的问题 - 在平滑 map 之后,有一些奇怪的“伪像”,就好像像素已经被迭代框平均,而不是平滑圆形高斯轮廓。我希望看到的只是输入 map 的模糊版本。

我认为在平滑完成之前,我遗漏了一些关于转换为球谐函数的基本知识。

以前有人尝试过在 HEALPix map 上进行这种全天空平滑吗?

我相信另一种选择是将 map 转换为标准的矩形阵列,然后进行平滑处理。但是,我仍然对在不离开 HEALPix 格式的情况下解决问题感到好奇。

请您参考如下方法:

smoothing 似乎只适用于 RINGed map (这对我来说有点意义,因为这在数学上似乎更容易处理)。因此,您需要将输入映射转换为 RINGed 格式:

map_ring = hp.pixelfunc.reorder(map_in, inp='NEST', out='RING') 
map_out = hp.sphtfunc.smoothing(map_ring, fwhm = 0.17, iter = 1) 
hp.mollview(map_out, title='AKARI All-Sky Map:', nest = False, norm = 'hist') 


这个答案来自一些反复试验,因为我在文档中找不到任何确定的东西,而且我没有深入研究源代码(不过,根据以下结果,可能很容易验证是否通过查看相关源代码,我的假设是正确的。
或者,您可能想直接询问 healpix/healpy 人员。

(我认为这实际上是文档中的一个缺点:healpy.sphtfunc.smoothing 的文档没有提及输入所需的形式。我想这是一个有益的问题/改天公关。)

顺便说一句,在 Github 上创建 SSCCE 作为笔记本文件的奖励积分! (现在要是 StackOverflow 也能渲染笔记本就好了。)