defdap.ebsd module¶
- class defdap.ebsd.Map(fileName, dataType=None)[source]¶
Bases:
Map
Class to encapsulate an EBSD map and useful analysis and plotting methods.
- eulerAngleArray¶
Euler angles for eaxh point of the map. Shape (3, yDim, xDim).
- Type:
- bandContrastArray¶
Band contrast for each point of map. Shape (yDim, xDim).
- Type:
- quatArray¶
Quaterions for each point of map. Shape (yDim, xDim).
- Type:
numpy.ndarray of defdap.quat.Quat
- phaseArray¶
Map of phase ids. 1-based, 0 is non-indexed points
- Type:
- phases¶
List of phases.
- Type:
list of defdap.crystal.Phase
- boundaries¶
Map of boundaries. -1 for a boundary, 0 otherwise.
- Type:
- phaseBoundaries¶
Map of phase boundaries. -1 for boundary, 0 otherwise.
- Type:
- grains¶
Map of grains. Grain numbers start at 1 here but everywhere else grainID starts at 0. Regions that are smaller than the minimum grain size are given value -2. Remnant boundary points are -1.
- Type:
- misOri¶
Map of misorientation.
- Type:
- misOriAxis¶
Map of misorientation axis components.
- Type:
list of numpy.ndarray
- kam¶
Map of KAM.
- Type:
- origin¶
Map origin (x, y). Used by linker class where origin is a homologue point of the maps.
- GND¶
GND scalar map.
- Type:
- Nye¶
3x3 Nye tensor at each point.
- Type:
- property crystalSym¶
Crystal symmetry of the primary phase.
- Returns:
Crystal symmetry
- Return type:
- property cOverA¶
C over A ratio of the primary phase
- Returns:
C over A ratio if hexagonal crystal structure otherwise None
- Return type:
float or None
- property numPhases¶
- property primaryPhase¶
Primary phase of the EBSD map.
- Returns:
Primary phase
- Return type:
- property scale¶
- plotBandContrastMap(**kwargs)[source]¶
Plot band contrast map
- kwargs
All arguments are passed to
defdap.plotting.MapPlot.create()
.
- Return type:
- plotEulerMap(phases=None, **kwargs)[source]¶
Plot an orientation map in Euler colouring
- Parameters:
phases (list of int) – Which phases to plot for
kwargs – All arguments are passed to
defdap.plotting.MapPlot.create()
.
- Return type:
- plotIPFMap(direction, backgroundColour=None, phases=None, **kwargs)[source]¶
Plot a map with points coloured in IPF colouring, with respect to a given sample direction.
- Parameters:
direction (np.array len 3) – Sample directiom.
backgroundColour (np.array len 3) – Colour of background (i.e. for phases not plotted).
phases (list of int) – Which phases to plot IPF data for.
kwargs – Other arguments passed to
defdap.plotting.MapPlot.create()
.
- Return type:
- plotPhaseMap(**kwargs)[source]¶
Plot a phase map.
- Parameters:
kwargs – All arguments passed to
defdap.plotting.MapPlot.create()
.- Return type:
- calcKam()[source]¶
Calculates Kernel Average Misorientaion (KAM) for the EBSD map, based on a 3x3 kernel. Crystal symmetric equivalences are not considered. Stores result in self.kam.
- plotKamMap(**kwargs)[source]¶
Plot Kernel Average Misorientaion (KAM) for the EBSD map.
- Parameters:
kwargs – All arguments are passed to
defdap.plotting.MapPlot.create()
.- Return type:
- calcNye()[source]¶
Calculates Nye tensor and related GND density for the EBSD map. Stores result in self.Nye and self.GND. Uses the crystal symmetry of the primary phase.
- plotGNDMap(**kwargs)[source]¶
Plots a map of geometrically necessary dislocation (GND) density
- Parameters:
kwargs – All arguments are passed to
defdap.plotting.MapPlot.create()
.- Return type:
- buildQuatArray(force=False)[source]¶
Build quaternion array
- Parameters:
force (bool, optional) – If true, re-build quaternion array
- findBoundaries(boundDef=10)[source]¶
Find grain and phase boundaries
- Parameters:
boundDef (float) – Critical misorientation.
- plotPhaseBoundaryMap(dilate=False, **kwargs)[source]¶
Plot phase boundary map.
- Parameters:
dilate (bool) – If true, dilate boundary.
kwargs – All other arguments are passed to
defdap.plotting.MapPlot.create()
.
- Return type:
- plotBoundaryMap(**kwargs)[source]¶
Plot grain boundary map.
- Parameters:
kwargs – All arguments are passed to
defdap.plotting.MapPlot.create()
.- Return type:
- findGrains(minGrainSize=10)[source]¶
Find grains and assign IDs.
- Parameters:
minGrainSize (int) – Minimum grain area in pixels.
- plotGrainMap(**kwargs)[source]¶
Plot a map with grains coloured.
- Parameters:
kwargs – All arguments are passed to
defdap.plotting.MapPlot.create()
.- Return type:
- floodFill(x, y, grainIndex, points_left)[source]¶
Flood fill algorithm that uses the x and y boundary arrays to fill a connected area around the seed point. The points are inserted into a grain object and the grain map array is updated.
- Parameters:
x (int) – Seed point x for flood fill
y (int) – Seed point y for flood fill
grainIndex (int) – Value to fill in grain map
points_left (numpy.ndarray) – Boolean map of the points that have not been assigned a grain yet
- Returns:
currentGrain – New grain object with points added
- Return type:
- calcGrainMisOri(calcAxis=False)[source]¶
Calculate the misorientation within grains.
- Parameters:
calcAxis (bool) – Calculate the misorientation axis if True.
- plotMisOriMap(component=0, **kwargs)[source]¶
Plot misorientation map.
- Parameters:
component (int, {0, 1, 2, 3}) – 0 gives misorientation, 1, 2, 3 gives rotation about x, y, z
kwargs – All other arguments are passed to
defdap.plotting.MapPlot.create()
.
- Return type:
- calcAverageGrainSchmidFactors(loadVector, slipSystems=None)[source]¶
Calculates Schmid factors for all slip systems, for all grains, based on average grain orientation.
- Parameters:
loadVector – Loading vector, e.g. [1, 0, 0].
slipSystems (list, optional) – Slip planes to calculate Schmid factor for, maximum of all planes calculated if not given.
- plotAverageGrainSchmidFactorsMap(planes=None, directions=None, **kwargs)[source]¶
Plot maximum Schmid factor map, based on average grain orientation (for all slip systems unless specified).
- Parameters:
planes (list, optional) – Plane ID(s) to consider. All planes considered if not given.
directions (list, optional) – Direction ID(s) to consider. All directions considered if not given.
kwargs – All other arguments are passed to
defdap.plotting.MapPlot.create()
.
- Return type:
- class defdap.ebsd.Grain(grainID, ebsdMap)[source]¶
Bases:
Grain
Class to encapsulate a grain in an EBSD map and useful analysis and plotting methods.
- ebsdMap¶
EBSD map this grain is a member of.
- Type:
- ownerMap¶
EBSD map this grain is a member of.
- Type:
- phase¶
- Type:
- refOri¶
Average ori of grain
- Type:
- averageMisOri¶
Average misOri of grain.
- property plotDefault¶
- property crystalSym¶
Temporary
- addPoint(coord, quat)[source]¶
Append a coordinate and a quat to a grain.
- Parameters:
coord (tuple) – (x,y) coordinate to append
quat (defdap.quat.Quat) – Quaternion to append.
- buildMisOriList(calcAxis=False)[source]¶
Calculate the misorientation within given grain.
- Parameters:
calcAxis (bool) – Calculate the misorientation axis if True.
- plotRefOri(direction=array([0, 0, 1]), **kwargs)[source]¶
Plot the average grain orientation on an IPF.
- Parameters:
direction (numpy.ndarray) – Sample direction for IPF.
kwargs – All other arguments are passed to
defdap.quat.Quat.plotIPF()
.
- Return type:
- plotOriSpread(direction=array([0, 0, 1]), **kwargs)[source]¶
Plot all orientations within a given grain, on an IPF.
- Parameters:
direction (numpy.ndarray) – Sample direction for IPF.
kwargs – All other arguments are passed to
defdap.quat.Quat.plotIPF()
.
- Return type:
- plotUnitCell(fig=None, ax=None, plot=None, **kwargs)[source]¶
Plot an unit cell of the average grain orientation.
- Parameters:
fig (matplotlib.figure.Figure) – Matplotlib figure to plot on
ax (matplotlib.figure.Figure) – Matplotlib figure to plot on
plot (defdap.plotting.PolePlot) – defdap plot to plot the figure to.
kwargs – All other arguments are passed to
defdap.quat.Quat.plotUnitCell()
.
- plotMisOri(component=0, **kwargs)[source]¶
Plot misorientation map for a given grain.
- Parameters:
component (int, {0, 1, 2, 3}) – 0 gives misorientation, 1, 2, 3 gives rotation about x, y, z.
kwargs – All other arguments are passed to
defdap.ebsd.plotGrainData()
.
- Return type:
- calcAverageSchmidFactors(loadVector, slipSystems=None)[source]¶
Calculate Schmid factors for grain, using average orientation.
- Parameters:
loadVector (numpy.ndarray) – Loading vector, i.e. [1, 0, 0]
slipSystems (list, optional) – Slip planes to calculate Schmid factor for. Maximum for all planes used if not set.
- property slipTraces¶
Returns list of slip trace angles.
- Returns:
Slip trace angles based on grain orientation in calcSlipTraces.
- Return type:
- calcSlipTraces(slipSystems=None)[source]¶
Calculates list of slip trace angles based on grain orientation.
- Parameters:
slipSystems (defdap.crystal.SlipSystem, optional) –
- class defdap.ebsd.BoundarySegment(ebsdMap, grain1, grain2)[source]¶
Bases:
object
- boundaryPointPairs(kind)[source]¶
Return pairs of points either side of the boundary. The first point is always in grain1
- property boundaryPointPairsX¶
Return pairs of points either side of the boundary. The first point is always in grain1
- property boundaryPointPairsY¶
Return pairs of points either side of the boundary. The first point is always in grain1
- property boundaryLines¶
Return line points along this boundary segment
- class defdap.ebsd.Linker(ebsd_maps)[source]¶
Bases:
object
Class for linking multiple EBSD maps of the same region for analysis of deformation.
- links¶
List of grain link. Each link is stored as a tuple of grain IDs (one from each map stored in same order of maps).
- plots¶
List of last opened plot of each map.
- Type:
- set_origin(**kwargs)[source]¶
Interacive tool to set origin of each EBSD map.
- Parameters:
kwargs – Keyword arguments passed to
defdap.ebsd.Map.plotDefault()
- click_set_origin(event, plot)[source]¶
Event handler for clicking to set origin of map.
- Parameters:
event – Click event.
plot (defdap.plotting.MapPlot) – Plot to capture clicks from.
- click_grain_guess(event, plot)[source]¶
Guesses grain position in other maps, given click on one.
- Parameters:
event – Click handler.
plot (defdap.plotting.Plot) – Plot to capture clicks from.