DarkEnergySurvey / ugali

Ultra-faint galaxy likelihood toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Move to fitsio

kadrlica opened this issue · comments

I've found fitsio to be superior to pyfits. In addition, astropy has taken over pyfits, which is now accessed as astropy.io.fits. I'd like to switch to fitsio, or abstract the interface to the fits reader so the user can use whatever is available on their system (fitsio > astropy.io.fits > pyfits).

I did some timing for an issue on healpy and found that fitsio is significantly faster (~4x) for loadinghealpy formatted, gzipped files:

>>> %timeit hp.read_map('tmp.fits.gz',dtype=int,verbose=False)
1 loops, best of 3: 32.7 s per loop

>>> %timeit pyfits.open('tmp.fits.gz')[1].data['I'].ravel()
1 loops, best of 3: 20.6 s per loop

>>> %timeit fitsio.read('tmp.fits.gz',ext=1)['I'].ravel()
1 loops, best of 3: 7.98 s per loop

I've implemented a fitsio version of read_map in 353581a.

With the exception of the scratch directory, I think this migration is complete. I'll double check and get this into v1.8.0.