diff --git a/cli_tupak/__init__.py b/cli_tupak/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c3961685ab8defd1a28f2a2a7bb3b74fcafa4d6b --- /dev/null +++ b/cli_tupak/__init__.py @@ -0,0 +1 @@ +from __future__ import absolute_import diff --git a/cli_tupak/plot_multiple_posteriors.py b/cli_tupak/plot_multiple_posteriors.py new file mode 100644 index 0000000000000000000000000000000000000000..cdce52641534bffc9a473f7803f0d8ada5938bac --- /dev/null +++ b/cli_tupak/plot_multiple_posteriors.py @@ -0,0 +1,24 @@ +import argparse + + +def setup_command_line_args(): + parser = argparse.ArgumentParser( + description="Plot corner plots from results files") + parser.add_argument("-r", "--results", nargs='+', + help="List of results files to use.") + parser.add_argument("-f", "--filename", default=None, + help="Output file name.") + parser.add_argument("-l", "--labels", nargs='+', default=None, + help="List of labels to use.") + args, _ = parser.parse_known_args() + + return args + + +def main(): + args = setup_command_line_args() + import tupak + results = [tupak.core.result.read_in_result(filename=r) + for r in args.results] + tupak.core.result.plot_multiple(results, filename=args.filename, + labels=args.labels) diff --git a/setup.py b/setup.py index bd5874b683cbdc4e8ff1abbd9292731f43373ed0..3dd386559889df480891f692f3d8ef48bfd3deaa 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from distutils.core import setup +from setuptools import setup import subprocess from os import path @@ -38,7 +38,7 @@ setup(name='tupak', author_email='paul.lasky@monash.edu', license="MIT", version=version, - packages=['tupak', 'tupak.core', 'tupak.gw'], + packages=['tupak', 'tupak.core', 'tupak.gw', 'cli_tupak'], package_dir={'tupak': 'tupak'}, package_data={'tupak.gw': ['prior_files/*', 'noise_curves/*.txt', 'detectors/*'], 'tupak': [version_file]}, @@ -53,5 +53,7 @@ setup(name='tupak', 'scipy', 'gwpy', 'lalsuite', - ] - ) + ], + entry_points={'console_scripts': + ['tupak_plot=cli_tupak.plot_multiple_posteriors:main'] + })