defdap.ebsd module¶
- class defdap.ebsd.Map(*args, **kwargs)[source]¶
Bases:
Map
Class to encapsulate an EBSD map and useful analysis and plotting methods.
- phases¶
List of phases.
- Type:
list of defdap.crystal.Phase
- mis_ori¶
Map of misorientation.
- Type:
- mis_ori_axis¶
Map of misorientation axis components.
- Type:
list of numpy.ndarray
- origin¶
Map origin (x, y). Used by linker class where origin is a homologue point of the maps.
- data¶
- Must contain after loading data (maps):
- phasenumpy.ndarray
1-based, 0 is non-indexed points
- euler_anglenumpy.ndarray
stored as (3, y_dim, x_dim) in radians
- Generated data:
- orientationnumpy.ndarray of defdap.quat.Quat
Quaterion for each point of map. Shape (y_dim, x_dim).
grain_boundaries : BoundarySet phase_boundaries : BoundarySet grains : numpy.ndarray of int
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.
- KAMnumpy.ndarray
Kernal average misorientaion map.
- GNDnumpy.ndarray
GND scalar map.
- Nye_tensornumpy.ndarray
3x3 Nye tensor at each point.
- Derived data:
Grain list data to map data from all grains
- Type:
- MAPNAME = 'ebsd'¶
- load_data(file_name, data_type=None)[source]¶
Load in EBSD data from file.
- Parameters:
file_name (pathlib.Path) – Path to EBSD file
data_type (str, {'OxfordBinary', 'OxfordText', 'EdaxAng', 'PythonDict'}) – Format of EBSD data file.
- property crystal_sym¶
Crystal symmetry of the primary phase.
- Returns:
Crystal symmetry
- Return type:
- property c_over_a¶
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 num_phases¶
- property primary_phase¶
Primary phase of the EBSD map.
- Returns:
Primary phase
- Return type:
- property scale¶
- plot_euler_map(phases=None, bg_colour=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:
- plot_ipf_map(direction, phases=None, bg_colour=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 direction.
phases (list of int) – Which phases to plot IPF data for.
bg_colour (np.array len 3) – Colour of background (i.e. for phases not plotted).
kwargs – Other arguments passed to
defdap.plotting.MapPlot.create()
.
- Return type:
- plot_phase_map(**kwargs)[source]¶
Plot a phase map.
- Parameters:
kwargs – All arguments passed to
defdap.plotting.MapPlot.create()
.- Return type:
- calc_kam()[source]¶
Calculates Kernel Average Misorientaion (KAM) for the EBSD map, based on a 3x3 kernel. Crystal symmetric equivalences are not considered. Stores result as KAM.
- calc_nye()[source]¶
Calculates Nye tensor and related GND density for the EBSD map. Stores result as Nye_tensor and GND. Uses the crystal symmetry of the primary phase.
- find_boundaries(misori_tol=10)[source]¶
Find grain and phase boundaries
- Parameters:
misori_tol (float) – Critical misorientation in degrees.
- plot_phase_boundary_map(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:
- plot_boundary_map(**kwargs)[source]¶
Plot grain boundary map.
- Parameters:
kwargs – All arguments are passed to
defdap.plotting.MapPlot.create()
.- Return type:
- find_grains(min_grain_size=10)[source]¶
Find grains and assign IDs.
- Parameters:
min_grain_size (int) – Minimum grain area in pixels.
- plot_grain_map(**kwargs)[source]¶
Plot a map with grains coloured.
- Parameters:
kwargs – All arguments are passed to
defdap.plotting.MapPlot.create()
.- Return type:
- calc_grain_mis_ori(calc_axis=False)[source]¶
Calculate the misorientation within grains.
- Parameters:
calc_axis (bool) – Calculate the misorientation axis if True.
- plot_mis_ori_map(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:
- calc_average_grain_schmid_factors(load_vector, slip_systems=None)[source]¶
Calculates Schmid factors for all slip systems, for all grains, based on average grain orientation.
- Parameters:
load_vector – Loading vector, e.g. [1, 0, 0].
slip_systems (list, optional) – Slip planes to calculate Schmid factor for, maximum of all planes calculated if not given.
- plot_average_grain_schmid_factors_map(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(grain_id, ebsdMap, group_id)[source]¶
Bases:
Grain
Class to encapsulate a grain in an EBSD map and useful analysis and plotting methods.
- ebsd_map¶
EBSD map this grain is a member of.
- Type:
- owner_map¶
EBSD map this grain is a member of.
- Type:
- phase¶
- Type:
- data¶
- Must contain after creating:
- pointlist of tuples
(x, y)
- Generated data:
GROD : numpy.ndarray
GROD_axis : numpy.ndarray
- Derived data:
Map data to list data from the map the grain is part of
- Type:
- mis_ori_listlist
MisOri at each point in grain.
- mis_ori_axis_listlist
MisOri axes at each point in grain.
- ref_oridefdap.quat.Quat
Average ori of grain
- average_mis_ori
Average mis_ori of grain.
- average_schmid_factorslist
List of list Schmid factors (grouped by slip plane).
- slip_trace_angleslist
Slip trace angles in screen plane.
- slip_trace_inclinationslist
Angle between slip plane and screen plane.
- property crystal_sym¶
Temporary
- build_mis_ori_list(calc_axis=False)[source]¶
Calculate the misorientation within given grain.
- Parameters:
calc_axis (bool) – Calculate the misorientation axis if True.
- plot_ref_ori(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.plot_ipf()
.
- Return type:
- plot_ori_spread(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.plot_ipf()
.
- Return type:
- plot_unit_cell(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.plot_unit_cell()
.
- plot_mis_ori(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.plot_grain_data()
.
- Return type:
- calc_average_schmid_factors(load_vector, slip_systems=None)[source]¶
Calculate Schmid factors for grain, using average orientation.
- Parameters:
load_vector (numpy.ndarray) – Loading vector, i.e. [1, 0, 0]
slip_systems (list, optional) – Slip planes to calculate Schmid factor for. Maximum for all planes used if not set.
- property slip_traces¶
Returns list of slip trace angles.
- Returns:
Slip trace angles based on grain orientation in calc_slip_traces.
- Return type:
- calc_slip_traces(slip_systems=None)[source]¶
Calculates list of slip trace angles based on grain orientation.
- Parameters:
slip_systems (defdap.crystal.SlipSystem, optional) –
- class defdap.ebsd.BoundarySet(ebsd_map, points_x, points_y)[source]¶
Bases:
object
- property points¶
- property image_x¶
- property image_y¶
- property image¶
- property lines¶
- class defdap.ebsd.BoundarySegment(ebsdMap, grain1, grain2)[source]¶
Bases:
object
- boundary_point_pairs(kind)[source]¶
Return pairs of points either side of the boundary. The first point is always in grain1
- property boundary_point_pairs_x¶
Return pairs of points either side of the boundary. The first point is always in grain1
- property boundary_point_pairs_y¶
Return pairs of points either side of the boundary. The first point is always in grain1
- property boundary_lines¶
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]¶
Interactive tool to set origin of each EBSD map.
- Parameters:
kwargs – Keyword arguments passed to
defdap.ebsd.Map.plot_default()
- 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.