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

Perry Greenfield perry at stsci.edu
Fri May 5 10:42:20 CDT 2006

Sorry for not responding more quickly, I was away for a day...

On May 4, 2006, at 8:33 AM, Eric Emsellem wrote:

> Hi,
> 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)
This kind of syntax would not work in Python without some sort of 
special interpretation since Python would not find ImageX.fits in the 
current namespace. That means you have to think about what context you 
want this kind of capability to work in. As a special, non-Python 
command language that gets translated into python (pyraf does that for 
IRAF-like commands)?

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

> , or easily create a new F
> its image, or table, display them by doing
> something like:
> load("Image1.fits", scale=3, cuts=(0.,100.), center=(-1.,6.))
This is much easier.

> 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)
> or
> plot("Image1.fits", 0)
> (plot a cut at vertical coordinate 0)
As is this.

> My questions are then:
> 0/ is this a dum idea? Maybe I am missing something here, so just let 
> me
> know...
I suppose I would say the idea needs a bit more definition as to 
whether it is enhancement to python libraries or a new kind of shell.

> 1/ is there already something existing which does what I mention above?
> (so a wrapper around pyfits+matplotlib). Maybe at StSci...?
Not to the level that you describe. Doing the latter two examples would 
be fairly easy I think.

> 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?
Yes, but this is a bad time for us at STScI for the next month or two 
(we are really spread thinly over several projects; hopefully it won't 
be so bad in a couple months)
So I'd say that it would be hard for us to provide much help or even 
advice in the very short term.

> 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.

Perry Greenfield

More information about the AstroPy mailing list