本文整理匯總了Python中pycap.PropertyTree.get_string方法的典型用法代碼示例。如果您正苦於以下問題:Python PropertyTree.get_string方法的具體用法?Python PropertyTree.get_string怎麽用?Python PropertyTree.get_string使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pycap.PropertyTree
的用法示例。
在下文中一共展示了PropertyTree.get_string方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: range
# 需要導入模塊: from pycap import PropertyTree [as 別名]
# 或者: from pycap.PropertyTree import get_string [as 別名]
for p in range(params):
usage+=' --param_'+str(p)+' val_'+str(p)
parser=OptionParser(usage)
# register options
for p in range(params):
parser.add_option('--param_'+str(p),type=float)
# parse the command line arguments
(options,args)=parser.parse_args()
# make device database
device_database=PropertyTree()
device_database.parse_xml('super_capacitor.xml')
# adjust the parameters in the database
options_dict=vars(options)
for var in options_dict:
path=uq_database.get_string('uq.'+var+'.name')
# next line is there to ensure that path already exists
old_value=device_database.get_double(path)
new_value=options_dict[var]
print var,path,new_value
device_database.put_double(path,new_value)
# build the energy storage device
device=EnergyStorageDevice(device_database.get_child('device'))
# parse the electrochmical impedance spectroscopy database
eis_database=PropertyTree()
eis_database.parse_xml('eis.xml')
# measure the impedance
impedance_spectrum_data=measure_impedance_spectrum(device,eis_database.get_child('eis'))
# extract the results
frequency=impedance_spectrum_data['frequency']