【问题标题】:How to convert and save healpy map to different coordinate system?如何将healpy地图转换并保存到不同的坐标系?
【发布时间】:2017-06-08 18:52:20
【问题描述】:

我有一张带有银河坐标的 healpix 地图。我想将该地图转换为赤道坐标系。我知道我可以使用 mollview() 函数在赤道坐标中绘制地图。你有什么办法可以保存这种转换后的地图吗?

谢谢 维努

【问题讨论】:

    标签: python healpy


    【解决方案1】:

    以下函数改变地图的坐标系。

    def change_coord(m, coord):
        """ Change coordinates of a HEALPIX map
    
        Parameters
        ----------
        m : map or array of maps
          map(s) to be rotated
        coord : sequence of two character
          First character is the coordinate system of m, second character
          is the coordinate system of the output map. As in HEALPIX, allowed
          coordinate systems are 'G' (galactic), 'E' (ecliptic) or 'C' (equatorial)
    
        Example
        -------
        The following rotate m from galactic to equatorial coordinates.
        Notice that m can contain both temperature and polarization.
        >>>> change_coord(m, ['G', 'C'])
        """
        # Basic HEALPix parameters
        npix = m.shape[-1]
        nside = hp.npix2nside(npix)
        ang = hp.pix2ang(nside, np.arange(npix))
    
        # Select the coordinate transformation
        rot = hp.Rotator(coord=reversed(coord))
    
        # Convert the coordinates
        new_ang = rot(*ang)
        new_pix = hp.ang2pix(nside, *new_ang)
    
        return m[..., new_pix]
    

    例子就是你的情况

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-22
      • 1970-01-01
      相关资源
      最近更新 更多