def test_get_ranges():
    test_subject = PixelCutoutHDU([(1, 200), (305, 600)])
    ranges = test_subject.get_ranges()
    assert ranges == [(1, 200), (305, 600)], 'Wrong ranges output.'

    test_subject = PixelCutoutHDU([(10, 20), (30)])
    ranges = test_subject.get_ranges()
    assert ranges == [(10, 20), (30, 30)], 'Wrong ranges output.'
Beispiel #2
0
def test_extract():
    data_shape = (9, 4)
    data = np.arange(36).reshape(data_shape)
    test_subject = CutoutND(data)
    cutout_region = PixelCutoutHDU([(4, 18)])
    cutout = test_subject.extract(cutout_region.get_ranges())
    expected_data = np.array([[3], [7], [11], [15], [19], [23], [27], [31],
                              [35]])
    np.testing.assert_array_equal(expected_data, cutout.data,
                                  'Arrays do not match.')