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

Eric Emsellem emsellem at obs.univ-lyon1.fr
Thu May 4 07:33:30 CDT 2006


I am trying since some time to develop a simple module to wrap up some
functionalities of pyfits and matplotlib.
The goal is to be able to manipulate FITS files (spectra, images, 3D
cubes, including maybe Euro3D format for those who know what it is) and
display them (plot slices, display images, etc) in a very simple way. It
could be inspired from (although not a cloning of) simple
functionalities found in Midas. So you can do things like

Image1.fits = Image2.fits / (Image3.fits + 3.4)

Table.fits.col1 = Table.fits.col2 * Table.fits.col4 / 2.

, or easily create a new Fits image, or table, display them by doing
something like:

load("Image1.fits", scale=3, cuts=(0.,100.), center=(-1.,6.))

or alternatively:

ima = fitstab("Image1.fits")
load(ima, scale=3, cuts=(0.,100.), center=-1.,6.)

(where Image1.fits is displayed with a scaling factor of 3, with cuts as
indicated, and the center of the figure corresponding to coordinates -1,6)


plot("Image1.fits", 0)

(plot a cut at vertical coordinate 0)

You could say then: use Midas. But Midas is clearly very limited (does
not have the python built-in potential of course) and its
display/plotting functions are really scarce. The fact that there is now
a pyMidas available does not fill the gap since I would like to be able
to run my favourite ide (ipython for the moment), and really profit from
all python modularity/functions.

So the choice for an I/O with fits seems easy: "pyfits" which is a
really fantastic module for dealing with FITS files.
And the choice for displaying is also not so difficult: "matplotlib"
which is also an amazing module and provides paper quality figures.

My questions are then:

0/ is this a dum idea? Maybe I am missing something here, so just let me

1/ is there already something existing which does what I mention above?
(so a wrapper around pyfits+matplotlib). Maybe at StSci...?

2/ If I were to try to develop such a tool, it will result in a rather
badly coded module: I will try my best but frankly I should be
considered as a newby in python and I can sincerely say that I don't
fully understand all the forum matplotlib/numpy/scipy discussions, by
far... So the question is: would anybody be interested/willing to, once
in a while, help me with this development?

Some could answer that using directly pyfits+matplotlib does the job.
True. But if you wish to directly deal with fits and display them with
some option (zooming, cuts, centering, etc) you still need to go through
a number of steps which are not necessarily easy to remember (syntax,
etc). Some wrapping could help quite a lot here.

Thanks for any input here.


P.S.: for the sake of completeness I could send anybody on request the
very ugly looking - and unfinished modules I wrote last year in this
context, when I seriously engaged in python in replacement of
P.P.S.: this is a duplicate of a post sent to matplotlib, but as 
suggested by P. Barrett, this post is much more relevant to astropy...
Sorry for the duplicate.

More information about the AstroPy mailing list