<br>
<br><br><div class="gmail_quote">On Wed, Apr 1, 2009 at 14:38, Maximilian Fabricius <span dir="ltr">&lt;<a href="mailto:mxhf@gmx.net">mxhf@gmx.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
No, pyfits is only for the IO. No graphics.<br>
<br>
I am sure that you will be able to read a bmp file into<br>
some array and then to store it using pyfits (BTW 24Bits!?).<br>
I have never done that, though.<br>
<br>
Neat, can Numdisplay also access the xpa interface?<br>
</blockquote><div><br>Just a few remarks:<br>there is also pysao with a simpler to use interface: <a href="http://code.google.com/p/python-sao/">http://code.google.com/p/python-sao/</a><br>Quote:<br><pre class="prettyprint">
<span class="pun">&gt;&gt;&gt;</span><span class="pln"> </span><span class="kwd">import</span><span class="pln"> pysao<br><br></span><span class="com"># run new instance of ds9</span><span class="pln"><br></span><span class="pun">&gt;&gt;&gt;</span><span class="pln"> ds9 </span><span class="pun">=</span><span class="pln"> pysao</span><span class="pun">.</span><span class="pln">ds9</span><span class="pun">()</span><span class="pln"><br>
<br></span><span class="pun">&gt;&gt;&gt;</span><span class="pln"> </span><span class="kwd">import</span><span class="pln"> numpy<br></span><span class="pun">&gt;&gt;&gt;</span><span class="pln"> im </span><span class="pun">=</span><span class="pln"> numpy</span><span class="pun">.</span><span class="pln">reshape</span><span class="pun">(</span><span class="pln">numpy</span><span class="pun">.</span><span class="pln">arange</span><span class="pun">(</span><span class="lit">100</span><span class="pun">),</span><span class="pln"> </span><span class="pun">(</span><span class="lit">10</span><span class="pun">,</span><span class="pln"> </span><span class="lit">10</span><span class="pun">))</span><span class="pln"><br>
</span><span class="com"># display 2-d array</span><span class="pln"><br></span><span class="pun">&gt;&gt;&gt;</span><span class="pln"> ds9</span><span class="pun">.</span><span class="pln">view</span><span class="pun">(</span><span class="pln">im</span><span class="pun">)</span><span class="pln"><br>
<br><br><br></span><span class="pun">&gt;&gt;&gt;</span><span class="pln"> </span><span class="kwd">import</span><span class="pln"> pyfits<br></span><span class="pun">&gt;&gt;&gt;</span><span class="pln"> f </span><span class="pun">=</span><span class="pln"> pyfits</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class="str">&#39;test.fits&#39;</span><span class="pun">)</span><span class="pln"><br>
</span><span class="com"># display first extension of fits file</span><span class="pln"><br></span><span class="pun">&gt;&gt;&gt;</span><span class="pln"> ds9</span><span class="pun">.</span><span class="pln">view</span><span class="pun">(</span><span class="pln">f</span><span class="pun">[</span><span class="lit">0</span><span class="pun">])</span><span class="pln"><br>
<br></span><span class="com"># access with XPA method. </span><span class="pln"><br></span><span class="pun">&gt;&gt;&gt;</span><span class="pln"> ds9</span><span class="pun">.</span><span class="kwd">set</span><span class="pun">(</span><span class="str">&#39;file test.fits&#39;</span><span class="pun">)</span><span class="pln"><br>
</span><span class="pun">&gt;&gt;&gt;</span><span class="pln"> ds9</span><span class="pun">.</span><span class="kwd">get</span><span class="pun">(</span><span class="str">&#39;file&#39;</span><span class="pun">)</span><span class="pln"><br>
<br></span><span class="com"># list available xpa commands</span><span class="pln"><br></span><span class="pun">&gt;&gt;&gt;</span><span class="pln"> ds9</span><span class="pun">.</span><span class="pln">xpa_help</span><span class="pun">()</span><span class="pln"><br>
<br></span><span class="com"># help on the specific xpa command</span><span class="pln"><br></span><span class="pun">&gt;&gt;&gt;</span><span class="pln"> ds9</span><span class="pun">.</span><span class="pln">xpa_help</span><span class="pun">(</span><span class="str">&quot;tile&quot;</span><span class="pun">)</span></pre>
<br><br>But if you prefer matplotlib, you should take a look at the kapteyn package:<br><a href="http://www.astro.rug.nl/software/kapteyn/">http://www.astro.rug.nl/software/kapteyn/</a><br>it&#39;s the only matplotlib package i know of, that can display correct wcs information. <br>
<br>Cheers, <br>Stefan<br><br><br><br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
2009/4/1 Wayne Watson &lt;<a href="mailto:sierra_mtnview@sbcglobal.net">sierra_mtnview@sbcglobal.net</a>&gt;:<br>
<div><div></div><div class="h5">&gt; Ultimately, I must display it in Python. If numdisplay is it, then that&#39;ll<br>
&gt; likely do. I would have thought pyfits would have a display method.<br>
&gt;<br>
&gt; At some point, I will want to convert a raw image, 640x480, of some bit<br>
&gt; depth (8, 16, 24) to a fits format. I might need to convert jpb images to<br>
&gt; fits too. Comments?<br>
&gt;<br>
&gt; Christopher Hanley wrote:<br>
&gt;<br>
&gt; Another easy way to display a data section from a FITS file is to use<br>
&gt; numdisplay and DS9.<br>
&gt;<br>
&gt; <a href="http://stsdas.stsci.edu/numdisplay/" target="_blank">http://stsdas.stsci.edu/numdisplay/</a><br>
&gt;<br>
&gt; Numdisplay will work with and ndarray from numpy.  It is a one line command<br>
&gt; after the import<br>
&gt;<br>
&gt;&gt; import numdisplay<br>
&gt;&gt; numdisplay.display(yourArrayObject)<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Chris<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt;<br>
&gt;            Wayne Watson (Watson Adventures, Prop., Nevada City, CA)<br>
&gt;<br>
&gt;              (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)<br>
&gt;<br>
&gt;<br>
&gt;           The Obama Administration plans to double the production<br>
&gt;           in solar energy from 1% to 2% of the total energy<br>
&gt;           supply in the next few years. One nuclear reaction<br>
&gt;           would do the same. Heard on Bill Wattenburg, KGO-AM<br>
&gt;<br>
&gt;           &quot;Less than all cannot satisfy Man.&quot; -- William Blake<br>
&gt;<br>
&gt;<br>
</div></div><div class="im">&gt; _______________________________________________<br>
&gt; AstroPy mailing list<br>
&gt; <a href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a><br>
&gt; <a href="http://mail.scipy.org/mailman/listinfo/astropy" target="_blank">http://mail.scipy.org/mailman/listinfo/astropy</a><br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
</div>--<br>
<div class="im">--------------------------------------------------------------------<br>
  Maximilian Fabricius<br>
  * Max Planck Institute for Extraterrestrial Physics (MPE)<br>
     Giessenbachstrasse, D-85748 Garching, Germany<br>
  * University Observatory Munich /   Wendelstein Observatory<br>
     Scheinerstr. 1, D-81679 München, Germany<br>
  eMail:  <a href="mailto:mxhf@mpe.mpg.de">mxhf@mpe.mpg.de</a><br>
  Phone:  +49 89 30000 3694<br>
  FAX:    +49 89 30000 3495<br>
  --------------------------------------------------------------------<br>
</div><div><div></div><div class="h5">_______________________________________________<br>
AstroPy mailing list<br>
<a href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/astropy" target="_blank">http://mail.scipy.org/mailman/listinfo/astropy</a><br>
</div></div></blockquote></div><br>