[AstroPy] A simple python module, wrapping pytfits+matplotlib: fits I/O + graphic/display environment

Peter Erwin erwin at mpe.mpg.de
Thu May 4 10:18:56 CDT 2006


Hi Eric,

At 3:11 PM +0200 5/4/06, Eric Emsellem wrote:
>Hi again,
>
>Jaime Perea wrote:
>>  I would love such an idea but is there any work already done
>>  by pymidas or pyiraf?
>
>well no. As mentioned pymidas is just an emulated version of Midas under
>python so you can use midas commands and also load things in some
>python-like arrays/lists, etc. Not necessarily what you wish to have
>here. Same goes for pyraf. And neither of the two have the
>functionalities which could be delivered by e.g. matplotlib then.
>(of course these are great assets anyway as it provides the good sides
>of both worlds, but I think we would be better off with a true
>pyfits+matplotlib wrapper for simple-everyday usage).

This may not be what you would really like, but I think it should be
possible to use pyfits and matplotlib from *within* pyraf -- which is,
after all, a sort of front-end to a regular Python interpreter.

I have to admit that I don't currently use pyraf in command-line mode
(I use its modules in some Python scripts), so I have no advice on how easy or
feasible this would be in general.  But the following works on my iBook:

$ pyraf
--> import pyfits
--> import pylab
--> ff="n3627irac1ss.fit"
--> im = pyfits.getdata(ff)
--> pylab.plot(im[1:,1000])
[<matplotlib.lines.Line2D instance at 0x11a0c38>]
--> pylab.show()

(I'm glossing over problems I have getting the prompt back after the first
use of pylab.show(), but that's a matplotlib-related problem that afflicts
plain Python sessions as well, at least using the TkAgg interface on my
MacOS X system.)

This ought to let one use the image-display capabilities of iraf + ds9 (for
example), combined with whatever bits of pyfits and matplotlib you wish
to use, and whatever wrappers you wish to write to make things simpler
(the wrappers could, in principle, mix pyraft *and* pyfits *and* matplotlib...)

cheers,

Peter

-- 
=============================================================
Peter Erwin                   Max-Planck-Insitute for Extraterrestrial
erwin at mpe.mpg.de              Physics, Giessenbachstrasse
tel. +49 (0)89 30000 3695     85748 Garching, Germany
fax  +49 (0)89 30000 3495     http://www.mpe.mpg.de/~erwin



More information about the AstroPy mailing list