some python resources
python tutorial:
http://docs.python.org/tutorial/
numpy tutorial [arrays]:
http://www.scipy.org/Tentative_NumPy_Tutorial
plotting tutorial:
http://matplotlib.sourceforge.net/users/pyplot_tutorial.html
free online books:
http://diveintopython.org/toc/index.html
http://www.ibiblio.org/swaroopch/byteofpython/read/
install enthought python:
http://www.enthought.com/products/edudownload.php
video tut:
Filed under: python | Leave a Comment
Tags: python
cfitsio wrapper in python
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.
Filed under: numpy, python | Leave a Comment
unit testing happiness
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
Filed under: python | Leave a Comment
Vim regular expressions
very good reference of the usage of regular expressions in VIM:
http://www.softpanorama.org/Editors/Vimorama/vim_regular_expressions.shtml
Filed under: linux | Leave a Comment
set python logging level
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
Filed under: python | Leave a Comment
pyfits memory leak in new_table
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’
Filed under: astrophysics, python | 1 Comment
git branch --set-upstream master origin/master
you obtain the same result as initial cloning
Filed under: git | Leave a Comment
memory map npy files
Mem-map the stored array, and then access the second row directly from disk:
X = np.load('/tmp/123.npy', mmap_mode='r')
Filed under: numpy, python | Leave a Comment
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
Filed under: python | Leave a Comment
Recent Entries
- some python resources
- cfitsio wrapper in python
- unit testing happiness
- Pink noise (1/f noise) simulations in numpy
- Vim regular expressions
- set python logging level
- pyfits memory leak in new_table
- git make local branch tracking origin
- memory map npy files
- force local install of python module
- gnome alt f2 popup launcher
Categories
- astrophysics (4)
- bash (7)
- general physics (1)
- git (1)
- italian (2)
- linux (20)
- numpy (5)
- parallel programming (2)
- physics (9)
- python (17)
- ubuntu (4)
