bugfix for ConfigMaterial
don't use mutable variables in python initializers, they get updated
This commit is contained in:
parent
84e383964b
commit
a3ab890315
|
@ -18,21 +18,19 @@ class ConfigMaterial(Config):
|
||||||
stored as 'material.yaml'.
|
stored as 'material.yaml'.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_defaults = {'material': [],
|
|
||||||
'homogenization': {},
|
|
||||||
'phase': {}}
|
|
||||||
|
|
||||||
def __init__(self,d=_defaults):
|
def __init__(self,d=None):
|
||||||
"""
|
"""
|
||||||
New material configuration.
|
New material configuration.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
d : dictionary, optional
|
d : dictionary, optional
|
||||||
Initial content. Defaults to empty material, homogenization, and phase entries.
|
Initial content. Defaults to None, in which case empty entries for
|
||||||
|
material, homogenization, and phase are created.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super().__init__(d)
|
super().__init__({'material': [], 'homogenization': {}, 'phase': {}} if d is None else d)
|
||||||
|
|
||||||
|
|
||||||
def save(self,fname='material.yaml',**kwargs):
|
def save(self,fname='material.yaml',**kwargs):
|
||||||
|
|
|
@ -29,16 +29,26 @@ class Rotation:
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
Rotate vector "a" (defined in coordinate system "A") to
|
Rotate vector 'a' (defined in coordinate system 'A') to
|
||||||
coordinates "b" expressed in system "B":
|
coordinates 'b' expressed in system 'B':
|
||||||
|
|
||||||
- b = Q @ a
|
>>> import damask
|
||||||
- b = np.dot(Q.as_matrix(),a)
|
>>> import numpy as np
|
||||||
|
>>> Q = damask.Rotation.from_random()
|
||||||
|
>>> a = np.random.rand(3)
|
||||||
|
>>> b = R @ a
|
||||||
|
>>> np.allclose(np.dot(Q.as_matrix(),a),b)
|
||||||
|
True
|
||||||
|
|
||||||
Compound rotations R1 (first) and R2 (second):
|
Compound rotations R1 (first) and R2 (second):
|
||||||
|
|
||||||
- R = R2 * R1
|
>>> import damask
|
||||||
- R = Rotation.from_matrix(np.dot(R2.as_matrix(),R1.as_matrix())
|
>>> import numpy as np
|
||||||
|
>>> R1 = damask.Rotation.from_random()
|
||||||
|
>>> R2 = damask.Rotation.from_random()
|
||||||
|
>>> R = R2 * R1
|
||||||
|
>>> np.allclose(R.as_matrix(), np.dot(R2.as_matrix(),R1.as_matrix()))
|
||||||
|
True
|
||||||
|
|
||||||
References
|
References
|
||||||
----------
|
----------
|
||||||
|
|
|
@ -126,13 +126,14 @@ class Table:
|
||||||
Load from ang file.
|
Load from ang file.
|
||||||
|
|
||||||
A valid TSL ang file needs to contains the following columns:
|
A valid TSL ang file needs to contains the following columns:
|
||||||
* Euler angles (Bunge notation) in radians, 3 floats, label 'eu'.
|
|
||||||
* Spatial position in meters, 2 floats, label 'pos'.
|
- Euler angles (Bunge notation) in radians, 3 floats, label 'eu'.
|
||||||
* Image quality, 1 float, label 'IQ'.
|
- Spatial position in meters, 2 floats, label 'pos'.
|
||||||
* Confidence index, 1 float, label 'CI'.
|
- Image quality, 1 float, label 'IQ'.
|
||||||
* Phase ID, 1 int, label 'ID'.
|
- Confidence index, 1 float, label 'CI'.
|
||||||
* SEM signal, 1 float, label 'intensity'.
|
- Phase ID, 1 int, label 'ID'.
|
||||||
* Fit, 1 float, label 'fit'.
|
- SEM signal, 1 float, label 'intensity'.
|
||||||
|
- Fit, 1 float, label 'fit'.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
|
|
Loading…
Reference in New Issue