sot / chandra_aca

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

Ellipsis is not supported in aca_image.ACAImage.__getitem__ #165

Closed javierggt closed 7 months ago

javierggt commented 8 months ago

The following code:

from chandra_aca import aca_image
img = aca_image.ACAImage(np.random.uniform(size=(8, 8)))
img[-1,...]

Gives the following error:

TypeError: unsupported operand type(s) for +: 'int' and 'ellipsis'

This can be reproduced with the current ska3-flight version (chandra_aca 4.44.0) although it has caused no issues up to now. In Ska3 Speedy it started causing an error when an image got passed to np.percentile. In other words, the following code gives an exception in Speedy but works in 2023.9:

np.percentile(img, 50)

NOTE

While checking this issue, I realized that ACAImage displays entries as integers, but internally uses floats, andnp.percentile is applied to the float array, which gives a different result as an integer array.