本文整理汇总了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]))
示例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]))
示例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)
示例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
示例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")
示例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')
示例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')