本文整理汇总了Python中stingray.Lightcurve.sort方法的典型用法代码示例。如果您正苦于以下问题:Python Lightcurve.sort方法的具体用法?Python Lightcurve.sort怎么用?Python Lightcurve.sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stingray.Lightcurve
的用法示例。
在下文中一共展示了Lightcurve.sort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_sort
# 需要导入模块: from stingray import Lightcurve [as 别名]
# 或者: from stingray.Lightcurve import sort [as 别名]
def test_sort(self):
_times = [1, 2, 3, 4]
_counts = [40, 10, 20, 5]
lc = Lightcurve(_times, _counts)
lc.sort()
assert np.all(lc.counts == np.array([ 5, 10, 20, 40]))
assert np.all(lc.time == np.array([4, 2, 3, 1]))
lc.sort(reverse=True)
assert np.all(lc.counts == np.array([40, 20, 10, 5]))
assert np.all(lc.time == np.array([1, 3, 2, 4]))
示例2: test_sort
# 需要导入模块: from stingray import Lightcurve [as 别名]
# 或者: from stingray.Lightcurve import sort [as 别名]
def test_sort(self):
_times = [2, 1, 3, 4]
_counts = [40, 10, 20, 5]
lc = Lightcurve(_times, _counts, mjdref=57000)
mjdref = lc.mjdref
lc_new = lc.sort()
assert np.all(lc_new.counts == np.array([10, 40, 20, 5]))
assert np.all(lc_new.time == np.array([1, 2, 3, 4]))
assert lc_new.mjdref == mjdref
lc_new = lc.sort(reverse=True)
assert np.all(lc_new.counts == np.array([5, 20, 40, 10]))
assert np.all(lc_new.time == np.array([4, 3, 2, 1]))
assert lc_new.mjdref == mjdref