Module: xrd.grain¶
1 Class¶
- class hexrd.xrd.grain.Grain(spots, refineFlags=None, pVec=None, grainData=None, **kwargs)[source]¶
Bases: object
A (maybe) indexed grain
method to fit: centroid, orientation, strain, strain+orientation; small and large-strain versions indices into spots a reference to spots? reference lattice parameters – not planeData in case it gets changed with pressure
fitting methods for orientation, stretch, and centroid?
what happens if fit a spot and the fit is bad? what if decide to refine the spot into two spots for clear cases of modest overlap? does that happen often enough that we need to worry about it? should Spots class handle a change in spot numbers: NO can Spot fit methods easily be generalized? Spot should probably barf if asked for fit center if multiple peaks found unless an index is given for which peak set claimbedBy for spots that are found to be bad? – yes, and then if another grain wants to claim the spot, it can ask the claiming grain to hand over the spot or tell it whether there are multiple peaks or whatever
- bMat¶
Returns the reciprocal lattice vector components consistent with the stretch tensor. components are written in the CRYSTAL FRAME.
- checkClaims()[source]¶
useful if have not done claims yet and want to check and see if spots are still available; updates completeness too
- claimSpots(asMaster=None)[source]¶
claim spots; particularly useful if claimingSpots was False on init; assume conflicts are handled elsewhere or ignored if want to claim spots using this method;
- fMat¶
Returns the lattice vector components consistent with the stretch tensor. Components are written in the CRYSTAL FRAME.
- fit(xtol=1e-12, ftol=1e-12, fitPVec=True, display=True, fout=None)[source]¶
Fits the cell distortion and orientation with respect to the reference in terms of the deformation gradient F = R * U where R is proper orthogonal and U is symmetric positive-definite; i.e. the right polar decomposition factors.
- fitPrecession(weighting=False, display=True, xtol=1e-12, ftol=1e-12, fout=None)[source]¶
Fit the Center-Of-Mass coordinates of the grain in the sample frame
- getAlignmentRotation()[source]¶
num.dot(q, num.eye(3) - 2 * num.diag(num.diag(num.dot(r.T, fMat)) < 0))
- getCellVolume()[source]¶
Returns the volume of the direct lattice consistent with the stretch tensor.
- getFitResid(fitPVec=True, norm=None)[source]¶
returns as shape (n,3), so that len of return value is number of vectors
- getLatticeVectors()[source]¶
Returns the lattice vector components consistent with the stretch tensor. Components are written in the CRYSTAL FRAME.
- getReciprocalLatticeVectors()[source]¶
Returns the reciprocal lattice vector components consistent with the stretch tensor. components are written in the CRYSTAL FRAME.
- getRightStretchTensor()[source]¶
Returns the components of the right stretch tensor, which is symmetric positive-definite. Components are written in the CRYSTAL FRAME. The output is calculated as: U = R^T * V * R This is for convenience and cannot be set independently to preserve self-consistency.
- getStretchTensor()[source]¶
Returns the components of the left stretch tensor, which is symmetric positive-definite. Components are written in the SAMPLE FRAME. This is the primary representation of the stretch tensor in the code base
- latticeParameters¶
Returns the lattice parameters consistent with stretch tensor
- minimizeFiberDistance(xtol=1e-12, ftol=1e-12)[source]¶
find orientation by minimizing distance to all fibers
- newGrain(newSpots, claimingSpots=False, lineage=None, phaseID=None, rMatTransf=None, vMat=None, omeTol=None, etaTol=None, **kwargs)[source]¶
return a new grain instance without changing self; the new instance will use newSpots;
NOTE: claimingSpots is False by default, so if a grain is to be kept, may want to call claimSpots() method
phaseID and rMatTransf are useful for twins or phase transformations
- referenceLatticeParameters¶
Return the reference lattice parameters stored on self
- setStretchTensor(vVec)[source]¶
Sets stretch tensor properly from a 6-vector in the Mandel-Voigt notation.
SEE ALSO: matrixutil.vecMVToSymm()
- strip()[source]¶
meant for multiprocessing, to strip out things that do not really need to be pickled and sent
- uMat¶
Returns the components of the right stretch tensor, which is symmetric positive-definite. Components are written in the CRYSTAL FRAME. The output is calculated as: U = R^T * V * R This is for convenience and cannot be set independently to preserve self-consistency.
- updateGVecs(rMat=None, bMat=None, chiTilt=None)[source]¶
special routine for updating the predicted G-vector angles for subsequent fitting *) need to do this after updating chiTilt, or fixed bMat, etc... *) assumption is that the changes are SMALL so that the existing list of
valid reflection is still valid...
- vMat¶
Returns the components of the left stretch tensor, which is symmetric positive-definite. Components are written in the SAMPLE FRAME. This is the primary representation of the stretch tensor in the code base
- vol¶
Returns the volume of the direct lattice consistent with the stretch tensor.