hookeai.data_generation.strain_paths.random_path.StrainPathGenerator

class StrainPathGenerator(strain_formulation, n_dim)[source]

Bases: ABC

Strain loading path generator interface.

_strain_formulation

Problem strain formulation.

Type:

{‘infinitesimal’, ‘finite’}

_n_dim

Problem number of spatial dimensions.

Type:

int

_comp_order_sym

Strain/Stress components symmetric order.

Type:

tuple[str]

_comp_order_nsym

Strain/Stress components nonsymmetric order.

Type:

tuple[str]

generate_strain_path(self)[source]

Generate strain path.

build_strain_tensor(n_dim, strain_comps, strain_comp_order, is_symmetric=False)[source]

Build second-order strain tensor from strain components.

plot_strain_path(strain_formulation, n_dim, strain_comps_order, time_hist, strain_path, strain_axis_lims=None, is_plot_strain_norm=False, is_plot_inc_strain_norm=False, filename='strain_path', save_dir=None, is_save_fig=False, is_stdout_display=False, is_latex=False)[source]

Plot strain path.

Constructor.

Parameters:
  • strain_formulation ({'infinitesimal', 'finite'}) – Problem strain formulation.

  • n_dim (int) – Problem number of spatial dimensions.

List of Public Methods

build_strain_tensor

Build second-order strain tensor from strain components.

generate_strain_path

Generate strain path.

plot_strain_path

Plot strain path.

Methods

__init__(strain_formulation, n_dim)[source]

Constructor.

Parameters:
  • strain_formulation ({'infinitesimal', 'finite'}) – Problem strain formulation.

  • n_dim (int) – Problem number of spatial dimensions.

static build_strain_tensor(n_dim, strain_comps, strain_comp_order, is_symmetric=False)[source]

Build second-order strain tensor from strain components.

All the components required to build the complete second-order strain tensor must be provided.

Parameters:
  • n_dim (int) – Number of spatial dimensions.

  • strain_comps (np.ndarray(1d)) – Strain tensor components sorted according with given components order.

  • strain_comp_order (tuple[str]) – Strain components order.

  • is_symmetric (bool, default=False) – If True, then assembles off-diagonal strain components from symmetric component.

Returns:

strain – Strain tensor.

Return type:

np.ndarray(2d)

abstract generate_strain_path()[source]

Generate strain path.

Returns:

  • strain_comps_order (tuple[str]) – Strain components order.

  • time_hist (numpy.ndarray(1d)) – Discrete time history.

  • strain_path (numpy.ndarray(2d)) – Strain path history stored as numpy.ndarray(2d) of shape (sequence_length, n_strain_comps).

static plot_strain_path(strain_formulation, n_dim, strain_comps_order, time_hist, strain_path, is_plot_strain_path=False, is_plot_strain_comp_hist=False, is_plot_strain_norm=False, is_plot_strain_norm_hist=False, is_plot_inc_strain_norm=False, is_plot_inc_strain_norm_hist=False, is_plot_strain_path_pairs=False, is_plot_strain_pairs_hist=False, is_plot_strain_pairs_marginals=False, is_plot_strain_comp_box=False, strain_label='Strain', strain_units='', filename='strain_path', save_dir=None, is_save_fig=False, is_stdout_display=False, is_latex=False)[source]

Plot strain path.

Parameters:
  • strain_formulation ({'infinitesimal', 'finite'}) – Problem strain formulation.

  • n_dim (int) – Problem number of spatial dimensions.

  • strain_comps_order (tuple[str]) – Strain components order.

  • time_hist ({numpy.ndarray(1d), list[numpy.ndarray(1d)]}) – Discrete time history or list of multiple discrete time histories.

  • strain_path ({numpy.ndarray(2d), list[numpy.ndarray(2d)]}) – Strain path history stored as numpy.ndarray(2d) of shape (sequence_length, n_strain_comps) or list of multiple strain path histories.

  • is_plot_strain_path (bool, default=False) – Plot the strain components path. If multiple strain paths are provided, the strain components path is only plotted for the first three available paths.

  • is_plot_strain_comp_hist (bool, default=False) – Plot a histogram for each strain component.

  • is_plot_strain_norm (bool, default=False) – Plot strain norm path and distribution.

  • is_plot_strain_norm_hist (bool, default=False) – Plot strain norm distribution.

  • is_plot_inc_strain_norm (bool, default=False) – Plot incremental strain norm path.

  • is_plot_inc_strain_norm_hist (bool, default=False) – Plot incremental strain norm distribution.

  • is_plot_strain_path_pairs (bool, default=False) – Plot the strain path for pairs of strain components in the strain space.

  • is_plot_strain_pairs_hist (bool, default=False) – Plot the distribution for pairs of strain components in the strain space.

  • is_plot_strain_pairs_marginals (bool, default=False) – Plot the pairs of strain components in the strain space together with the marginal distributions for each component.

  • is_plot_strain_comp_box (bool, default=False) – If True, then plot a box plot including the different strain components.

  • strain_label (str, default='Strain') – Strain label.

  • strain_units (str, default='') – Strain units label.

  • filename (str, default='strain_path') – Figure name.

  • save_dir (str, default=None) – Directory where figure is saved. If None, then figure is saved in current working directory.

  • is_save_fig (bool, default=False) – Save figure.

  • is_stdout_display (bool, default=False) – True if displaying figure to standard output device, False otherwise.

  • is_latex (bool, default=False) – If True, then render all strings in LaTeX. If LaTex is not available, then this option is silently set to False and all input strings are processed to remove $(…)$ enclosure.