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'.
|
||||
"""
|
||||
|
||||
_defaults = {'material': [],
|
||||
'homogenization': {},
|
||||
'phase': {}}
|
||||
|
||||
def __init__(self,d=_defaults):
|
||||
def __init__(self,d=None):
|
||||
"""
|
||||
New material configuration.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
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):
|
||||
|
|
|
@ -29,16 +29,26 @@ class Rotation:
|
|||
|
||||
Examples
|
||||
--------
|
||||
Rotate vector "a" (defined in coordinate system "A") to
|
||||
coordinates "b" expressed in system "B":
|
||||
Rotate vector 'a' (defined in coordinate system 'A') to
|
||||
coordinates 'b' expressed in system 'B':
|
||||
|
||||
- b = Q @ a
|
||||
- b = np.dot(Q.as_matrix(),a)
|
||||
>>> import damask
|
||||
>>> 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):
|
||||
|
||||
- R = R2 * R1
|
||||
- R = Rotation.from_matrix(np.dot(R2.as_matrix(),R1.as_matrix())
|
||||
>>> import damask
|
||||
>>> 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
|
||||
----------
|
||||
|
|
|
@ -126,13 +126,14 @@ class Table:
|
|||
Load from ang file.
|
||||
|
||||
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'.
|
||||
* Image quality, 1 float, label 'IQ'.
|
||||
* Confidence index, 1 float, label 'CI'.
|
||||
* Phase ID, 1 int, label 'ID'.
|
||||
* SEM signal, 1 float, label 'intensity'.
|
||||
* Fit, 1 float, label 'fit'.
|
||||
|
||||
- Euler angles (Bunge notation) in radians, 3 floats, label 'eu'.
|
||||
- Spatial position in meters, 2 floats, label 'pos'.
|
||||
- Image quality, 1 float, label 'IQ'.
|
||||
- Confidence index, 1 float, label 'CI'.
|
||||
- Phase ID, 1 int, label 'ID'.
|
||||
- SEM signal, 1 float, label 'intensity'.
|
||||
- Fit, 1 float, label 'fit'.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
Loading…
Reference in New Issue