Skip to content
Snippets Groups Projects
Commit 1c6a785a authored by Jameson Rollins's avatar Jameson Rollins
Browse files

cli: allow specifying sub-budget or individual budget item to plot

parent 28381d12
No related branches found
No related tags found
1 merge request!122sub-budget plotting
Pipeline #193695 passed
...@@ -114,6 +114,9 @@ parser.add_argument( ...@@ -114,6 +114,9 @@ parser.add_argument(
parser.add_argument( parser.add_argument(
'IFO', 'IFO',
help="IFO name or path") help="IFO name or path")
parser.add_argument(
'subbudget', metavar='SUBBUDGET', nargs='?',
help="subbudget to plot; can be nested (e.g. 'Thermal.Substrate')")
def main(): def main():
...@@ -191,6 +194,12 @@ def main(): ...@@ -191,6 +194,12 @@ def main():
print(f'{name} ({type})') print(f'{name} ({type})')
return return
if args.subbudget:
try:
budget[args.subbudget]
except KeyError:
parser.exit(3, f"Error: Unknown budget item '{args.subbudget}'.\n")
out_data_files = set() out_data_files = set()
out_plot_files = set() out_plot_files = set()
if args.save: if args.save:
...@@ -251,11 +260,6 @@ def main(): ...@@ -251,11 +260,6 @@ def main():
logger.info("calculating budget...") logger.info("calculating budget...")
trace = budget.run(freq=freq) trace = budget.run(freq=freq)
if args.title:
plot_style['title'] = args.title
else:
plot_style['title'] = "GWINC Noise Budget: {}".format(name)
if args.range: if args.range:
logger.info("calculating inspiral ranges...") logger.info("calculating inspiral ranges...")
metrics, H = inspiral_range.all_ranges(freq, trace.psd, **RANGE_PARAMS) metrics, H = inspiral_range.all_ranges(freq, trace.psd, **RANGE_PARAMS)
...@@ -275,6 +279,15 @@ def main(): ...@@ -275,6 +279,15 @@ def main():
else: else:
subtitle = None subtitle = None
if args.subbudget:
trace = trace[args.subbudget]
name += f': {args.subbudget}'
if args.title:
plot_style['title'] = args.title
else:
plot_style['title'] = "GWINC Noise Budget: {}".format(name)
########## ##########
# interactive # interactive
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment