teuben / nemo

a Stellar Dynamics Toolbox (Not Everybody Must Observe)
https://astronemo.readthedocs.io
GNU General Public License v2.0
57 stars 42 forks source link

tabplot/tabhist in native python #87

Open teuben opened 2 years ago

teuben commented 2 years ago

NEMO's tabplot (and also tabhist) are very useful for quick analysis of tabular data without having to open complex programs and a complex user interface. For a given table (or CSV file) it's usually as simple as

   tabplot file.tab

which would plot columns 1 and 2. However, in NEMO's C program there is no further interaction possible. In python's matplotlib there is an additional pan and zoom option. We would like to make a simple version of tabplot and tabhist that will use python. There are the following design issues:

1) The command line user interface?

  1. Clone NEMO's key=value
  2. Use the unix style --key value, e.g. using parseargs
  3. Use docopt's self-describing, it also allows -key=val
  4. something else

2) How to read the table. We have simple SSV (space separated values), the TSV, CSV and perhaps a few others.

  1. astropy tables https://docs.astropy.org/en/stable/table/index.html This sometimes also gives columns a name, so instead of column 1 vs. column 2, this could allow names, not 1-based integers.
  2. build something from scratch

3) In matplotlib it's a bit tricky to run interactive (this should be the default) and in a pipeline. In NEMO this is usually done via the yapp_pgplot style, e.g. yapp=2/xs would open XS window 2, but yapp=plot2.png/png would write it to a PNG file.

4) Only a few basic options should be implemented (at first). The current programs have a rather large set of options that we probably don't need. However, the layout= keyword could be an interesting one that needs some thought.

teuben commented 2 years ago

Reminder: there is a very simple tabplot.py in $NEMO/src/scripts/python

teuben commented 2 years ago

another example is a commandline wrapper around hyperfit.readthedocs.io