[AstroPy] Table join with fits tables (or something else)

Christoph Deil Christoph.Deil at mpi-hd.mpg.de
Sat Dec 3 17:33:08 EST 2011


On Dec 2, 2011, at 7:35 PM, Taro Sato wrote:

> Hi there.  Sorry for a lazy question.. but is anyone here aware of any
> Python utility that makes it easy to do table join operations (as in
> SQL) with FITS tables?
> 
> I'm primarily using PyFITS to store data now and wish to avoid
> substantial reconstruction of data structures just to accommodate such
> operations, but if that means moving on to a different package, I'd
> like to consider if the transition is worth it...
> 
> Thank you for your time,
> Taro


Hi Taro,

maybe it is possible to convert your FITS tables to sqlite, perform the join operations there using SQL and then convert back to FITS?
sqlite3 is in the python standard library and with ATpy you just need a few commands for the conversions:
http://docs.python.org/library/sqlite3.html
http://atpy.github.com/format_sql.html
I'm not sure it is possible to convert FITS to sqlite and back easily in memory without temp files, so possibly this approach could be too slow for you.

There is also a very nice Java library / command line tool / GUI called STIL / STILTS / TOPCAT that can perform join and many other operations on FITS tables:
http://www.star.bristol.ac.uk/~mbt/stil/
http://www.star.bristol.ac.uk/~mbt/stilts/
http://www.star.bristol.ac.uk/~mbt/topcat/
It has a Jython interface, but unfortunately can't be used from CPython.
As far as I know there is no equivalent (feature-rich, fast, well-tested) CPython package for FITS astronomy tables.

Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20111203/ccc718c7/attachment.html>


More information about the AstroPy mailing list