[lsst-dm-stack-users] Changes to make sub-images less clunky

Dustin Lang dstn at cmu.edu
Tue Jan 29 17:07:28 PST 2013


FWIW, [y,x] is definitely the way of least surprise to numpy users and is the 
order I would endorse.  It's consistent with [row,column] addressing of 
matrices.


On Tue, 29 Jan 2013, Mario Juric wrote:

> On 1/29/13 15:48 , Paul Price wrote:
>> You can also get a numpy array from an Image by:
>>
>>     a = im.getArray()
>>
>> and then you can do:
>>
>>     a[:,12:15] = -1
>>
>> *** Note that numpy indices are [y,x], while Robert's new direct
>> Python slicing of an Image uses [x,y].  The way I remember this is
>> that numpy is operating directly on the in-memory representation
>> (which is accessed y,x, as usual in C), while Robert's slicing makes
>> things a bit nicer, and so is x,y as is usual in math and English.
>
> "I felt a great disturbance in the Force, as if millions of voices
> suddenly cried out in terror..."
>
> This is bound to lead to bugs. And hard to find ones, at that... Hmmm...
>



More information about the dm-users mailing list