graintrace.plot_postprocessing#
Plotting helpers for CPFE field distributions, stress-strain, and pole figures.
- graintrace.plot_postprocessing.plot_block_properties_distribution(results, time, tensor_prefix, order, output_folder='postprocess_out', bins=50)[source]#
Plot distribution across grains at a given physical time.
- graintrace.plot_postprocessing.plot_macroscopic_stress_strain(results, stress_tensor_prefix, strain_tensor_prefix, volume_prefix, output_folder='postprocess_out')[source]#
Plot volume-weighted macroscopic stress-strain curves per component.
- graintrace.plot_postprocessing.plot_block_properties_over_time(results, tensor_prefix, order, grain_ids=None, output_folder='postprocess_out')[source]#
Plot block (per-grain) properties over time.
- graintrace.plot_postprocessing.plot_pole_figure(results, time, tensor_prefix, direction=[1, 1, 1], crystal_symmetry='432', device='cpu', output_folder='postprocess_out', construct_odf=False, DeLaValleePoussinKernel_val=0.1, odf_limits=[0.0, 3.0], orientation_type='mrp', orientation_units='radians', odf_ncontour=12)[source]#
Plot discrete inverse/direct pole figures (and optional ODF) at a time.
- graintrace.plot_postprocessing.plot_ipf_orientation_tracking(tracks, angle_convention, angle_type='radians', direction=(0.0, 0.0, 1.0), crystal_symmetry='432', sample_symmetry='1', projection='stereographic', arrow_color='black', start_size=45.0, step_size=3.0, line_width=1.0, arrow_scale=11.0, line_style='-', show_arrow=True, start_color=None, label_fontsize=None, output_folder='postprocess_out', savefig_name='ipf_orientation_tracking.png', axis_labels=('100', '110', '111'), ax=None)[source]#
Plot orientation trajectories (“points moving”) in the IPF triangle.
One IPF triangle (plain outline); each track is an IPF-colored start dot, a line through its per-step orientations (small step markers), and an arrowhead at the final step. Source-agnostic: the tracks may come from simulation or experiment.
- Parameters:
tracks – sequence of
(k_i, 3)orientation arrays, one per entity (neml2 MRP whenangle_convention="mrp", else Euler angles).angle_convention – REQUIRED (no default) so the caller must state how the tracks are encoded –
"mrp"(neml2 MRP, e.g. simulationori_rodriguestracks) or an Euler convention"bunge"/"kocks"/"roe"(e.g. experiment tracks). A wrong value silently mis-projects, so it is explicit.angle_type –
"radians"or"degrees"(Euler conventions only).direction – sample direction projected into the IPF (default z
[0,0,1]).crystal_symmetry – orbifold crystal symmetry string (e.g.
"432").sample_symmetry – orbifold sample symmetry string.
projection –
"stereographic"or"lambert".arrow_color – color of the trajectory arrows. Either a single matplotlib color (applied to all tracks), a per-track sequence of colors, or the sentinel
"ipf_final"– each track is tinted by the IPF color of its final-stage orientation (so color reads as “where it ended up”, which is redundant with position and needs no legend).start_size – size of the start dot.
step_size – size of the intermediate load-step markers along each line.
line_width – width of the trajectory lines and arrow shafts.
arrow_scale – matplotlib
mutation_scalefor the arrowheads (head size).line_style – matplotlib linestyle for the trajectory lines/arrows. Either a single style (applied to all tracks) or a per-track sequence – e.g. to distinguish which fragment each element belongs to.
show_arrow – draw a final-step arrowhead on each track;
Falsedraws a plain line (no head) to declutter a crowded panel.start_color – color for every start dot;
Noneuses each track’s IPF color of its initial orientation. Pass"black"for a neutral origin.label_fontsize – font size for the triangle corner labels.
output_folder – directory for the saved figure.
savefig_name – output image filename.
axis_labels – labels for the triangle corners.
ax – existing axes to draw into; a new figure is created when
None.
- Returns:
the saved figure path.
- Return type:
- graintrace.plot_postprocessing.plot_ipf_fragmentation_tracking(branches, angle_convention, angle_type='radians', direction=(0.0, 0.0, 1.0), crystal_symmetry='432', sample_symmetry='1', projection='stereographic', arrow_color='black', start_size=45.0, step_size=3.0, line_width=1.0, arrow_scale=11.0, label_fontsize=None, child_line_styles=None, child_colors=None, parent_color=None, parent_line_style='-', show_arrow=True, start_color=None, output_folder='postprocess_out', savefig_name='ipf_fragmentation.png', axis_labels=('100', '110', '111'), ax=None)[source]#
Plot 1->many grain fragmentation as branching IPF trajectories.
Each branch is a parent trajectory that forks, at its split point, into several child trajectories – a parent grain’s orientation point splitting into multiple child orientation points across load steps. One IPF-colored start dot begins the parent line; at the parent’s last (split) orientation each child line diverges to its own end, drawn with an arrowhead. Child lines are connected back to the split point so the fork is explicit.
- Parameters:
branches – sequence of
(parent_track, child_tracks)pairs, whereparent_trackis a(k, 3)orientation array andchild_tracksis a sequence of(m_i, 3)orientation arrays. Orientations are neml2 MRP whenangle_convention="mrp", else Euler.angle_convention – REQUIRED –
"mrp"or an Euler convention ("bunge"/"kocks"/"roe"); a wrong value silently mis-projects.angle_type –
"radians"or"degrees"(Euler conventions only).direction – sample direction projected into the IPF (default z
[0,0,1]).crystal_symmetry – orbifold crystal symmetry string.
sample_symmetry – orbifold sample symmetry string.
projection –
"stereographic"or"lambert".arrow_color – color of the trajectory arrows/lines. Either a single matplotlib color (applied to all branches), a per-branch sequence, or the sentinel
"ipf_final"– the parent and each child are tinted by the IPF color of their final-stage orientation (so a fork’s color reads as the sub-grain’s ending orientation; needs no legend).start_size – size of the parent start dot.
step_size – size of the intermediate step markers.
line_width – width of the trajectory lines and arrow shafts.
arrow_scale – matplotlib
mutation_scalefor the arrowheads (head size).label_fontsize – font size for the triangle corner labels.
child_line_styles – per-child matplotlib linestyles so each fragment fork is drawn distinctly (
"-"/"--"/"-."/":"). Either a single style (all children), or a per-branch sequence whosei-th item is a sequence of styles (one per child of branchi);Nonedraws every child solid. Pair with the same fragment->style mapping inplot_ipf_orientation_tracking()so left/right panels reference.child_colors – per-child colors so a grain’s sub-grains contrast (a categorical palette keyed by fragment). Same shape as
child_line_styles(a per-branch sequence of per-child colors, or a single color);Nonefalls back toarrow_color. Overridesarrow_colorfor the children when given.parent_color – color for the parent (pre-split) trajectory;
Noneusesarrow_color(or the ipf-final color). Pass e.g. a neutral gray when children are individually colored.parent_line_style – linestyle for the parent (pre-split) trajectory.
show_arrow – draw an arrowhead at each child’s end;
Falsedraws plain lines (no heads) to declutter.start_color – color for the parent start dot;
Noneuses the parent’s initial-orientation IPF color. Pass"black"for a neutral origin.output_folder – directory for the saved figure.
savefig_name – output image filename.
axis_labels – labels for the triangle corners.
ax – existing axes to draw into; a new figure is created when
None.
- Returns:
the saved figure path.
- Return type: