Coverage for pesummary/cli/summarycombine.py: 95.7%

23 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-05-02 08:42 +0000

1#! /usr/bin/env python 

2 

3# Licensed under an MIT style license -- see LICENSE.md 

4 

5from pesummary.gw.cli.parser import ArgumentParser 

6from pesummary.utils import history_dictionary 

7from pesummary.utils.utils import gw_results_file 

8 

9__author__ = ["Charlie Hoy <charlie.hoy@ligo.org>"] 

10__doc__ = """This executable is used to combine multiple result files into a 

11single PESummary metafile""" 

12 

13 

14def main(args=None): 

15 """Top level interface for `summarycombine` 

16 """ 

17 _parser = ArgumentParser() 

18 _parser.add_all_groups_to_parser() 

19 opts, unknown = _parser.parse_known_args(args=args) 

20 if opts.gw or gw_results_file(opts): 

21 from pesummary.gw.cli.inputs import MetaFileInput 

22 from pesummary.gw.file.meta_file import GWMetaFile 

23 input_cls = MetaFileInput 

24 meta_file_cls = GWMetaFile 

25 else: 

26 from pesummary.core.cli.inputs import MetaFileInput 

27 from pesummary.core.file.meta_file import MetaFile 

28 input_cls = MetaFileInput 

29 meta_file_cls = MetaFile 

30 args = input_cls(opts) 

31 _history = history_dictionary( 

32 program=_parser.prog, creator=args.user, 

33 command_line=_parser.command_line 

34 ) 

35 meta_file_cls(args, history=_history) 

36 

37 

38if __name__ == "__main__": 

39 main()