Skip to content

calibration

CalibrationFitness

Bases: FitnessBase

check_smoothness class-attribute instance-attribute

check_smoothness: bool = False

Whether to check if the data is smooth

data_get_kwargs class-attribute instance-attribute

data_get_kwargs: Dict[str, Any] = {}

Keyword arguments for the get method of the state variable exporter

error_fitness class-attribute instance-attribute

error_fitness: float = 10000000000.0

The error fitness.

error_raise class-attribute instance-attribute

error_raise: bool = False

Whether to raise an error if the fitness is not valid

experiment_excludes class-attribute instance-attribute

experiment_excludes: List[str] = []

Skipped experiments

experiment_get_kwargs class-attribute instance-attribute

experiment_get_kwargs: Dict[str, Any] = {}

Keyword arguments for the get method of experiment

experiment_includes class-attribute instance-attribute

experiment_includes: List[str] | None = None

Included experiments

experiment_options class-attribute instance-attribute

experiment_options: Dict[str, Dict[str, Any]] = {}

Override the options for each experiment

experiment_weights class-attribute instance-attribute

experiment_weights: Dict[str, float] = {}

Weights for the experiments

experiments instance-attribute

experiments: List[Experiment]

The experiments.

io instance-attribute

The micromechanical model io.

keys class-attribute instance-attribute

keys: List[str | CalibrationKey] = []

Optimization keys, a list of strings or tuples of strings (experiment name, material parameter name).

line_additions class-attribute instance-attribute

line_additions: Dict[str, Tuple[str, str]] = {}

Additional lines that can be expressions of the existing lines

line_clip_state_variables class-attribute instance-attribute

line_clip_state_variables: Dict[str, Tuple[float, float]] = {}

Clip state variables

line_ensure_increasing_xdata class-attribute instance-attribute

line_ensure_increasing_xdata: List[str] = []

Ensure xdata is increasing by reconstructing the data with positive differences between every two points

line_excludes class-attribute instance-attribute

line_excludes: List[str] = []

Excluded lines

line_experiment_additions class-attribute instance-attribute

line_experiment_additions: Dict[str, Dict[str, Tuple[str, str]]] = {}

Additional lines that can be expressions of the existing lines for each experiment

line_experiment_clip_state_variables class-attribute instance-attribute

line_experiment_clip_state_variables: Dict[
    str, Dict[str, Tuple[float, float]]
] = {}

Clip state variables for each experiment

line_experiment_ensure_increasing_xdata class-attribute instance-attribute

line_experiment_ensure_increasing_xdata: Dict[str, List[str]] = []

Ensure xdata is increasing by reconstructing the data with positive differences between every two points for each experiment

line_experiment_excludes class-attribute instance-attribute

line_experiment_excludes: Dict[str, List[str]] = {}

Excluded lines for each experiment

line_experiment_includes class-attribute instance-attribute

line_experiment_includes: Dict[str, List[str]] = {}

Included lines for each experiment

line_experiment_override_xydata class-attribute instance-attribute

line_experiment_override_xydata: Dict[
    str, Dict[str, Tuple[List[float], List[float]]]
] = {}

Override experimental data for each experiment

line_experiment_weights class-attribute instance-attribute

line_experiment_weights: Dict[str, Dict[str, float]] = {}

Weights for the lines for each experiment

line_experiment_xptps class-attribute instance-attribute

line_experiment_xptps: Dict[str, Dict[str, float]] = {}

Point-to-point y-axis distance for normalizing the similarity for each experiment

line_experiment_xys class-attribute instance-attribute

line_experiment_xys: Dict[str, Dict[str, Tuple[str, str]]] | None = None

Override default calibrated line x-y pairs for each experiment.

line_experiment_yptps class-attribute instance-attribute

line_experiment_yptps: Dict[str, Dict[str, float]] = {}

Point-to-point y-axis distance for normalizing the similarity for each experiment

line_includes class-attribute instance-attribute

line_includes: List[str] | None = None

Included lines

line_override_xydata class-attribute instance-attribute

line_override_xydata: Dict[str, Tuple[List[float], List[float]]] = {}

Override experimental data

line_weights class-attribute instance-attribute

line_weights: Dict[str, float] = {}

Weights for the lines

line_xptps class-attribute instance-attribute

line_xptps: Dict[str, float] = {}

Point-to-point x-axis distance for normalizing the similarity

line_xys class-attribute instance-attribute

line_xys: Dict[str, Tuple[str, str]] | None = None

Override default calibrated line x-y pairs.

line_yptps class-attribute instance-attribute

line_yptps: Dict[str, float] = {}

Point-to-point y-axis distance for normalizing the similarity

