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


Python Lightcurve.truncate方法代码示例

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


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

示例1: test_truncate_by_time

# 需要导入模块: from stingray import Lightcurve [as 别名]
# 或者: from stingray.Lightcurve import truncate [as 别名]
    def test_truncate_by_time(self):
        lc = Lightcurve(self.times, self.counts)

        lc1 = lc.truncate(start=1, method='time')
        assert np.all(lc1.time == np.array([1, 2, 3, 4]))
        assert np.all(lc1.counts == np.array([2, 2, 2, 2]))

        lc2 = lc.truncate(stop=3, method='time')
        assert np.all(lc2.time == np.array([1, 2]))
        assert np.all(lc2.counts == np.array([2, 2]))
开发者ID:OrkoHunter,项目名称:stingray,代码行数:12,代码来源:test_lightcurve.py

示例2: test_truncate_by_index

# 需要导入模块: from stingray import Lightcurve [as 别名]
# 或者: from stingray.Lightcurve import truncate [as 别名]
    def test_truncate_by_index(self):
        lc = Lightcurve(self.times, self.counts)

        lc1 = lc.truncate(start=1)
        assert np.all(lc1.time == np.array([2, 3, 4]))
        assert np.all(lc1.counts == np.array([2, 2, 2]))

        lc2 = lc.truncate(stop=2)
        assert np.all(lc2.time == np.array([1, 2]))
        assert np.all(lc2.counts == np.array([2, 2]))
开发者ID:OrkoHunter,项目名称:stingray,代码行数:12,代码来源:test_lightcurve.py

示例3: test_truncate_by_time

# 需要导入模块: from stingray import Lightcurve [as 别名]
# 或者: from stingray.Lightcurve import truncate [as 别名]
    def test_truncate_by_time(self):
        lc = Lightcurve(self.times, self.counts, gti=self.gti)

        lc1 = lc.truncate(start=1, method='time')
        assert np.all(lc1.time == np.array([1, 2, 3, 4]))
        assert np.all(lc1.counts == np.array([2, 2, 2, 2]))
        np.testing.assert_almost_equal(lc1.gti[0][0], 0.5)

        lc2 = lc.truncate(stop=3, method='time')
        assert np.all(lc2.time == np.array([1, 2]))
        assert np.all(lc2.counts == np.array([2, 2]))
        np.testing.assert_almost_equal(lc2.gti[-1][-1], 2.5)
开发者ID:usmanwardag,项目名称:stingray,代码行数:14,代码来源:test_lightcurve.py

示例4: test_truncate_by_index

# 需要导入模块: from stingray import Lightcurve [as 别名]
# 或者: from stingray.Lightcurve import truncate [as 别名]
    def test_truncate_by_index(self):
        lc = Lightcurve(self.times, self.counts, gti=self.gti)

        lc1 = lc.truncate(start=1)
        assert np.all(lc1.time == np.array([2, 3, 4]))
        assert np.all(lc1.counts == np.array([2, 2, 2]))
        np.testing.assert_almost_equal(lc1.gti[0][0], 1.5)
        assert lc1.mjdref == lc.mjdref

        lc2 = lc.truncate(stop=2)
        assert np.all(lc2.time == np.array([1, 2]))
        assert np.all(lc2.counts == np.array([2, 2]))
        np.testing.assert_almost_equal(lc2.gti[-1][-1], 2.5)
        assert lc2.mjdref == lc.mjdref
开发者ID:abigailStev,项目名称:stingray,代码行数:16,代码来源:test_lightcurve.py

示例5: test_truncate_fails_with_incorrect_method

# 需要导入模块: from stingray import Lightcurve [as 别名]
# 或者: from stingray.Lightcurve import truncate [as 别名]
 def test_truncate_fails_with_incorrect_method(self):
     lc = Lightcurve(self.times, self.counts)
     with pytest.raises(ValueError):
         lc1 = lc.truncate(start=1, method="wrong")
开发者ID:abigailStev,项目名称:stingray,代码行数:6,代码来源:test_lightcurve.py

示例6: test_truncate_by_time_stop_less_than_start

# 需要导入模块: from stingray import Lightcurve [as 别名]
# 或者: from stingray.Lightcurve import truncate [as 别名]
    def test_truncate_by_time_stop_less_than_start(self):
        lc = Lightcurve(self.times, self.counts)

        with pytest.raises(ValueError):
            lc1 = lc.truncate(start=2, stop=1, method='time')
开发者ID:abigailStev,项目名称:stingray,代码行数:7,代码来源:test_lightcurve.py

示例7: test_truncate_by_time_stop_less_than_start

# 需要导入模块: from stingray import Lightcurve [as 别名]
# 或者: from stingray.Lightcurve import truncate [as 别名]
    def test_truncate_by_time_stop_less_than_start(self):
        lc = Lightcurve(self.times, self.counts)

        lc1 = lc.truncate(start=2, stop=1, method='time')
开发者ID:crystal95,项目名称:stingray,代码行数:6,代码来源:test_lightcurve.py


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