Пример #1
0
def test_slice_time_axis(time_intervals):
    axis = TimeMapAxis(time_intervals["t_min"], time_intervals["t_max"],
                       time_intervals["t_ref"])

    new_axis = axis.slice([2, 6, 9])
    squashed = axis.squash()

    assert new_axis.nbin == 3
    assert_allclose(squashed.time_max[0].mjd, 58937.041667)
    assert squashed.nbin == 1
    assert_allclose(squashed.time_max[0].mjd, 58937.041667)
Пример #2
0
def test_slice_squash_time_axis(time_intervals):
    axis = TimeMapAxis(time_intervals["t_min"], time_intervals["t_max"],
                       time_intervals["t_ref"])
    axis_squash = axis.squash()
    axis_slice = axis.slice(slice(1, 5))

    assert axis_squash.nbin == 1
    assert_allclose(axis_squash.time_min[0].mjd, 58927)
    assert_allclose(axis_squash.time_delta.to_value("d"), 10.04166666)
    assert axis_slice.nbin == 4
    assert_allclose(axis_slice.time_delta.to_value("d")[0], 0.04166666666)
    assert axis_squash != axis_slice