sot / chandra_aca

Chandra Aspect Camera Tools
https://sot.github.io/chandra_aca
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Issues with slicing #168

Closed javierggt closed 7 months ago

javierggt commented 7 months ago

While working on PR #167, I found a few issues with slicing ACAImage:

The following test fails (the commented out lines fail):

def test_slice_2():
    # if the index is negative, the returned image pixels are fine, but row0/col0 are wrong  
    assert np.all(img[-1, :] == im8[-1, :])
    # assert img[-1, :].row0 == img[7 , :].row0  # FAILS
    assert img[-1, :].col0 == col0

    # These two were surprising. Either they should out-of-bounds, or the commented out lines should pass
    row0 = 11
    col0 = 22
    img = ACAImage(im8, row0=11, col0=22)
    img2 = img.aca[row0 - 1, :]
    assert np.all(img2 == im8[-1, :])
    # assert img2.row0 == row0 + 7  # FAILS
    assert img2.col0 == col0
    img2 = img.aca[:, col0 - 2]
    assert np.all(img2 == im8[:, -2])
    assert img2.row0 == row0
    # assert img2.col0 == col0 + 6  # FAILS