kawin.precipitation (Plot)

kawin.kawin.precipitation.Plot

def _get_time_axis(time, timeUnits=’s', bounds=None):

    Returns scaling factor, label and x-limits depending on units of time

    Parameters
    ----------
    timeUnits : str
        's' / 'sec' / 'seconds' - seconds
        'min' / 'minutes' - minutes
        'h' / 'hrs' / 'hours' - hours

def _total_sum(model: PrecipitateBase, plotVar):

Total var is sum along phases

def _total_average(model: PrecipitateBase, plotVar):

Total var is average along phases

def _total_vol_average(model: PrecipitateBase, plotVar):

This is specific for volume average radius, where R^3 = fv / (4/3*pi*N)

def _total_none(model: PrecipitateBase, plotVar):

For variables that done have a defined total (ex. driving force, supersaturation, eq volume fraction)

def _get_plot_list(currList, defaultList):

def _get_ys_phases(model: PrecipitateBase, plotVar, phases=None, totalFunc=_total_sum):

Given the plot variable and list of phases (which may include 'total')
return a list of y's and corresponding labels to plot

def _get_ys_elements(model: PrecipitateBase, plotVar, elements=None):

Given the plot variable and list of elements
return a list of y's and corresponding labels to plot

def _radius_scale(precipitate: PrecipitateParameters, radius, r):

def _plot_term(model: PrecipitateBase, ys, labels, yLabel, timeUnits=’s', ax=None, yBottom=0, *args, **kwargs):

Plot a variable from a precipitate model
This will scale the x-axis to the desired time unit and apply labels when possible

def plotVolumeFraction(model: PrecipitateBase, timeUnits=’s', phases=None, ax = None, *args, **kwargs):

Plots volume fraction vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
phases: str | list[str] (optional)
    If None, then model phases will be used
    If 'total' is in phase list, then sum of f_v will be used
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotCriticalRadius(model: PrecipitateBase, timeUnits=’s', phases=None, ax = None, *args, **kwargs):

Plots critical radius vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
phases: str | list[str] (optional)
    If None, then model phases will be used
    If 'total' is in phase list, then average of R_crit will be used
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotAverageRadius(model: PrecipitateBase, timeUnits=’s', phases=None, radius=‘spherical’, ax = None, *args, **kwargs):

Plots average radius vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
phases: str | list[str] (optional)
    If None, then model phases will be used
    If 'total' is in phase list, then average of R_avg will be used
radius: str (optional)
    For non-spherical precipitates, the average radius can be transformed to:
        'spherical' - equivalent spherical radius (default)
        'short' - short axis
        'long' - long axis
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotVolumeAverageRadius(model: PrecipitateBase, timeUnits=’s', phases=None, ax = None, *args, **kwargs):

Plots volume averaged radius vs time on a semilog plot
    R_v = cbrt(f_v / (4/3 pi N_v)

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
phases: str | list[str] (optional)
    If None, then model phases will be used
    If 'total' is in phase list, then average will be cbrt(sum(f_v) / sum(N_v) / (4/3 pi))
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotAspectRatio(model: PrecipitateBase, timeUnits=’s', phases=None, ax = None, *args, **kwargs):

Plots precipitate aspect ratio vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
phases: str | list[str] (optional)
    If None, then model phases will be used
    If 'total' is in phase list, then average of AR will be used
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotDrivingForce(model: PrecipitateBase, timeUnits=’s', phases=None, ax = None, *args, **kwargs):

Plots driving force vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
phases: str | list[str] (optional)
    If None, then model phases will be used
    'total' is not supported for driving forces
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotNucleationRate(model: PrecipitateBase, timeUnits=’s', phases=None, ax = None, *args, **kwargs):

Plots nucleation rate vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
phases: str | list[str] (optional)
    If None, then model phases will be used
    If 'total' is in phase list, then sum of dN/dt will be used
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotPrecipitateDensity(model: PrecipitateBase, timeUnits=’s', phases=None, ax = None, *args, **kwargs):

Plots precipitate density vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
phases: str | list[str] (optional)
    If None, then model phases will be used
    If 'total' is in phase list, then sum of N will be used
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotTemperature(model: PrecipitateBase, timeUnits=’s', ax = None, *args, **kwargs):

Plots temperature vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotComposition(model: PrecipitateBase, timeUnits=’s', elements=None, ax = None, *args, **kwargs):

Plots composition vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
elements: str | list[str] (optional)
    If None, then model elements will be used
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotEqMatrixComposition(model: PrecipitateBase, timeUnits=’s', elements=None, phase=None, ax = None, *args, **kwargs):

Plots equilibrium matrix composition vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
elements: str | list[str] (optional)
    If None, then model elements will be used
phase: str (optional)
    Precipitate phase that matrix is in equilibrium with
    If None, first phase will be used
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotEqPrecipitateComposition(model: PrecipitateBase, timeUnits=’s', elements=None, phase=None, ax = None, *args, **kwargs):

Plots equilibrium precipitate composition vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
elements: str | list[str] (optional)
    If None, then model elements will be used
phase: str (optional)
    Precipitate phase that matrix is in equilibrium with
    If None, first phase will be used
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotEqVolumeFraction(model: PrecipitateBase, timeUnits=’s', phases=None, ax = None, *args, **kwargs):

Plots equilibrium volume fraction vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
phases: str | list[str] (optional)
    If None, then model phases will be used
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotSupersaturation(model: PrecipitateBase, timeUnits=’s', phases=None, ax = None, *args, **kwargs):

Plots supersaturation vs time on a semilog plot

Parameters
----------
model: PrecipitateBase
timeUnits: str
    ['s', 'min', 'hr']
phases: str | list[str] (optional)
    If None, then model phases will be used
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotSizeDistribution(model: PrecipitateModel, phases=None, radius=‘spherical’, fill=False, ax=None, *args, **kwargs):

Plots final particle size distribution (N vs r)

Parameters
----------
model: PrecipitateBase
phases: str | list[str] (optional)
    If None, then model phases will be used
    'total' not supported for equilibrium volume fraction
radius: str (optional)
    For non-spherical precipitates, the average radius can be transformed to:
        'spherical' - equivalent spherical radius (default)
        'short' - short axis
        'long' - long axis
fill: bool (optional)
    If True, will fill between the PSD curve and y=0
    Defaults to False
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotDistributionDensity(model: PrecipitateModel, phases=None, radius=‘spherical’, fill=False, ax=None, *args, **kwargs):

Plots final particle size distribution density (N/R) vs R

Parameters
----------
model: PrecipitateBase
phases: str | list[str] (optional)
    If None, then model phases will be used
    'total' not supported for equilibrium volume fraction
radius: str (optional)
    For non-spherical precipitates, the average radius can be transformed to:
        'spherical' - equivalent spherical radius (default)
        'short' - short axis
        'long' - long axis
fill: bool (optional)
    If True, will fill between the PSD curve and y=0
    Defaults to False
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotCumulativeDistribution(model: PrecipitateModel, phases=None, radius=‘spherical’, order=1, ax=None, *args, **kwargs):

Plots cumulative density functio of particle size distribution

Parameters
----------
model: PrecipitateBase
phases: str | list[str] (optional)
    If None, then model phases will be used
    'total' not supported for equilibrium volume fraction
radius: str (optional)
    For non-spherical precipitates, the average radius can be transformed to:
        'spherical' - equivalent spherical radius (default)
        'short' - short axis
        'long' - long axis
order: int (optional)
    Moment of PSD to plot CDF in
ax: matplotlib Axis (optional)
    If None, then ax will be generated

Returns
-------
Matplotlib Axis

def plotPrecipitateResults(model: PrecipitateModel, term, ax=None, *args, **kwargs):

General function to plot precipitate results

Parameters
----------
model: PrecipitateBase
term: str
    Term to plot. Options are:
        'volume fraction'
        'critical radius'
        'volume average radius' - average radius given volume fraction and precipitate density
        'aspect ratio' - average aspect ratio vs time
        'driving force'
        'nucleation rate'
        'precipitate density'
        'temperature'
        'composition'
        'eq comp alpha' - equilibrium composition of matrix phase
        'eq comp beta' - equilibrium composition of precipitate phase
        'supersaturation'
        'eq volume fraction' - equilibrium volume fraction of precipitate phase
        'psd' - particle size distribution
        'pdf' - particle size distribution density
        'cdf' - particle cumulative size distribution
ax: matplotlib Axis (optional)
    If None, then ax will be generated