def load_config(filename=None):
global meas_file, AWGDir, plotBackground, gridColor, pulse_primitives_lib, cnot_implementation
if filename:
meas_file = filename
else:
meas_file = find_meas_file()
with open(meas_file, 'r') as FID:
# cfg = yaml.load(f)
loader = Loader(FID)
try:
cfg = loader.get_single_data()
finally:
loader.dispose()
# pull out the variables
# abspath allows the use of relative file names in the config file
if 'AWGDir' in cfg['config'].keys():
AWGDir = os.path.abspath(cfg['config']['AWGDir'])
else:
raise KeyError("Could not find AWGDir in the YAML config section")
plotBackground = cfg['config'].get('PlotBackground', '#EAEAF2')
gridColor = cfg['config'].get('GridColor', None)
pulse_primitives_lib = cfg['config'].get('PulsePrimitivesLibrary', 'standard')
cnot_implementation = cfg['config'].get('cnot_implementation', 'CNOT_simple')
return meas_file
评论列表
文章目录