本文整理汇总了Python中SANSUtility.rename_workspace_correctly方法的典型用法代码示例。如果您正苦于以下问题:Python SANSUtility.rename_workspace_correctly方法的具体用法?Python SANSUtility.rename_workspace_correctly怎么用?Python SANSUtility.rename_workspace_correctly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SANSUtility
的用法示例。
在下文中一共展示了SANSUtility.rename_workspace_correctly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BatchReduce
# 需要导入模块: import SANSUtility [as 别名]
# 或者: from SANSUtility import rename_workspace_correctly [as 别名]
#.........这里部分代码省略.........
continue
except SkipReduction as reason:
#this means that a load step failed, the warning and the fact that the results aren't there is enough for the user
issueWarning(str(reason)+ ', skipping reduction')
continue
except ValueError as reason:
issueWarning('Cannot load file :'+str(reason))
#when we are all up to Python 2.5 replace the duplicated code below with one finally:
delete_workspaces(raw_workspaces)
raise
delete_workspaces(raw_workspaces)
if verbose:
sanslog.notice(createColetteScript(run, format, reduced, centreit, plotresults, filename))
# Rename the final workspace
final_name = run['output_as'].strip()
if final_name == '':
final_name = reduced
# Remove illegal characters
final_name = sanitize_name(final_name)
#convert the names from the default one, to the agreement
# This caused a renaming with the following logic
# | combinDet | Name HAB | Name LAB | Name Merged |
# | rear | +_rear | - | - |
# | front | - | +_front | - |
# | both | +_rear | +_front | - |
# | merged | +_rear | +_front | +_merged |
# This is not great since it uses SANS2D terminology for all instruments
names = [final_name]
if combineDet == 'rear':
new_name = su.rename_workspace_correctly(ins_name, su.ReducedType.LAB, final_name, reduced)
names = [new_name]
elif combineDet == 'front':
new_name = su.rename_workspace_correctly(ins_name, su.ReducedType.HAB, final_name, reduced)
names = [new_name]
elif combineDet == 'both':
if ins_name == 'SANS2D':
rear_reduced = reduced.replace('front', 'rear')
else: #if ins_name == 'lOQ':
rear_reduced = reduced.replace('HAB', 'main')
new_name_HAB = su.rename_workspace_correctly(ins_name, su.ReducedType.HAB, final_name, reduced)
new_name_LAB = su.rename_workspace_correctly(ins_name, su.ReducedType.LAB, final_name, rear_reduced)
names = [new_name_HAB, new_name_LAB]
elif combineDet == 'merged':
if ins_name == 'SANS2D':
rear_reduced = reduced.replace('merged', 'rear')
front_reduced = reduced.replace('merged', 'front')
else:
rear_reduced = reduced.replace('merged', 'main')
front_reduced = rear_reduced.replace('main', 'HAB')
new_name_Merged = su.rename_workspace_correctly(ins_name, su.ReducedType.Merged, final_name, reduced)
new_name_LAB = su.rename_workspace_correctly(ins_name, su.ReducedType.LAB, final_name, rear_reduced)
new_name_HAB = su.rename_workspace_correctly(ins_name, su.ReducedType.HAB, final_name, front_reduced)
names = [new_name_Merged, new_name_LAB, new_name_HAB]
else:
RenameWorkspace(InputWorkspace=reduced, OutputWorkspace=final_name)
file = run['output_as']
#saving if optional and doesn't happen if the result workspace is left blank. Is this feature used?
if file:
save_names = []
for n in names:
w = mtd[n]