upxo.viz.ebsd_maps module
Figures for 2D orientation maps (EBSD maps).
Each function takes plain arrays and returns a matplotlib.figure.Figure
without showing it, so the caller decides where it goes. Axes are in
micrometres when step_um is given; the y axis points down, as in an image.
- upxo.viz.ebsd_maps.euler_map_figure(lfi, euler_rad, angle_index, cmap='hsv', step_um=1.0, show_boundaries=True, boundary_color=(0, 0, 0), figsize=(6.5, 6.5), polygons=None, grains=None, pixel_stride=1, title=None, show_axes=True, show_scale_bar=False, font_sizes=None, xlim=None, ylim=None, dpi=None)[source]
One Bunge Euler angle (phi1, Phi or phi2) as a single pixel map – or, if polygons is given, a Smoothed display: each grain filled with its own mean angle (see module docstring’s Pixellated/Smoothed note – a filled polygon has one color, so intra-grain pixel variation isn’t shown in Smoothed mode the way it is in Pixellated).
angle_index : 0 (phi1), 1 (Phi), or 2 (phi2). polygons, grains : output of ebsd_smoothing.smooth_technique_a/b. When given, pixel_stride is ignored (Smoothed mode doesn’t rasterize at all, so there is nothing to subsample). pixel_stride : int >= 1 – Pixellated mode only. Show every Nth pixel along each axis (nearest-neighbour subsampling, same physical extent) for a faster, lighter plot of a large map. title : str, optional – replaces the default “Bunge <angle>” title. show_axes : bool – False hides the axes, ticks and labels (the colour bar stays). show_scale_bar : bool – draw a length scale bar (the axes are in micrometres when step_um is not 1). font_sizes : dict, optional – keys ‘title’, ‘label’, ‘tick’, ‘colorbar’. xlim, ylim : (low, high), optional – axis limits in the axes’ units; the y axis keeps pointing down.
- upxo.viz.ebsd_maps.ipf_map_figure(lfi, quat, sample_direction, direction_name, step_um=1.0, show_boundaries=False, boundary_color=(0, 0, 0), figsize=(11, 5.5), polygons=None, smooth_grains=None, pixel_stride=1)[source]
Pixel IPF map for one sample direction, with the IPF colour key – or, if polygons is given, a Smoothed display (see euler_map_figure’s docstring for the same Pixellated/Smoothed convention). IPF colour is already one value per grain either way (built_ipf_rgb is driven by a per-grain-averaged quaternion), so Smoothed mode loses nothing extra here – only the boundary shape changes, not the colouring itself.
- upxo.viz.ebsd_maps.gb_pixel_map_figure(lfi, cmap='nipy_spectral', step_um=1.0, boundary_color=(0, 0, 0), figsize=(8, 6.5), polygons=None, smooth_grains=None, pixel_stride=1)[source]
Grain-boundary pixels over the grain map – or, if polygons is given, each grain filled (smoothed boundary) and coloured by its own label the same way the raster imshow(…, cmap=…) already colours by raw grain ID (see euler_map_figure’s docstring for the same Pixellated/Smoothed convention).
- upxo.viz.ebsd_maps.gb_disorientation_figure(result, cmap='viridis', step_um=1.0, vmin=None, vmax=None, linewidth=1.4, show_edge_lines=True, only_in_range=False, twin_ids=None, style_by_type=False, colorbar_location='right', colorbar_label=None, colorbar_label_size=10, colorbar_tick_size=9, colorbar_length=1.0, colorbar_pad=0.04, figsize=(8, 6.5))[source]
Smoothed grain-boundary lines coloured by disorientation angle.
resultis aupxo.xtalphy.gb_disorientation_map.GBDisorientation. Grains are not coloured. Lines on the map edge, which separate a single grain from nothing, are drawn thin and grey (or left out).- only_in_rangedraw only the lines whose angle lies in
[vmin, vmax]; otherwise angles outside the range take the colormap’s end colours.
- style_by_typewith
twin_ids(labels of the input map that are twins), draw twin-twin boundaries dashed, grain-grain dotted and twin-grain continuous, all at the same
linewidth, with a legend.- colorbar_location
right,left,toporbottom. The label and ticks follow the side;
colorbar_length(0-1) andcolorbar_padset its extent and gap.
- only_in_rangedraw only the lines whose angle lies in
- upxo.viz.ebsd_maps.texture_component_map_figure(lfi, grain_ids, component_index, component_names, step_um=1.0, colors=None, other_color=(0.85, 0.85, 0.85), show_legend=True, legend_fontsize=10, show_scale_bar=True, show_axes=True, title=None, font_sizes=None, figsize=(8.5, 6.0), dpi=None, polygons=None, grains=None)[source]
Grain map with every texture component in its own colour.
grain_idsandcomponent_indexare parallel arrays: grain id and the row of its component incomponent_names(-1 = no component, drawn inother_colorand listed as “Other”). The legend is placed outside the map. Withpolygonsandgrains(a smoothed structure) the grains are drawn as filled polygons instead of pixels.