Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some confusion working in absolute coordinates in ACAImage #39

Open
jeanconn opened this issue Aug 30, 2017 · 2 comments
Open

Some confusion working in absolute coordinates in ACAImage #39

jeanconn opened this issue Aug 30, 2017 · 2 comments
Labels

Comments

@jeanconn
Copy link
Contributor

Reviewing the docs:

>>> from chandra_aca.aca_image import ACAImage
>>> im4 = np.arange(16).reshape(4, 4)
>>> a = ACAImage(im4, row0=10, col0=20) 
>>> a
<ACAImage row0=10 col0=20
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11],
       [12, 13, 14, 15]])>
>>> a[3, 3]
15
>>> a.aca[13, 23]
15

That's fine. Here's where I get a little confused:

In [90]: a.aca[13, 16]
Out[90]: 12
In [91]: a.aca[13, 20]
Out[91]: 12
In [92]: a.aca[9, 16]
Out[92]: 12

It seems like these mappings back into the original array aren't quite absolute? I expect an error somewhere here.

@jeanconn
Copy link
Contributor Author

Ah, I think I get it... the aca_coords are subtracting off row0, col0, so my examples are just benefiting from negative indexing back in to the original array. It might be good to check the bounds on the aca coordinates of the ACAImage in question and throw an error instead of allowing the negative indexing.

@taldcroft
Copy link
Member

Agreed an exception for out-of-bounds absolute indexing makes sense. Not sure if practical issues will come up (performance or other cases like slicing that goes out of bounds).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants