print("# Matches grains using symmetry group from: ") print( "# [cubic|hexagonal|trigonal|rhombohedralP|tetragonal|orthorhombic|monoclinic_[a|b|c]|triclinic]" ) g1l = grain.read_grain_file(sys.argv[1]) g2l = grain.read_grain_file(sys.argv[2]) for g in g1l + g2l: if g.translation is None: g.translation = np.zeros(3) try: h = getattr(sym_u, sys.argv[3])() except: print("# No group!") print("#Using cubic") h = sym_u.cubic() print("# Symmetry considered") for o in h.group: print(o) try: tolangle = float(sys.argv[4]) except: tolangle = 1.0 try: toldist = float(sys.argv[5]) except: toldist = 100.0 dt0 = np.array([0., 0., 0.])
from ImageD11.sym_u import cubic from ImageD11.columnfile import columnfile import numpy as np, sys, xfab.tools # Cubic symmetry operators m = np.array(cubic().group) # print m.shape def process_file(f, g, ip, jp, npoint): """ f = gff file / sinfit file g = columnfile with allgrains output i, j = origin position in sample n = point number """ try: c = columnfile(f + ".gff") except: # print "No grains" # print # print return u = [] u_uniq = [] for i in range(c.nrows): ut = np.array([[c.U11[i], c.U12[i], c.U13[i]], [c.U21[i], c.U22[i], c.U23[i]], [c.U31[i], c.U32[i], c.U33[i]]]) uniq = np.dot(m, ut).trace(axis1=1, axis2=2).argmax() u_uniq.append(np.dot(m[uniq], ut))