Surveying the Universe
Python, FITS and DS9
Here’s an easy way to display FITS images (or any array) in DS9 using Python (with PyFITS, NumPy and Numdisplay, which is part of stsci_python). First launch DS9, then in Python:
import numdisplay import pyfits arr = pyfits.getdata('file.fits') numdisplay.display(arr)
Easy!
Alternatively, the Kapteyn package seems excellent, and uses Python’s matplotlib for displaying images. It requires WCSLIB to run, though, so the installation process is a bit longer.
A third option is to use python-sao:
import pysao import pyfits ds9 = pysao.ds9() f = pyfits.open('file.fits') ds9.view(f[0])
Easy again! And the WCS information is preserved, which doesn’t seem to be the case with Numdisplay.
| Print article | This entry was posted by Anthony on 1 Apr 2009 at 2.06 pm, and is filed under Computing. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
I am a research fellow in