[lsst-dm-stack-users] image.getArray() question
Chris Walter
chris.walter at duke.edu
Mon Feb 10 13:51:36 PST 2014
Dear Mario and Dustin,
> As Dustin replied, it's to be consistent with numpy. But it's not very
> satisfactory and it's likely it will lead to bugs...
>
> An optimal thing would be to allow the other convention by overloading
> __call__, e.g.:
>
> img(x, y) = blah
>
> but Python syntax doesn't allow calls on the left hand side of an
> assignment, nor slices outside of [] (i.e., you wouldn't be able to
> write "blah = img(1:10, 5:10)" ).
>
> And if we reversed the convention, than all functions or utilities that
> expect a numpy array (many of them!), would require a transpose.
OK, thanks. I understand now. Numpy wants row order for memory access and the convention is that the rows are y. I've been poking around and I see that for example pyfits does the same thing.
Unfortunately, as you say, it may lead to confusion (it did for me..).
-Chris
More information about the dm-users
mailing list