Skip to content

config

config module-attribute

config: Config = fromDict(data)

data module-attribute

data = merge(data, dataFromAny(path=path, key=key))

Config

Bases: HashableBaseModelIO

Configuration class. There are mainly two backends:

  • cpp (default): C++ implementation, is_cpp_backend = True, environment variable MICROMECHANICAL_BACKEND=cpp
  • python: Python implementation, is_python_backend = True, environment variable MICROMECHANICAL_BACKEND=python

  • numba (default): Python implementation with numba enabled, is_numba_backend = True, environment variable NUMBA_DISABLE_JIT=0

  • pure python: pure Python implementation with numba disabled, is_pure_python_backend = True, environment variable NUMBA_DISABLE_JIT=1

For the numba and cpp backends, there are two precisions:

  • double (default): double precision, is_double_precision = True, environment variable MICROMECHANICAL_PRECISION=double
  • single: single precision, is_single_precision = True, environment variable MICROMECHANICAL_PRECISION=single, the single precision backend is not fully tested yet

backend class-attribute instance-attribute

backend: Literal['python', 'cpp'] = 'cpp'

Backend, python or cpp

cache_contact class-attribute instance-attribute

cache_contact: bool = True

Whether to cache contact state variables by default

dataset_dirs class-attribute instance-attribute

dataset_dirs: List[str] = []

Dataset directories

is_cpp_backend property

is_cpp_backend: bool

Return True if the backend is cpp.

is_double_cpp_backend property

is_double_cpp_backend: bool

Return True if the backend is cpp and the precision is double.

is_double_numba_backend property

is_double_numba_backend: bool

Return True if the backend is python and numba is enabled and the precision is double.

is_double_precision property

is_double_precision: bool

Return True if the precision is double.

is_numba_backend property

is_numba_backend: bool

Return True if the backend is python and numba is enabled.

is_pure_python_backend property

is_pure_python_backend: bool

Return True if the backend is python and numba is disabled.

is_python_backend property

is_python_backend: bool

Return True if the backend is python.

is_single_cpp_backend property

is_single_cpp_backend: bool

Return True if the backend is cpp and the precision is single.

is_single_numba_backend property

is_single_numba_backend: bool

Return True if the backend is python and numba is enabled and the precision is single.

is_single_precision property

is_single_precision: bool

Return True if the precision is single.

lang_suffix property

lang_suffix: str

Return the language suffix for file names, empty for en, -zh for zh.

language class-attribute instance-attribute

language: Literal['en', 'zh'] = 'en'

Language

matplotlib_styles class-attribute instance-attribute

matplotlib_styles: List[str] = ['science', 'grid', as_posix()]

Matplotlib styles

numba_enabled class-attribute instance-attribute

numba_enabled: bool = True

Is Numba enabled, True or False

plotting_backend class-attribute instance-attribute

plotting_backend: Literal['matplotlib', 'bokeh'] = 'matplotlib'

Plotting backend, matplotlib or bokeh

precision class-attribute instance-attribute

precision: Literal['single', 'double'] = 'double'

Precision, single or double

suppress_output class-attribute instance-attribute

suppress_output: bool = False

Whether to suppress output

suppress_warnings class-attribute instance-attribute

suppress_warnings: bool = False

Whether to suppress warnings

translation_file class-attribute instance-attribute

translation_file: str = 'micromechanical-translations.yaml'

Translation file