lognormal_parameters class-attribute instance-attribute

lognormal_parameters: List[str | CalibrationKey] = []

Parameters to be distributed in the lognormal space

phase_steps class-attribute instance-attribute

phase_steps: Dict[str, int] = {}

Override the number of steps for each load phase

similarity_method class-attribute instance-attribute

similarity_method: Literal[
    "interpolate", "pcm", "area", "frechet-dist", "curve-length", "dtw"
] = "interpolate"

The similarity method.

smoothness_threshold class-attribute instance-attribute

smoothness_threshold: float = 0.05

Smooth threshold

check

check(simx: ndarray, simy: ndarray) -> bool

Validate the simulated data.

create classmethod

create(
    fitness: Union[
        "CalibrationFitness", Type["CalibrationFitness"], str, None
    ] = None,
    **kwargs
) -> "CalibrationFitness"

evaluate

evaluate(
    results: Dict[str, SVExporter | bool],
) -> Tuple[Dict[str, Dict[str, float]], Dict[str, Dict[str, float]]]

get

get(
    x: str, y: str, experiment: Experiment, line_name: str, sv: SVExporter
) -> Tuple[ndarray, ndarray, ndarray, ndarray]

Get experimental and simulated data.

isSmooth

isSmooth(x: ndarray, y: ndarray) -> bool

Check if the data is smooth.

parseOptimizeKeys

parseOptimizeKeys()

Parse the keys of the fitness function.

preprocess

preprocess(
    expx: ndarray, expy: ndarray, simx: ndarray, simy: ndarray
) -> Tuple[ndarray, ndarray, ndarray, ndarray]

Preprocess the experimental and simulated data.

PARAMETER DESCRIPTION
expx

The x-axis of the experimental data.

TYPE: ndarray

expy

The y-axis of the experimental data.

TYPE: ndarray

simx

The x-axis of the simulated data.

TYPE: ndarray

simy

The y-axis of the simulated data.

TYPE: ndarray

RETURNS DESCRIPTION
Tuple[ndarray, ndarray, ndarray, ndarray]

The preprocessed data.

run

run(
    x: Iterable | dict, *args, return_results: bool = False, **kwargs
) -> float | Tuple[float, Dict[str, SVExporter]]

serialize_data_get_kwargs

serialize_data_get_kwargs(value: Dict[str, Any]) -> Dict[str, Any]

serialize_keys

serialize_keys(value: List[str | CalibrationKey]) -> List[str]

serialize_lognormal_parameters

serialize_lognormal_parameters(value: List[str | CalibrationKey]) -> List[str]

setModelParameters

setModelParameters(
    model: "MicromechanicalBase", x: Iterable | dict, experiment: Experiment
)

Set the material parameters (for the given experiment) to the model.

setOptions classmethod

setOptions(model: 'MicromechanicalBase', **kwargs)

Set the calculation options for the micromechanical model, the contact law, the integration, or the material.

PARAMETER DESCRIPTION
model

The micromechanical model.

TYPE: MicromechanicalBaseType

kwargs

The calculation options for the micromechanical model, the contact law, or the material.

DEFAULT: {}

similarity

similarity(
    experiment_name: str,
    line_name: str,
    expx: ndarray,
    expy: ndarray,
    simx: ndarray,
    simy: ndarray,
) -> float

Calculate the similarity between the experimental and simulated data.

PARAMETER DESCRIPTION
experiment_name

The name of the experiment.

TYPE: str

line_name

The name of the line.

TYPE: str

expx

The x-axis of the experimental data.

TYPE: ndarray

expy

The y-axis of the experimental data.

TYPE: ndarray

simx

The x-axis of the simulated data.

TYPE: ndarray

simy

The y-axis of the simulated data.

TYPE: ndarray

RETURNS DESCRIPTION
float

The similarity value.

simulate

simulate(x: Iterable | dict) -> Dict[str, SVExporter | bool]

Simulate the model and return the results as a dictionary of SVExporter objects. If the simulation fails, return False instead.

validateOptions

validateOptions()

Validate the configurations.

validate_data_get_kwargs classmethod

validate_data_get_kwargs(value: Dict[str, Any])

validate_keys classmethod

validate_keys(value: List[str | CalibrationKey])

validate_lognormal_parameters classmethod

validate_lognormal_parameters(value: List[str | CalibrationKey])

weight

weight(
    expx: ndarray,
    expy: ndarray,
    simx: ndarray,
    simy: ndarray,
    experiment_name: str,
    line_name: str,
) -> float

Custom weight for the fitness.

_try_eval

_try_eval(val: Any) -> Any

Try to evaluate a value, return the value if it is not a string or cannot be evaluated.