upxo.meshing.gbconformant.fm_steel_abaqus.plots module

Matplotlib figures for the before/after comparison (no pyplot state is used).

upxo.meshing.gbconformant.fm_steel_abaqus.plots.colour(value, default)[source]

value as a hex colour; default when it is empty. Raises ValueError for text that is no colour.

class upxo.meshing.gbconformant.fm_steel_abaqus.plots.PlotStyle(kind: str = 'histogram', bins: int = 40, bin_width: float | None = None, bandwidth: float | None = None, log: bool = False, density: bool = False, colors: tuple = ('#4878CF', '#D65F5F'), show_mean: bool = False, show_std: bool = False, show_median: bool = False)[source]

Bases: object

How a distribution is drawn.

kind: str = 'histogram'
bins: int = 40
bin_width: float | None = None

Width of a histogram bin in the units of the plotted values; None uses bins bins.

bandwidth: float | None = None

Standard deviation of the Gaussian of the KDE, in the units of the values; None uses Silverman’s rule.

log: bool = False
density: bool = False
colors: tuple = ('#4878CF', '#D65F5F')
show_mean: bool = False
show_std: bool = False
show_median: bool = False
class upxo.meshing.gbconformant.fm_steel_abaqus.plots.DrawSeries(label: str, values: ndarray, weights: ndarray | None = None, color: str = '#4878CF', integer: bool = False)[source]

Bases: object

One distribution to draw: the legend text, the values, their weights (None for equal weights) and the colour.

label: str
values: ndarray
weights: ndarray | None = None
color: str = '#4878CF'
integer: bool = False
upxo.meshing.gbconformant.fm_steel_abaqus.plots.weighted_stats(values, weights=None) → dict[source]

Weighted mean, standard deviation and median (the median of the weighted distribution).

upxo.meshing.gbconformant.fm_steel_abaqus.plots.silverman_bandwidth(values, weights=None) → float[source]

Silverman’s rule of thumb for the bandwidth of a Gaussian KDE (weighted).

upxo.meshing.gbconformant.fm_steel_abaqus.plots.kde_curve(values, weights, bandwidth, grid) → ndarray[source]

Gaussian kernel density of weighted values on grid; it adds up to the total weight (1 without weights).

upxo.meshing.gbconformant.fm_steel_abaqus.plots.bin_edges(series, style: PlotStyle)[source]

Common histogram edges for series and a note: whole numbers for integer data, else bin_width or bins bins.

upxo.meshing.gbconformant.fm_steel_abaqus.plots.stats_text(series, unit='') → str[source]

mean 12.3 +- 4.5, median 11.9 um for a legend (mathtext plus-minus).

upxo.meshing.gbconformant.fm_steel_abaqus.plots.compare_figure(series, style: PlotStyle, *, xlabel='', ylabel='', title='', subtitle='', footnote='', unit='', note_unit=None)[source]

Distributions of one quantity on the two sides: histogram, KDE, both, CDF, box or violin plot.

series are DrawSeries. A box or violin plot cannot show weights, so a weighted quantity falls back to the histogram with the KDE. The legend carries the text of each series, with its mean and standard deviation when those are marked. figure.compare_notes lists what was chosen automatically (bin width, bandwidth).

upxo.meshing.gbconformant.fm_steel_abaqus.plots.distribution_figure(before, after, kind='histogram', *, bins=40, log=False, density=False, xlabel='', title='', labels=('before', 'after'))[source]

Before/after distribution of one quantity as a histogram, KDE, CDF, box or violin plot.

upxo.meshing.gbconformant.fm_steel_abaqus.plots.matched_change_figure(rows, *, quantity='value', units='', kind='scatter', bins=40, log=False, labels=('before', 'after'), colors=None, subtitle='', footnote='', noun='items')[source]

Per-item change for items present on both sides: before-vs-after or ratio histogram.

upxo.meshing.gbconformant.fm_steel_abaqus.plots.texture_figure(eulers_before, eulers_after, settings, titles=('Before', 'After'), noun='features', weights=(None, None), weighted_by='')[source]

Pole figures before and after, and (density modes) the after-minus-before difference.

weights is (before, after), one weight per orientation or None (every orientation counts once); weighted_by names the weight (for example grain volume) in the titles.

upxo.meshing.gbconformant.fm_steel_abaqus.plots.subset_preview_figure(labels, lo, hi, *, title='Subset box')[source]

Three mid-box slices of the parent labels with the box drawn on them.