aegis

This script is executed when AEGIS is imported (import aegis). Execute functions by running aegis.run_from_{}. AEGIS can be started in multiple ways; each of these functions starts AEGIS from a different context.

 1"""
 2This script is executed when AEGIS is imported (`import aegis`). Execute functions by running `aegis.run_from_{}`.
 3AEGIS can be started in multiple ways; each of these functions starts AEGIS from a different context.
 4"""
 5
 6import logging
 7import pathlib
 8
 9import aegis_gui
10import aegis_sim
11from aegis.log import set_logging
12from aegis.parse import get_parser
13
14
15def start_from_terminal():
16    parser = get_parser()
17    args = parser.parse_args()
18    set_logging(level=logging.DEBUG)
19    logging.getLogger("numba").setLevel(logging.ERROR)
20
21    if args.command == "sim":
22        config_path = pathlib.Path(args.config_path).absolute() if args.config_path else None
23        pickle_path = pathlib.Path(args.pickle_path).absolute() if args.pickle_path else None
24        aegis_sim.run(
25            custom_config_path=config_path,
26            pickle_path=pickle_path,
27            overwrite=args.overwrite,
28            custom_input_params={},
29        )
30    elif args.command == "gui":
31        if args.server:
32            aegis_gui.run(environment="server", debug=False)
33        else:
34            aegis_gui.run(environment="local", debug=args.debug)
35    else:
36        parser.print_help()
def start_from_terminal():
16def start_from_terminal():
17    parser = get_parser()
18    args = parser.parse_args()
19    set_logging(level=logging.DEBUG)
20    logging.getLogger("numba").setLevel(logging.ERROR)
21
22    if args.command == "sim":
23        config_path = pathlib.Path(args.config_path).absolute() if args.config_path else None
24        pickle_path = pathlib.Path(args.pickle_path).absolute() if args.pickle_path else None
25        aegis_sim.run(
26            custom_config_path=config_path,
27            pickle_path=pickle_path,
28            overwrite=args.overwrite,
29            custom_input_params={},
30        )
31    elif args.command == "gui":
32        if args.server:
33            aegis_gui.run(environment="server", debug=False)
34        else:
35            aegis_gui.run(environment="local", debug=args.debug)
36    else:
37        parser.print_help()