def pre_compose_test(args, name): (tensor, update), res = load_data(args, name) qa = QuatAffine.from_tensor(tensor) this_res = qa.pre_compose(update).to_tensor() err, max_err, mean_err = check_recursive(res, this_res) print(f'Max error = {max_err}, mean error = {mean_err} total error = {err}') print(f'Success = {(max_err < 1e-4) and (mean_err < 1e-5)}')
def invert_point_test(args, name): (tensor, point), res = load_data(args, name) qa = QuatAffine.from_tensor(tensor) this_res = qa.invert_point(point) err, max_err, mean_err = check_recursive(res, this_res) print(f'Max error = {max_err}, mean error = {mean_err} total error = {err}') print(f'Success = {(max_err < 1e-4) and (mean_err < 1e-5)}')
def init_test(args, name): args, res = load_data(args, name) qa = QuatAffine.from_tensor(*args) this_res = qa.quaternion, qa.translation, qa.rotation for a,b in zip(res, this_res): err, max_err, mean_err = check_recursive(a,b) print(f'Max error = {max_err}, mean error = {mean_err} total error = {err}') print(f'Success = {(max_err < 1e-4) and (mean_err < 1e-5)}')
def to_tensor_test(args, name): (tensor, ), res = load_data(args, name) qa = QuatAffine.from_tensor(tensor) qa = qa.apply_rotation_tensor_fn(lambda t: t+1.0) this_res = qa.to_tensor() err, max_err, mean_err = check_recursive(res,this_res) print(f'Max error = {max_err}, mean error = {mean_err} total error = {err}') print(f'Success = {(max_err < 1e-4) and (mean_err < 1e-5)}')
def apply_rot_func_test(args, name): (tensor, ), res = load_data(args, name) qa = QuatAffine.from_tensor(tensor) qa = qa.apply_rotation_tensor_fn(lambda t: t+1.0) this_res = qa.quaternion, qa.translation, qa.rotation for a,b in zip(res, this_res): err, max_err, mean_err = check_recursive(a,b) print(f'Max error = {max_err}, mean error = {mean_err} total error = {err}') print(f'Success = {(max_err < 1e-4) and (mean_err < 1e-5)}')