<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Anthony Smith&#039;s Research Blog &#187; DS9</title>
	<atom:link href="http://www.anthonysmith.me.uk/research/tag/ds9/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anthonysmith.me.uk/research</link>
	<description>Surveying the Universe</description>
	<lastBuildDate>Mon, 06 Feb 2012 10:25:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Python, FITS and DS9</title>
		<link>http://www.anthonysmith.me.uk/research/2009/04/01/python-fits-and-ds9/</link>
		<comments>http://www.anthonysmith.me.uk/research/2009/04/01/python-fits-and-ds9/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 13:06:34 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[DS9]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://www.anthonysmith.me.uk/research/?p=188</guid>
		<description><![CDATA[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&#40;'file.fits'&#41; numdisplay.display&#40;arr&#41; Easy! Alternatively, the Kapteyn package seems excellent, and uses Python's matplotlib for displaying images. It requires&#8230;]]></description>
			<content:encoded><![CDATA[<p>Here's an easy way to display <a href="http://heasarc.gsfc.nasa.gov/docs/heasarc/fits.html">FITS</a> images (or any array) in <a href="http://hea-www.harvard.edu/RD/ds9/">DS9</a> using <a href="http://python.org/">Python</a> (with <a href="http://www.stsci.edu/resources/software_hardware/pyfits">PyFITS</a>, <a href="http://numpy.scipy.org/">NumPy</a> and <a href="http://stsdas.stsci.edu/numdisplay/">Numdisplay</a>, which is part of <a href="http://www.stsci.edu/resources/software_hardware/pyraf/stsci_python/">stsci_python</a>). First launch DS9, then in Python:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> numdisplay
<span style="color: #ff7700;font-weight:bold;">import</span> pyfits
arr = pyfits.<span style="color: black;">getdata</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'file.fits'</span><span style="color: black;">&#41;</span>
numdisplay.<span style="color: black;">display</span><span style="color: black;">&#40;</span>arr<span style="color: black;">&#41;</span></pre></div></div>

<p>Easy!</p>
<p>Alternatively, the <a href="http://www.astro.rug.nl/software/kapteyn/">Kapteyn package</a> seems excellent, and uses Python's <a href="http://matplotlib.sourceforge.net/">matplotlib</a> for displaying images. <del>It requires <a href="http://www.atnf.csiro.au/people/mcalabre/WCS/">WCSLIB</a> to run, though, so the installation process is a bit longer</del> [update: apparently that bit is no longer true - 17 Oct 2011].</p>
<p>A third option is to use <a href="http://code.google.com/p/python-sao/">python-sao</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> pysao
<span style="color: #ff7700;font-weight:bold;">import</span> pyfits
ds9 = pysao.<span style="color: black;">ds9</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
f = pyfits.<span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'file.fits'</span><span style="color: black;">&#41;</span>
ds9.<span style="color: black;">view</span><span style="color: black;">&#40;</span>f<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Easy again! And the WCS information is preserved, which doesn't seem to be the case with Numdisplay.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthonysmith.me.uk/research/2009/04/01/python-fits-and-ds9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

