[AstroPy] Representing astronomical (esp. IFU) datasets as Python objects

James Turner jturner at gemini.edu
Thu May 4 18:14:17 CDT 2006


Hi Eric et al.,

I was motivated to write this in reply to Eric's post on wrapping
pyfits+matplotlib, but I think the subject is sufficiently different
that I'll try to avoid mixing the 2 threads...

For reducing astronomical data, I'd like to operate directly on objects
in memory that have associated header-type information and methods for
'presenting' the data appropriately to the main program or user. This
would be closer to manipulating FITS files in IRAF than working with
'bare' arrays. More importantly, it seems like a natural way to write
reusable high-level functionality for use in Pyraf or Python scripts.

PyFITS already does a good job of handling FITS files, but it is very
generic and tied to the FITS structure. I would like to work with data
objects that 'know more' about their own properties and contain methods
for doing WCS transformations etc. Rather than tie these directly to
FITS files, I started writing a DataSet class that will correspond to a
single science data array plus associated WCS information, variance,
data quality etc. This is just a layer on top of PyFITS & numarray, of
course, although the DataSets don't have to exist on disk. The idea is
that DataSets can be copied from or to PyFITS HDULists at the start or
end of the script (it could get slightly more complicated with memory
mapping etc.). The base class should be able to do generic operations
on itself to present the appropriate data to the main program. Something
like a Euro3D dataset could be a derived class with its own special
methods to interpret that format, eg. allowing the main program to
interrogate the DataSet for values by RA and Dec instead of IFU element.

I believe it is easy to redefine/overload operators in Python, so it
should be possible to do operations like '*', '+' etc. directly on
the DataSets once the class is finished, just like in Eric's examples.
All the WCS & variance propagation etc. would then get carried
through automatically. I think one could use matplotlib or numdisplay
to show the results without too much extra work or reinvention.

In case anyone gets excited by this idea, I should state that I'm
just another busy astronomer and Python newbie and am not about to
pull the finished product out of a hat - but anyway I started writing
this (a much less sophisticated version) as part of a datacube
mosaicing program and I think in principle it could be quite powerful,
so feel free to treat this as a "Request For Comments". In future, I
hope the work will tie into our IRAF/Pyraf project at Gemini, but at
the moment it's just a small personal experiment.

I'd be willing to collaborate with others, time permitting, in order
to make this better, although it's really a higher priority for me to
spend more time on my astronomy research during the coming months, so
this may be overambitious...

Also, if anyone can point out why this is a stupid idea by an ignorant
newbie, or if it has already been done, please tell me before I waste
any more time on it!

Cheers,

James.

-- 
James E.H. Turner
Gemini Observatory Southern Operations Centre,
Casilla 603,		Tel. (+56) 51 205609
La Serena, Chile.	Fax. (+56) 51 205650



More information about the AstroPy mailing list