meaningful result

This commit is contained in:
Martin Diehl 2020-12-02 14:45:47 +01:00
parent c880052250
commit d3a5979d25
2 changed files with 6 additions and 5 deletions

View File

@ -780,7 +780,7 @@ class Result:
@staticmethod
def _add_IPF_color(q,l):
def _add_IPF_color(l,q):
m = util.scale_to_coprime(np.array(l))
try:
lattice = {'fcc':'cF','bcc':'cI','hex':'hP'}[q['meta']['Lattice']]
@ -798,16 +798,17 @@ class Result:
'Creator': 'add_IPF_color'
}
}
def add_IPF_color(self,q,l):
def add_IPF_color(self,l,q='O'):
"""
Add RGB color tuple of inverse pole figure (IPF) color.
Parameters
----------
q : str
Label of the dataset containing the crystallographic orientation as quaternions.
l : numpy.array of shape (3)
Lab frame direction for inverse pole figure.
q : str
Label of the dataset containing the crystallographic orientation as quaternions.
Defaults to 'O'.
"""
self._add_generic_pointwise(self._add_IPF_color,{'q':q},{'l':l})

View File

@ -169,7 +169,7 @@ class TestResult:
@pytest.mark.parametrize('d',[[1,0,0],[0,1,0],[0,0,1]])
def test_add_IPF_color(self,default,d):
default.add_IPF_color('O',np.array(d))
default.add_IPF_color(d,'O')
loc = {'O': default.get_dataset_location('O'),
'color': default.get_dataset_location('IPFcolor_[{} {} {}]'.format(*d))}
qu = default.read_dataset(loc['O']).view(np.double).squeeze()