upxo.viz.ebsd_overlays module

Grain-boundary and junction overlays for pixel-indexed grain maps.

The functions draw onto an existing matplotlib axes whose data coordinates are pixel indices (the pixel at row i, column j is centred at x=j, y=i), as the grain maps of upxo.viz.ebsdviz are. data_per_pixel rescales for an axes in other units.

upxo.viz.ebsd_overlays.junction_points(lfi)[source]

Triple and quadruple junctions of a label map.

A junction is an interior pixel corner (shared by four pixels) around which three, or four, different labels meet. Returns (triple_xy, quad_xy), each an (n, 2) array of (x, y) in pixel coordinates (the corner between pixels i, i+1 and j, j+1 is at x=j+0.5, y=i+0.5).

upxo.viz.ebsd_overlays.polygon_boundary_lines(polygons)[source]

Every ring (outer and holes) of a {gid: shapely polygon} mapping as an (n, 2) coordinate array.

upxo.viz.ebsd_overlays.overlay_grain_boundaries(ax, lfi, polygons=None, color='black', linewidth=1.0, data_per_pixel=1.0, zorder=4)[source]

Draw grain boundaries on ax.

With polygons (a smoothed structure) the smoothed boundary lines are drawn at linewidth; without them every pixel edge between two different labels is drawn in color (a one-pixel-wide raster, so linewidth does not apply). Returns 'smoothed' or 'pixel'.

upxo.viz.ebsd_overlays.apply_boundary_overlay(fig, ax, lfi, polygons=None, gb_color='black', gb_width=1.0, triple=False, quadruple=False, marker='circle', marker_size=12.0, marker_edge='black', marker_fill='black', data_per_pixel=1.0)[source]

Draw grain boundaries and, optionally, junction markers on ax, replacing an overlay this function drew earlier on the same figure.

Returns 'smoothed' or 'pixel' (see overlay_grain_boundaries()).

upxo.viz.ebsd_overlays.overlay_junctions(ax, lfi, triple=True, quadruple=True, marker='circle', size=12.0, edgecolor='black', facecolor='black', linewidth=1.0, data_per_pixel=1.0, zorder=5)[source]

Mark the triple and/or quadruple junctions of lfi on ax.

marker is a key of JUNCTION_MARKERS or a matplotlib marker code; size is the marker area in points squared. Returns the number of junctions drawn.