Skip to content

experiment

Experiment

Bases: HashableBaseModelIO

An experiment.

caches class-attribute

caches: Dict[str, LRUCache] = {
    "getitem": LRUCache(maxsize=128),
    "__getitem__": LRUCache(maxsize=128),
}

caches for the getitem and getitem methods

data_multipliers class-attribute instance-attribute

data_multipliers: Dict[str, float] = {}

Multipliers for the data, used to scale the data in the experiment

lines class-attribute instance-attribute

lines: Dict[str, Line] = {}

list of lines in the experiment

name instance-attribute

name: str

name of the experiment

notes class-attribute instance-attribute

notes: Dict[str, Any] = {}

custom notes for the experiment, only for labelling purposes and not used in the calculation

options class-attribute instance-attribute

options: Dict[str, Any] = {}

options for the micromechanical-specific model, used in :meth:micromechanical.Model.setOptions to set the calculation options for the model

phases class-attribute instance-attribute

phases: Dict[str, LoadPhaseIO] = {}

load phases of the experiment

__contains__

__contains__(item: Tuple[str, str]) -> bool

Return whether a line exists.

PARAMETER DESCRIPTION
item

Names of the x-axis and y-axis of the line.

TYPE: Tuple[str, str]

RETURNS DESCRIPTION
bool

True if the line exists, False otherwise.

__getitem__

__getitem__(item: Tuple[str, str]) -> Tuple[ndarray, ndarray]

Return the x-axis and y-axis data of a line.

PARAMETER DESCRIPTION
item

Names of the x-axis and y-axis of the line.

TYPE: Tuple[str, str]

RETURNS DESCRIPTION
Tuple[ndarray, ndarray]

The x-axis and y-axis data of the line.

addConfinementPhase

addConfinementPhase(epsa_max: float, steps: int) -> LoadPhaseIO

Add a confinement load phase.

PARAMETER DESCRIPTION
steps

Number of steps.

TYPE: int

epsa_max

Maximum strain.

TYPE: float

RETURNS DESCRIPTION
LoadPhaseIO

The load phase.

addDrainedTriaxialPhase

addDrainedTriaxialPhase(
    sigc: float, epsa_max: float, steps: int
) -> LoadPhaseIO

Add a drained triaxial load phase.

PARAMETER DESCRIPTION
steps

Number of steps.

TYPE: int

sigc

Confined stress.

TYPE: float

epsa_max

Maximum strain.

TYPE: float

RETURNS DESCRIPTION
LoadPhaseIO

The load phase.

addIsotropicPhase

addIsotropicPhase(sigc: float, steps: int) -> LoadPhaseIO

Add an isotropic load phase.

PARAMETER DESCRIPTION
steps

Number of steps.

TYPE: int

sigc

Confined stress.

TYPE: float

RETURNS DESCRIPTION
LoadPhaseIO

The load phase.

addLoadPhase

addLoadPhase(name: str, phase: LoadPhaseIO | LoadPhase) -> LoadPhaseIO

Add a load phase.

PARAMETER DESCRIPTION
name

Name of the load phase.

TYPE: str

phase

The load phase, if not an instance of LoadPhaseIO, it will be converted to one.

TYPE: LoadPhaseIO | LoadPhase

RETURNS DESCRIPTION
LoadPhaseIO

The load phase.

addTrueTriaxialPhase

addTrueTriaxialPhase(
    sig3: float, b: float, epsa_max: float, steps: int
) -> LoadPhaseIO

Add a true triaxial load phase.

PARAMETER DESCRIPTION
sig3

Minimum principal stress.

TYPE: float

b

Intermediate stress ratio.

TYPE: float

epsa_max

Maximum strain.

TYPE: float

steps

Number of steps.

TYPE: int

RETURNS DESCRIPTION
LoadPhase

The load phase.

addTrueTriaxialWithConstantShearPhase

addTrueTriaxialWithConstantShearPhase(
    p: float, b: float, steps: int
) -> LoadPhaseIO

