def test_write_parameters(self): params = RBFParameters() params.read_parameters('tests/test_datasets/parameters_rbf_cube.prm') outfilename = 'tests/test_datasets/parameters_rbf_cube_out.prm' outfilename_expected = 'tests/test_datasets/parameters_rbf_cube_out_true.prm' params.write_parameters(outfilename) self.assertTrue(filecmp.cmp(outfilename, outfilename_expected)) os.remove(outfilename)
def test_write_parameters_filename_default_existance(self): params = RBFParameters() params.basis = 'inv_multi_quadratic_biharmonic_spline' params.radius = 0.1 params.original_control_points = np.array( [0., 0., 0., 0., 0., 1., 0., 1., 0.]).reshape((3, 3)) params.deformed_control_points = np.array( [0., 0., 0., 0., 0., 1., 0., 1., 0.]).reshape((3, 3)) params.write_parameters() outfilename = 'parameters_rbf.prm' assert os.path.isfile(outfilename) os.remove(outfilename)
def test_write_parameters_filename_default(self): params = RBFParameters() params.basis = 'gaussian_spline' params.radius = 0.5 params.power = 2 params.original_control_points = unit_cube params.deformed_control_points = unit_cube outfilename = 'test.prm' params.write_parameters(outfilename) outfilename_expected = 'tests/test_datasets/parameters_rbf_default.prm' print(filecmp.cmp(outfilename, outfilename_expected)) self.assertTrue(filecmp.cmp(outfilename, outfilename_expected)) os.remove(outfilename)
def test_write_parameters_failing_filename_type(self): params = RBFParameters() with self.assertRaises(TypeError): params.write_parameters(5)