def test_Schmid(self, update, ref_path, lattice, mode): L = Orientation(lattice=lattice) reference = ref_path / f'{lattice}_{mode}.txt' P = L.Schmid(mode) if update: table = Table(P.reshape(-1, 9), {'Schmid': ( 3, 3, )}) table.save(reference) assert np.allclose(P, Table.load(reference).get('Schmid'))
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_Schmid(self, update, ref_path, lattice): O = Orientation(lattice=lattice) # noqa for mode in ['slip', 'twin']: reference = ref_path / f'{lattice}_{mode}.txt' P = O.Schmid(N_slip='*') if mode == 'slip' else O.Schmid( N_twin='*') if update: table = Table(P.reshape(-1, 9), {'Schmid': ( 3, 3, )}) table.save(reference) assert np.allclose(P, Table.load(reference).get('Schmid'))