After several issues with pyfits, and tired of it being so overengineered, I’ve wrote my own fits I/O package in python, wrapping the C library cfitsio with ctypes.

Pretty easy, first version completely developed in 1 day.

https://github.com/zonca/pycfitsio


nosetests -v
test_all_cols (pycfitsio.test.TestPyCfitsIoRead) ... ok
test_colnames (pycfitsio.test.TestPyCfitsIoRead) ... ok
test_move (pycfitsio.test.TestPyCfitsIoRead) ... ok
test_open_file (pycfitsio.test.TestPyCfitsIoRead) ... ok
test_read_col (pycfitsio.test.TestPyCfitsIoRead) ... ok
test_read_hdus (pycfitsio.test.TestPyCfitsIoRead) ... ok
test_create (pycfitsio.test.TestPyCfitsIoWrite) ... ok
test_write (pycfitsio.test.TestPyCfitsIoWrite) ... ok

----------------------------------------------------------------------
Ran 8 tests in 0.016s

OK


very good reference of the usage of regular expressions in VIM:

http://www.softpanorama.org/Editors/Vimorama/vim_regular_expressions.shtml


often using logging.basicConfig is useless because if the logging module is already configured upfront by one of the imported libraries this is ignored.

The solution is to set the level directly in the root logger:
logging.root.level = logging.DEBUG


I found a memory leakage issue in pyfits.new_table, data were NOT deleted when the table was deleted, I prepared a test on github, using objgraph, which shows that data are still in memory:
Continue reading ‘pyfits memory leak in new_table’


git branch --set-upstream master origin/master

you obtain the same result as initial cloning


Mem-map the stored array, and then access the second row directly from disk:

X = np.load('/tmp/123.npy', mmap_mode='r')


python setup.py install --prefix FOLDER

creates lib/python2.6/site-packages, to force a local install you should use:

python setup.py install --install-lib FOLDER




Follow

Get every new post delivered to your Inbox.