本文整理匯總了Python中larch.Group.groupname方法的典型用法代碼示例。如果您正苦於以下問題:Python Group.groupname方法的具體用法?Python Group.groupname怎麽用?Python Group.groupname使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類larch.Group
的用法示例。
在下文中一共展示了Group.groupname方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: copy_group
# 需要導入模塊: from larch import Group [as 別名]
# 或者: from larch.Group import groupname [as 別名]
def copy_group(self, filename, new_filename=None):
"""copy XAS group (by filename) to new group"""
groupname = self.file_groups[filename]
if not hasattr(self.larch.symtable, groupname):
return
ogroup = self.get_group(groupname)
ngroup = Group(datatype=ogroup.datatype,
copied_from=groupname)
for attr in dir(ogroup):
do_copy = True
if attr in ('xdat', 'ydat', 'i0', 'data' 'yerr',
'energy', 'mu'):
val = getattr(ogroup, attr)*1.0
elif attr in ('norm', 'flat', 'deriv', 'deconv',
'post_edge', 'pre_edge', 'norm_mback',
'norm_vict', 'norm_poly'):
do_copy = False
else:
try:
val = copy.deepcopy(getattr(ogroup, attr))
except ValueError:
do_copy = False
if do_copy:
setattr(ngroup, attr, val)
if new_filename is None:
new_filename = filename + '_1'
ngroup.filename = unique_name(new_filename, self.file_groups.keys())
ngroup.groupname = unique_name(groupname, self.file_groups.values())
setattr(self.larch.symtable, ngroup.groupname, ngroup)
return ngroup