add_pole now has option "with_symmetry"
This commit is contained in:
parent
d2bd6e16ca
commit
9b695fd3fe
|
@ -983,20 +983,22 @@ class Result:
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _add_pole(q,uvw,hkl):
|
def _add_pole(q,uvw,hkl,with_symmetry):
|
||||||
c = q['meta']['c/a'] if 'c/a' in q['meta'] else 1
|
c = q['meta']['c/a'] if 'c/a' in q['meta'] else 1
|
||||||
pole = Orientation(q['data'], lattice=q['meta']['lattice'], a=1, c=c).to_pole(uvw=uvw,hkl=hkl)
|
pole = Orientation(q['data'],lattice=q['meta']['lattice'],a=1,c=c).to_pole(uvw=uvw,hkl=hkl,with_symmetry=with_symmetry)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'data': pole,
|
'data': pole,
|
||||||
'label': 'p^[{} {} {}]'.format(*uvw) if uvw else 'p^({} {} {})'.format(*hkl),
|
'label': 'p^[{} {} {}]'.format(*uvw) if uvw else 'p^({} {} {})'.format(*hkl),
|
||||||
'meta' : {
|
'meta' : {
|
||||||
'unit': '1',
|
'unit': '1',
|
||||||
'description': f"lab frame vector along lattice {'direction' if uvw else 'plane'}",
|
'description': 'lab frame vector along lattice ' \
|
||||||
|
+ ('direction' if uvw else 'plane') \
|
||||||
|
+ ('s' if with_symmetry else ''),
|
||||||
'creator': 'add_pole'
|
'creator': 'add_pole'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def add_pole(self,q='O',*,uvw=None,hkl=None):
|
def add_pole(self,q='O',*,uvw=None,hkl=None,with_symmetry=False):
|
||||||
"""
|
"""
|
||||||
Add lab frame vector along lattice direction [uvw] or plane normal (hkl).
|
Add lab frame vector along lattice direction [uvw] or plane normal (hkl).
|
||||||
|
|
||||||
|
@ -1007,9 +1009,11 @@ class Result:
|
||||||
Defaults to 'O'.
|
Defaults to 'O'.
|
||||||
uvw|hkl : numpy.ndarray of shape (...,3)
|
uvw|hkl : numpy.ndarray of shape (...,3)
|
||||||
Miller indices of crystallographic direction or plane normal.
|
Miller indices of crystallographic direction or plane normal.
|
||||||
|
with_symmetry : bool, optional
|
||||||
|
Calculate all N symmetrically equivalent vectors.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self._add_generic_pointwise(self._add_pole,{'q':q},{'uvw':uvw,'hkl':hkl})
|
self._add_generic_pointwise(self._add_pole,{'q':q},{'uvw':uvw,'hkl':hkl,'with_symmetry':with_symmetry})
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -219,7 +219,8 @@ class TestResult:
|
||||||
in_file = default.place('S')
|
in_file = default.place('S')
|
||||||
assert np.allclose(in_memory,in_file)
|
assert np.allclose(in_memory,in_file)
|
||||||
|
|
||||||
@pytest.mark.parametrize('options',[{'uvw':[1,0,0]},{'hkl':[0,1,1]}])
|
@pytest.mark.parametrize('options',[{'uvw':[1,0,0],'with_symmetry':False},
|
||||||
|
{'hkl':[0,1,1],'with_symmetry':True}])
|
||||||
def test_add_pole(self,default,options):
|
def test_add_pole(self,default,options):
|
||||||
default.add_pole(**options)
|
default.add_pole(**options)
|
||||||
rot = default.place('O')
|
rot = default.place('O')
|
||||||
|
|
Loading…
Reference in New Issue