[SciPy-User] Can I get the "rings" of a 2D array?

Jeremy Conlin jlconlin at gmail.com
Mon Apr 12 22:23:00 EDT 2010


On Mon, Apr 12, 2010 at 5:16 PM, Charles R Harris
<charlesr.harris at gmail.com> wrote:
>
>
> On Mon, Apr 12, 2010 at 4:55 PM, Jeremy Conlin <jlconlin at gmail.com> wrote:
>>
>> I need to get the "rings" of a 2D array; i.e. the first ring would be
>> the first and last column in addition to the first and last row, the
>> second ring would be the second and second-from-last row and the
>> second and second-from-last column---except for what is not in the
>> first ring.  Is there a way to slice an array to get this data?
>>
>
> So will the rings be different sizes or all the same size with the other
> elements zeroed?

Good question.  The better option would be to keep the size of the
array the same and zero all the other elements.

Jeremy



More information about the SciPy-User mailing list