当前位置: 首页>>代码示例>>Python>>正文


Python ICRS.transpose方法代码示例

本文整理汇总了Python中astropy.coordinates.builtin_frames.ICRS.transpose方法的典型用法代码示例。如果您正苦于以下问题:Python ICRS.transpose方法的具体用法?Python ICRS.transpose怎么用?Python ICRS.transpose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在astropy.coordinates.builtin_frames.ICRS的用法示例。


在下文中一共展示了ICRS.transpose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestManipulation

# 需要导入模块: from astropy.coordinates.builtin_frames import ICRS [as 别名]
# 或者: from astropy.coordinates.builtin_frames.ICRS import transpose [as 别名]

#.........这里部分代码省略.........
        assert not np.may_share_memory(s3_ravel.obsgeoloc.x,
                                       self.s3.obsgeoloc.x)
        sc_ravel = self.sc.ravel()
        assert sc_ravel.shape == (self.sc.size,)
        assert np.all(sc_ravel.data.lon == self.sc.data.lon.ravel())
        assert not np.may_share_memory(sc_ravel.data.lat, self.sc.data.lat)
        assert np.all(sc_ravel.obstime == self.sc.obstime.ravel())
        assert not np.may_share_memory(sc_ravel.obstime.jd1,
                                       self.sc.obstime.jd1)
        assert np.all(sc_ravel.obsgeoloc.xyz == self.sc.obsgeoloc.ravel().xyz)
        assert not np.may_share_memory(sc_ravel.obsgeoloc.x,
                                       self.sc.obsgeoloc.x)

    def test_flatten(self):
        s0_flatten = self.s0.flatten()
        assert s0_flatten.shape == (self.s0.size,)
        assert np.all(s0_flatten.data.lon == self.s0.data.lon.flatten())
        # Flatten always copies.
        assert not np.may_share_memory(s0_flatten.data.lat, self.s0.data.lat)
        s1_flatten = self.s1.flatten()
        assert s1_flatten.shape == (self.s1.size,)
        assert np.all(s1_flatten.data.lat == self.s1.data.lat.flatten())
        assert not np.may_share_memory(s1_flatten.data.lon, self.s1.data.lat)
        assert np.all(s1_flatten.obstime == self.s1.obstime.flatten())
        assert not np.may_share_memory(s1_flatten.obstime.jd1,
                                       self.s1.obstime.jd1)
        assert np.all(s1_flatten.location == self.s1.location.flatten())
        assert not np.may_share_memory(s1_flatten.location, self.s1.location)
        assert np.all(s1_flatten.temperature == self.s1.temperature.flatten())
        assert not np.may_share_memory(s1_flatten.temperature,
                                       self.s1.temperature)
        assert s1_flatten.pressure == self.s1.pressure

    def test_transpose(self):
        s0_transpose = self.s0.transpose()
        assert s0_transpose.shape == (7, 6)
        assert np.all(s0_transpose.data.lon == self.s0.data.lon.transpose())
        assert np.may_share_memory(s0_transpose.data.lat, self.s0.data.lat)
        s1_transpose = self.s1.transpose()
        assert s1_transpose.shape == (7, 6)
        assert np.all(s1_transpose.data.lat == self.s1.data.lat.transpose())
        assert np.may_share_memory(s1_transpose.data.lon, self.s1.data.lon)
        assert np.all(s1_transpose.obstime == self.s1.obstime.transpose())
        assert np.may_share_memory(s1_transpose.obstime.jd1,
                                   self.s1.obstime.jd1)
        assert np.all(s1_transpose.location == self.s1.location.transpose())
        assert np.may_share_memory(s1_transpose.location, self.s1.location)
        assert np.all(s1_transpose.temperature ==
                      self.s1.temperature.transpose())
        assert np.may_share_memory(s1_transpose.temperature,
                                   self.s1.temperature)
        assert s1_transpose.pressure == self.s1.pressure
        # Only one check on T, since it just calls transpose anyway.
        s1_T = self.s1.T
        assert s1_T.shape == (7, 6)
        assert np.all(s1_T.temperature == self.s1.temperature.T)
        assert np.may_share_memory(s1_T.location, self.s1.location)

    def test_diagonal(self):
        s0_diagonal = self.s0.diagonal()
        assert s0_diagonal.shape == (6,)
        assert np.all(s0_diagonal.data.lat == self.s0.data.lat.diagonal())
        assert np.may_share_memory(s0_diagonal.data.lat, self.s0.data.lat)

    def test_swapaxes(self):
        s1_swapaxes = self.s1.swapaxes(0, 1)
开发者ID:Cadair,项目名称:astropy,代码行数:70,代码来源:test_shape_manipulation.py


注:本文中的astropy.coordinates.builtin_frames.ICRS.transpose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。