Add a true triaxial load phase.

PARAMETER DESCRIPTION
p

Mean stress.

TYPE: float

b

Lode parameter.

TYPE: float

steps

Number of steps.

TYPE: int

RETURNS DESCRIPTION
LoadPhase

The load phase.

addUndrainedTriaxialPhase

addUndrainedTriaxialPhase(epsa_max: float, steps: int) -> LoadPhaseIO

Add an undrained triaxial load phase.

PARAMETER DESCRIPTION
steps

Number of steps.

TYPE: int

epsa_max

Maximum strain.

TYPE: float

RETURNS DESCRIPTION
LoadPhaseIO

The load phase.

addUndrainedTriaxialWithoutShearPhase

addUndrainedTriaxialWithoutShearPhase(
    epsa_max: float, steps: int
) -> LoadPhaseIO

Add an undrained triaxial load phase without controlling the shear strain.

PARAMETER DESCRIPTION
steps

Number of steps.

TYPE: int

epsa_max

Maximum strain.

TYPE: float

RETURNS DESCRIPTION
LoadPhaseIO

The load phase.

check

check(raise_: bool = True) -> bool | None

Check whether the experiment is valid.

PARAMETER DESCRIPTION
raise_

Whether to raise an error if the experiment is invalid, by default True

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
bool | None

True if the experiment is valid, False if the experiment is invalid, None if the experiment is not checked.

get

get(
    x: str,
    y: str | None = None,
    *,
    deep: bool = False,
    idx: int | Iterable[int] | slice = None
) -> Tuple[ndarray, ndarray] | ndarray

Return the x-axis and y-axis data of a line.

PARAMETER DESCRIPTION
x

Name of the x-axis of the line.

TYPE: str

y

Name of the y-axis of the line. If None, only the x-axis data will be returned.

TYPE: str DEFAULT: None

deep

Search for the line deeply in the experiment, by default False to avoid RecursionError.

TYPE: bool DEFAULT: False

idx

Index of the data to be returned, by default None to return all data.

TYPE: int | Iterable[int] | slice DEFAULT: None

RETURNS DESCRIPTION
Tuple[ndarray, ndarray] | ndarray

The x-axis and y-axis data of the line, or only the x-axis data if y is None.

getitem

getitem(item: Tuple[str, str]) -> Tuple[ndarray, ndarray]

Return the x-axis and y-axis data of a line, only for exactly matching lines or expressions that can be evaluated to the x-axis and y-axis names.

PARAMETER DESCRIPTION
item

Names of the x-axis and y-axis of the line.

TYPE: Tuple[str, str]

RETURNS DESCRIPTION
Tuple[ndarray, ndarray]

The x-axis and y-axis data of the line.

Line

Bases: HashableBaseModelIO

A line for an experiment.

max property

max: float

Return the maximum value of the line.

min property

min: float

Return the minimum value of the line.

ptp property

ptp: float

Return the peak-to-peak value of the line.

x instance-attribute

x: str

x-axis name of the line, used in :meth:micromechanical.python.micromechanical.core.StateVariables.get to get the x-axis data

xdata instance-attribute

xdata: List[float]

x-axis experimental data

y instance-attribute

y: str

y-axis name of the line, used in :meth:micromechanical.python.micromechanical.core.StateVariables.get to get the y-axis data

ydata instance-attribute

ydata: List[float]

y-axis experimental data

validate_xy classmethod

validate_xy(xy: str)

LoadPhaseIO

Bases: HashableBaseModelIO

A load phase for an experiment.

b class-attribute instance-attribute

b: float = -1.0

Intermediate stress ratio

control instance-attribute

control: List[float]

Control type of the load increment, 0 for stress control, 1 for strain control

final instance-attribute

final: List[float]

Final mixed stress/strain

initial instance-attribute

initial: List[float]

Initial mixed stress/strain

steps instance-attribute

steps: int

Number of steps

total instance-attribute

total: List[float]

Control whether the load is incremental or total, 0 for incremental, 1 for total