Commit 400dd411 authored by rmapaah's avatar rmapaah

Issue #13: The function returns four values i.e. residual error and three...

Issue #13: The function returns four values i.e. residual error and three values for offset of the point
parent 44d0133d
......@@ -102,4 +102,4 @@ def pivot_calibration(matrices4x4):
print("pivotCalibration=(", x_values[3, 0], ",", x_values[4, 0], ",", x_values[5, 0], "),residual=", residual_error)
return residual_error
return residual_error, x_values[0, 0], x_values[1, 0], x_values[2, 0]
......@@ -43,5 +43,25 @@ def test_return_value():
matrices = np.concatenate(arrays)
numberOf4x4Matrices = int(matrices.size/16)
matrices4x4 = matrices.reshape(numberOf4x4Matrices, 4, 4)
assert 1.8385 == round(p.pivot_calibration(matrices4x4), 4)
residual_error, x_value_1, x_value_2, x_value_3 = p.pivot_calibration(matrices4x4)
assert 1.838 == round(residual_error, 3)
assert -14.476 == round(x_value_1, 3)
assert 395.143 == round(x_value_2, 3)
assert -7.558 == round(x_value_3, 3)
def test_rank_if_condition():
# This test will be checking a specific if condition.
# But at the moment I dont know what data I need
# To get proper s_values to cover that if condition.
with pytest.raises(SystemExit):
file_names = glob('tests/data/test_case_data.txt')
arrays = [np.loadtxt(f) for f in file_names]
matrices = np.concatenate(arrays)
numberOf4x4Matrices = int(matrices.size/16)
matrices4x4 = matrices.reshape(numberOf4x4Matrices, 4, 4)
p.pivot_calibration(matrices4x4)
0.62605416 0.59925143 0.39880988 0.30533258
0.27323923 0.05783788 0.62440577 0.72565653
0.87709565 0.40095427 0.12907662 0.08692586
0.6579568 0.2918701 0.82629662 0.01160189
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment