[AstroPy] slicing

Stefano Covino stefano.covino at brera.inaf.it
Thu Feb 11 06:52:38 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 ). 

Hi Tom, Paul,

thanks for your replies.

I guess I was quite unclear, or the solution is really simple and I haven’t got it in the documentations. So, please my apologies for that.

My problem, however, is how to avoid to loop on the components of the integer arrays aa and bb.

Something like:

for i,l in zip(aa,bb):	
	datf = dat[l-size:l+size,i-size:i+size]

of course works, only it is slow.

I just wondered if there is a quicker method. In case I am not looking for a slice, but just at the value at pixel location (aa,bb) something like:

datf = dat[bb,aa]

works fine, giving me an array of values, as expected.

Sorry again if the question is trivial.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20160211/a5a9d2c3/attachment.html>

More information about the AstroPy mailing list