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

CLI: load noise budget from HDF5 for plotting

Add ability to load a noise budget previously saved in an HDF5 file.
parent d268a030
No related branches found
No related tags found
1 merge request!12HDF5 support
......@@ -70,7 +70,7 @@ group.add_argument('--save', '-s',
group.add_argument('--no-plot', '-np', action='store_false', dest='plot',
help="supress plotting")
parser.add_argument('IFO', default=IFO,
help="IFO name or description file path (.yaml, .mat, .m)")
help="IFO name or description file path (.yaml, .mat, .m), or full HDF5 data file")
def main():
......@@ -78,15 +78,25 @@ def main():
args = parser.parse_args()
ifo = load_ifo(args.IFO)
##########
# initial arg processing
if os.path.splitext(args.IFO)[1] == '.hdf5':
title, ifo, noises = util.load_hdf5(args.IFO)
else:
ifo = load_ifo(args.IFO)
noises = None
if args.title:
title = args.title
else:
title = '{} GWINC Noise Budget'.format(args.IFO)
if args.dump:
ifo = precompIFO(ifo)
print(ifo.to_txt(), end='')
return
freq = np.logspace(np.log10(args.flo), np.log10(args.fhi), args.npoints)
if args.matlab:
gwinc = gwinc_matlab.gwinc_matlab
else:
......@@ -110,19 +120,22 @@ def main():
v = float(v)
range_params[p] = v
logging.info("calculating noises...")
score, noises, ifo = gwinc(freq, ifo)
##########
# main calculations
if noises:
freq = noises['Freq']
else:
logging.info("calculating noises...")
freq = np.logspace(np.log10(args.flo), np.log10(args.fhi), args.npoints)
score, noises, ifo = gwinc(freq, ifo)
logging.info('recycling factor: {: >0.3f}'.format(ifo.gwinc.prfactor))
logging.info('BS power: {: >0.3f} W'.format(ifo.gwinc.pbs))
logging.info('arm finesse: {: >0.3f}'.format(ifo.gwinc.finesse))
logging.info('arm power: {: >0.3f} kW'.format(ifo.gwinc.parm/1000))
if args.title:
title = args.title
else:
title = '{} GWINC Noise Budget'.format(args.IFO)
if args.fom:
logging.info("calculating inspiral {}...".format(range_func))
H = inspiral_range.CBCWaveform(freq, **range_params)
......
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