Q: How to convert an ascii file (table) to a fits file?
A: You can perform the following steps:
- Create a comma separated ascii table. For example if the table (cat1.txt) has n columns separated by white spaces:
awk '{print $1,","$2,","$3,","$...,","$n-1,","$n}' cat1.txt > cat2.txt
- Convert the new table (cat2.txt) into a fits file using the stilts tool:
stilts tcopy cat2.txt cat.fits ifmt=csv ofmt=fits-basic
Usage:stilts <stilts-flags> tcopy ifmt=<in-format> ofmt=<out-format> [in=]<table> [out=]<out-table>
- Add the missing header keywords according to the ESO Science Data Products Standard.
The STIL Tool Set can be downloaded from:
http://www.star.bris.ac.uk/~mbt/stilts/#install
For more information please check the following documentation:
http://www.star.bris.ac.uk/~mbt/stilts/
http://www.star.bris.ac.uk/~mbt/stilts/sun256/tcopy.html
Add a comment
Please log in or register to submit a comment.