using new Orientation class

This commit is contained in:
Martin Diehl 2019-02-24 08:08:14 +01:00
parent 9dc8dff4b1
commit d3ac3cc0f5
8 changed files with 244 additions and 727 deletions

View File

@ -207,7 +207,9 @@ Post_ParaviewRelated:
Post_OrientationConversion: Post_OrientationConversion:
stage: postprocessing stage: postprocessing
script: OrientationConversion/test.py script:
- OrientationConversion/test.py
- OrientationConversion/test2.py
except: except:
- master - master
- release - release

@ -1 +1 @@
Subproject commit f0090997df817f0a0b5a480a60e81929875b1010 Subproject commit 8deb37dd4526fb5e1425fe1d2360508d01b6ac3e

View File

@ -41,6 +41,10 @@ parser.set_defaults(pole = (0.0,0.0,1.0),
(options, filenames) = parser.parse_args() (options, filenames) = parser.parse_args()
# damask.Orientation requires Bravais lattice, but we are only interested in symmetry
symmetry2lattice={'cubic':'bcc','hexagonal':'hex','tetragonal':'bct'}
lattice = symmetry2lattice[options.symmetry]
pole = np.array(options.pole) pole = np.array(options.pole)
pole /= np.linalg.norm(pole) pole /= np.linalg.norm(pole)
@ -78,8 +82,8 @@ for name in filenames:
outputAlive = True outputAlive = True
while outputAlive and table.data_read(): # read next data line of ASCII table while outputAlive and table.data_read(): # read next data line of ASCII table
o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))), o = damask.Orientation(np.array(list(map(float,table.data[column:column+4]))),
symmetry = options.symmetry).reduced() lattice = lattice).reduced()
table.data_append(o.IPFcolor(pole)) table.data_append(o.IPFcolor(pole))
outputAlive = table.data_write() # output processed line outputAlive = table.data_write() # output processed line

View File

@ -75,9 +75,9 @@ for name in filenames:
# ------------------------------------------ process data ------------------------------------------ # ------------------------------------------ process data ------------------------------------------
outputAlive = True outputAlive = True
while outputAlive and table.data_read(): # read next data line of ASCII table while outputAlive and table.data_read(): # read next data line of ASCII table
o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4])))) o = damask.Rotation(np.array(list(map(float,table.data[column:column+4]))))
rotatedPole = o.quaternion*pole # rotate pole according to crystal orientation rotatedPole = o*pole # rotate pole according to crystal orientation
(x,y) = rotatedPole[0:2]/(1.+abs(pole[2])) # stereographic projection (x,y) = rotatedPole[0:2]/(1.+abs(pole[2])) # stereographic projection
table.data_append([np.sqrt(x*x+y*y),np.arctan2(y,x)] if options.polar else [x,y]) # cartesian coordinates table.data_append([np.sqrt(x*x+y*y),np.arctan2(y,x)] if options.polar else [x,y]) # cartesian coordinates

View File

@ -31,7 +31,7 @@ parser.add_option('--degrees',
action = 'store_true', action = 'store_true',
help = 'angles are given in degrees') help = 'angles are given in degrees')
parser.set_defaults(rotation = (0.,1.,0.,0.), # no rotation about 1,0,0 parser.set_defaults(rotation = (0.,1.,1.,1.), # no rotation about 1,1,1
degrees = False, degrees = False,
) )

View File

@ -52,11 +52,8 @@ parser.add_option('--crystallite',
parser.set_defaults(symmetry = [damask.Symmetry.lattices[-1]], parser.set_defaults(symmetry = [damask.Symmetry.lattices[-1]],
tolerance = 0.0,
degrees = False,
homogenization = 1, homogenization = 1,
crystallite = 1, crystallite = 1,
verbose = False,
pos = 'pos', pos = 'pos',
) )

View File

@ -13,7 +13,7 @@ from .asciitable import ASCIItable # noqa
from .config import Material # noqa from .config import Material # noqa
from .colormaps import Colormap, Color # noqa from .colormaps import Colormap, Color # noqa
from .orientation import Quaternion, Symmetry, Rotation, Orientation # noqa from .orientation import Symmetry, Lattice, Rotation, Orientation # noqa
#from .block import Block # only one class #from .block import Block # only one class
from .result import Result # noqa from .result import Result # noqa

File diff suppressed because it is too large Load Diff