config
Config
Bases: HashableBaseModelIO
Configuration class. There are mainly two backends:
cpp(default): C++ implementation,is_cpp_backend = True, environment variableMICROMECHANICAL_BACKEND=cpp-
python: Python implementation,is_python_backend = True, environment variableMICROMECHANICAL_BACKEND=python -
numba(default): Python implementation with numba enabled,is_numba_backend = True, environment variableNUMBA_DISABLE_JIT=0 pure python: pure Python implementation with numba disabled,is_pure_python_backend = True, environment variableNUMBA_DISABLE_JIT=1
For the cpp backend, there are two precisions:
double(default): double precision,is_double_precision = True, environment variableMICROMECHANICAL_PRECISION=doublesingle: single precision,is_single_precision = True, environment variableMICROMECHANICAL_PRECISION=single, the single precision backend is not fully tested yet
backend
class-attribute
instance-attribute
Backend, python or cpp
cache_contact
class-attribute
instance-attribute
Whether to cache contact state variables by default
cache_model_runs
class-attribute
instance-attribute
Whether to cache simulation results for model.run()
is_double_cpp_backend
property
Return True if the backend is cpp and the precision is double.
is_numba_backend
property
Return True if the backend is python and numba is enabled.
is_pure_python_backend
property
Return True if the backend is python and numba is disabled.
is_single_cpp_backend
property
Return True if the backend is cpp and the precision is single.
lang_suffix
property
Return the language suffix for file names, empty for en, -zh for zh.
matplotlib_styles
class-attribute
instance-attribute
matplotlib_styles: List[str] = [
"science",
"grid",
(Path(__file__).parent / "configs/lines.mplstyle").as_posix(),
]
Matplotlib styles
numba_enabled
class-attribute
instance-attribute
Is Numba enabled, True or False
numbering_title_fontsize
class-attribute
instance-attribute
Font size for numbering titles in figures. Can be a string or a float.
plotting_backend
class-attribute
instance-attribute
Plotting backend, matplotlib or bokeh
precision
class-attribute
instance-attribute
Precision, single or double
suppress_output
class-attribute
instance-attribute
Whether to suppress output
suppress_warnings
class-attribute
instance-attribute
Whether to suppress warnings