[AstroPy] PyFits too slow

Jose Miguel Ibáñez ppmime@gmail....
Fri Jun 26 04:35:09 CDT 2009


Hello !

I am trying to iterate through the pixels  of  an FITS image read previusly
with PyFits,
but it is too slow (more that 1CPU minute), so my question is if is there
any other way to do that in a
more efficient/fast  way.

That's the code I'm using:
------------------------------------------------------------------
f=pyfits.open('/tmp/c1.fits',memmap=1)
b=numpy.zeros([2048,2048],dtype='float32')
cdata=f[0].data.copy()
f.close()
print 'start loop...'
for i in range(0,2048):
    for j in range(0,2048):
        if cdata[i,j]<1 or cdata[i,j]>100000:
            b[i,j]=1


----------------------------------------------------------------

Any idea ?

Thanks very much,
JM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/astropy/attachments/20090626/09afe19e/attachment.html 


More information about the AstroPy mailing list