Question: Why is io.fits convenience 'getdata' much faster than fits.open()?
See original GitHub issue>>> import sys
>>> print(sys.version)
2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:05:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
>>> import astropy
>>> astropy.__version__
u'2.0.dev17848'
>>> import timeit
>>> timeit.timeit("h=fits.open('jcdua3f4q_flc.fits'); d=h[3].data; h.close()",
... setup="from astropy.io import fits", number=1000)
22.351375102996826
>>> timeit.timeit("d=fits.getdata('jcdua3f4q_flc.fits', ext=3)",
... setup="from astropy.io import fits", number=1000)
8.482270956039429
How is this possible and what can be done to make “regular” fits.io
operations as fast as “convenience” functions?
Issue Analytics
- State:
- Created 6 years ago
- Comments:22 (22 by maintainers)
Top Results From Across the Web
astropy.io.fits FAQ
Why is fitsio so much faster than astropy at reading tables? ... astropy.io.fits.open has an option to access the data portion of an...
Read more >FITS File handling (astropy.io.fits)
The open() function supports a memmap=True argument that allows the array data of each HDU to be accessed with mmap, rather than being...
Read more >astropy.io.fits read row from large fits file with mutliple HDUs
This code works well and fast for fits files up to ~20 GB, but runs out of memory for bigger ones (larger files...
Read more >pyfits 3.4 - PyPI
This brings PyFITS mostly to parity with the version of astropy.io.fits that ... allowing more than 4 GB of variable-length array data in...
Read more >lecture-3---numerical-manipulation-ii.pdf - Mubdi Rahman
At some point, you need to do more than ... Convenience functions make reading FITS images easy: ... img1 = fits.getdata(filename) # Getting...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The explanation is in a comment in
getheader
: https://github.com/astropy/astropy/blob/master/astropy/io/fits/convenience.py#L115In fairness, they’re just as slow as they always were 😉