siml.utils package

Submodules

siml.utils.fem_data_utils module

class siml.utils.fem_data_utils.FemDataWrapper(fem_data: FEMData)

Bases: object

add_abs_difference(dict_data: dict, reference_dict_data: dict, prefix: str = 'difference_abs') None
add_difference(dict_data: dict, reference_dict_data: dict, prefix: str = 'difference') None
extract_variables(mandatory_variables: list[str], *, optional_variables: list[str] | None = None) dict[str, numpy.ndarray]

Extract variables from FEMData object to convert to data dictionary.

Parameters:
  • mandatory_variables (list[str]) – Mandatory variable names.

  • optional_variables (list[str], optional) – Optional variable names.

Returns:

dict_data – Data dictionary.

Return type:

dict

update_fem_data(dict_data: dict, prefix: str = '', *, allow_overwrite=False, answer_keys=None, answer_prefix='')
siml.utils.fem_data_utils.reshape_data_if_needed(value: ndarray)

Reshape numpy.ndarray-like to be writable to visualization files.

Parameters:

value (numpy.ndarray) – Data to be processed.

Returns:

reshaped_data

Return type:

numpy.ndarray

siml.utils.progress_bar module

class siml.utils.progress_bar.SimlProgressBar(total: int, desc: str | None = None)

Bases: object

destroy() None
update(trick: int, *, desc: str | None = None) None

Update progress bar

If Progress bar is not created, create it automatically. When counter becomes full, progress bar is destroyed.

Parameters:
  • trick (int) – Increment to add to the internal counter of iterations

  • desc (str, optional) – Set/modify description of the progress bar. [Default: None] If None, skip to modify description.

siml.utils.timer module

class siml.utils.timer.SimlStopWatch(offset: float = 0.0)

Bases: object

reset() None
start() None
stop() float
watch() float

Return elapsed time since timer started..

Returns:

Elapsed time from start time

Return type:

float

Raises:

ValueError – If timer has not started, raise this error

Module contents