本文整理汇总了Python中SANSUtility.correct_q_resolution_for_merged方法的典型用法代码示例。如果您正苦于以下问题:Python SANSUtility.correct_q_resolution_for_merged方法的具体用法?Python SANSUtility.correct_q_resolution_for_merged怎么用?Python SANSUtility.correct_q_resolution_for_merged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SANSUtility
的用法示例。
在下文中一共展示了SANSUtility.correct_q_resolution_for_merged方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_that_non_matching_workspaces_are_detected
# 需要导入模块: import SANSUtility [as 别名]
# 或者: from SANSUtility import correct_q_resolution_for_merged [as 别名]
def test_that_non_matching_workspaces_are_detected(self):
# Arrange
front_name = "front"
rear_name = "rear"
result_name = "result"
x1 = [1,2,3]
e1 = [1,1]
y1 = [2,2]
dx1 = [1.,2.,3.]
x2 = [1,2,3,4]
e2 = [1,1, 1]
y2 = [2,2, 2]
dx2 = [1.,2.,3.,4.]
provide_workspace_with_x_errors(front_name, True, 1, x1, y1, e1, dx1)
provide_workspace_with_x_errors(rear_name, True, 1, x2, y2, e2, dx2)
provide_workspace_with_x_errors(result_name, False, 1)
front = mtd[front_name]
rear = mtd[rear_name]
result = mtd[result_name]
scale = 2.
# Act
su.correct_q_resolution_for_merged(front, rear,result, scale)
# Assert
self.assertFalse(result.hasDx(0))
# Clean up
DeleteWorkspace(front)
DeleteWorkspace(rear)
DeleteWorkspace(result)
示例2: test_error_is_ignored_when_only_one_input_has_dx
# 需要导入模块: import SANSUtility [as 别名]
# 或者: from SANSUtility import correct_q_resolution_for_merged [as 别名]
def test_error_is_ignored_when_only_one_input_has_dx(self):
# Arrange
front_name = "front"
rear_name = "rear"
result_name = "result"
provide_workspace_with_x_errors(front_name, True, 1)
provide_workspace_with_x_errors(rear_name, False, 1)
provide_workspace_with_x_errors(result_name, False, 1)
front = mtd[front_name]
rear = mtd[rear_name]
result = mtd[result_name]
scale = 2.
# Act
su.correct_q_resolution_for_merged(front, rear,result, scale)
# Assert
self.assertFalse(result.hasDx(0))
# Clean up
DeleteWorkspace(front)
DeleteWorkspace(rear)
DeleteWorkspace(result)
示例3: test_correct_x_error_is_produced
# 需要导入模块: import SANSUtility [as 别名]
# 或者: from SANSUtility import correct_q_resolution_for_merged [as 别名]
def test_correct_x_error_is_produced(self):
# Arrange
x = [1,2,3]
e = [1,1]
y_front = [2,2]
dx_front = [1.,2.,3.]
y_rear = [1.5,1.5]
dx_rear = [3.,2.,1.]
front_name = "front"
rear_name = "rear"
result_name = "result"
provide_workspace_with_x_errors(front_name, True, 1, x, y_front, e, dx_front)
provide_workspace_with_x_errors(rear_name, True, 1, x, y_rear, e, dx_rear)
provide_workspace_with_x_errors(result_name, False, 1, x, y_front, e)
front = mtd[front_name]
rear = mtd[rear_name]
result = mtd[result_name]
scale = 2.
# Act
su.correct_q_resolution_for_merged(front, rear,result, scale)
# Assert
self.assertTrue(result.hasDx(0))
dx_expected_0 = (dx_front[0]*y_front[0]*scale + dx_rear[0]*y_rear[0])/(y_front[0]*scale + y_rear[0])
dx_expected_1 = (dx_front[1]*y_front[1]*scale + dx_rear[1]*y_rear[1])/(y_front[1]*scale + y_rear[1])
dx_expected_2 = dx_expected_1
dx_result = result.readDx(0)
self.assertTrue(len(dx_result) ==3)
self.assertEqual(dx_result[0], dx_expected_0)
self.assertEqual(dx_result[1], dx_expected_1)
self.assertEqual(dx_result[2], dx_expected_2)
# Clean up
DeleteWorkspace(front)
DeleteWorkspace(rear)
DeleteWorkspace(result)