Surveying the Universe
Posts tagged DS9
Python, FITS and DS9
Apr 1st
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.
I am a research fellow in