Skip to content

Adds a command-line-interface to plot results files

Gregory Ashton requested to merge add-cli-plot into master

I think a common task we want to do is "okay, I've got this results file, I want to generate a corner plot". This adds a command line tool to enable this - here is an example usage

$ tupak_plot -r outdir/A_result.h5 outdir/B_result.h5 -f output_file.png -l "result A" "result B" -p mu sigma

This example overlays two results files on top of each other. But it can equally just be applied to a single result file as well. Here is the help message

09:56 ~: $ tupak_plot --help
usage: tupak_plot [-h] [-r RESULTS [RESULTS ...]] [-f FILENAME]
                  [-l LABELS [LABELS ...]] [-p PARAMETERS [PARAMETERS ...]]

Plot corner plots from results files

optional arguments:
  -h, --help            show this help message and exit
  -r RESULTS [RESULTS ...], --results RESULTS [RESULTS ...]
                        List of results files to use.
  -f FILENAME, --filename FILENAME
                        Output file name.
  -l LABELS [LABELS ...], --labels LABELS [LABELS ...]
                        List of labels to use for each result.
  -p PARAMETERS [PARAMETERS ...], --parameters PARAMETERS [PARAMETERS ...]
                        List of parameters.

This is obviously one of those things that is quite flexible, but isn't going to do everything that people want it to do. For that, one can still drop into python and do it there.

Any objections? Ideas? Is tupak_plot to general?

I'll also add that this opens up the box for others to add other CLI tools (the backend is all there, you just need to write the script and modify setup.py). Personally, I'd say we should keep this for quick and dirty things we want to do at the command line and not go down the road of "tupak on the command line", i.e., making priors and things on the command line. But, obviously people can do that if they want.

@paul-lasky @colm.talbot @moritz.huebner

Merge request reports

Loading