[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-devel] [task #13579] Utility for table displaying and manipula
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-devel] [task #13579] Utility for table displaying and manipulation |
Date: |
Wed, 24 Aug 2016 22:46:39 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0 |
Update of task #13579 (project gnuastro):
Status: In Progress => Done
Percent Complete: 10% => 100%
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #2:
An initial version of the new `Table' utility was made and is now pushed into
the main repo. Some simple tests have also been written for it and a section
was added to the book, explaining everything with examples.
Operating on binary FITS tables is now as easy as plain text files, just
replace `cat' with `asttable'. These examples are taken from the top of the
"Invoking Table" section:
## Get the table column information (name, data type, or units)
$ asttable bintab.fits --information
## Only print those columns which have a name starting with "MAG_"
$ asttable bintab.fits --columns=^MAG_
## Only print the 2nd column, and the third column multiplied by 5
$ asttable bintab.fits | awk '@{print $2, address@hidden'
## Only print those rows with a value in the 10th column above 100000
$ asttable bintab.fits | awk '$10>10e5 @address@hidden'
## Sort the output columns by the third column, save output
$ asttable bintab.fits | sort -k3 > output.txt
## Convert a plain text table to a binary FITS table
$ asttable plaintext.txt --output=inbinary.fits
Before starting to work on adding this new utility, I also made a general
TEMPLATE utility. So it will be really easy to add future new utilities (just
copy this directory and rename TEMPLATE everywhere in that directory).
Ofcourse table can still use a lot of work to become even better and more
robust. But I couldn't put much more time now. I have made a lot of comments
in the commit messages.
One thing I am really interested to solve, is to somehow define a good way to
ready different types from a plain text table. For example if we can set an
internal Gnuastro standard to specify column datatypes, names and units in the
comments of a plain text table, then we can read a FITS binary table to a
plain text file, do some operations on it and save it back as a binary file
easily without the loss of information (like data types). Once we make a
robust enough library for this, all the utilities can read and write their
inputs and outputs to and from FITS tables if the user wants them too.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/task/?13579>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/