def test_relationship_reference(self, update, ref_path, model, lattice): reference = ref_path / f'{lattice}_{model}.txt' o = Orientation(lattice=lattice) eu = o.related(model).as_Euler_angles(degrees=True) if update: coords = np.array([(1, i + 1) for i, x in enumerate(eu)]) Table(eu,{'Eulers':(3,)})\ .add('pos',coords)\ .save(reference) assert np.allclose(eu, Table.load(reference).get('Eulers'))
def test_relationship_reference(self, update, reference_dir, model, lattice): reference = os.path.join(reference_dir, f'{lattice}_{model}.txt') ori = Orientation(Rotation(), lattice) eu = np.array( [o.rotation.as_Eulers(degrees=True) for o in ori.related(model)]) if update: coords = np.array([(1, i + 1) for i, x in enumerate(eu)]) table = Table(eu, {'Eulers': (3, )}) table = table.add('pos', coords) table.save(reference) assert np.allclose(eu, Table.load(reference).get('Eulers'))
def test_relationship_forward_backward(self, model, lattice): ori = Orientation(Rotation.from_random(), lattice) for i, r in enumerate(ori.related(model)): ori2 = r.related(model)[i] misorientation = ori.rotation.misorientation(ori2.rotation) assert misorientation.as_axis_angle(degrees=True)[3] < 1.0e-5