[AstroPy] slicing

Paul Kuin npkuin at gmail.com
Thu Feb 11 06:45:41 EST 2016


I had this problem and ended up converting the indices to integers by
rounding to the nearest (and making sure there we no NaNs ).

On Thu, Feb 11, 2016 at 11:39 AM, Aldcroft, Thomas <
aldcroft at head.cfa.harvard.edu> wrote:

>
>
> On Thu, Feb 11, 2016 at 5:42 AM, Stefano Covino <
> stefano.covino at brera.inaf.it> wrote:
>
>> Dear friends,
>>
>> let’s assume we have a data array read from a FITS file:
>>
>> data = getdata(‘file.fits’)
>>
>> I need to do some computations on a subset of it, for instance:
>>
>> datf = dat[bb-size:bb+size,aa-size:aa+size]
>>
>> where aa and bb are x,y positions and size a fixed number (e.g. 10).
>>
>>
>>
>> So, the question. Is it possible that aa and bb are not simple integers
>> but lists or arrays of integers?
>>
>
> Hi Stefano,
>
> You can get a good idea of what is possible with array indexing by
> starting with the numpy documentation:
>
>   http://docs.scipy.org/doc/numpy-1.10.1/user/basics.indexing.html
>
> - Tom
>
>
>>
>>
>> Thanks,
>>         Stefano
>> _______________________________________________
>> AstroPy mailing list
>> AstroPy at scipy.org
>> https://mail.scipy.org/mailman/listinfo/astropy
>>
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy
>
>


-- 

* * * * * * * * http://www.mssl.ucl.ac.uk/~npmk/ * * * *
Dr. N.P.M. Kuin      (n.kuin at ucl.ac.uk)
phone +44-(0)1483 (prefix) -204211 (work)
mobile +44(0)7806985366  skype ID: npkuin
Mullard Space Science Laboratory  – University College London  –
Holmbury St Mary – Dorking – Surrey RH5 6NT–  U.K.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20160211/8419d213/attachment.html>


More information about the AstroPy mailing list