Welcome to modelparameters’s documentation!¶
Modelparameters is a lightweight library to declare nested parameters in Python, and can be used as a module for providing parameter structure for physical models. It is mainly developed as a tool for gotran, but certainly not limited to that.
from modelparameters import ScalarParam
# Define the gravitational acceleration
g = ScalarParam(9.81, name="g", unit="m/s**2",
description="gravitational acceleration")
# Define the time (in milliseconds)
t = ScalarParam(100.0, unit="ms",
description="Time spent")
# Compute the distance travelled in free fall
s = 0.5 * g * t**2
print(s)
Output:
49050.0 ∈ [-∞, ∞]
Demos¶
Will come later!
Installation¶
You can install modelparameters either with pip:
pip install modelparameters
or if you want the latest features, you can install from source:
pip install git+https://finsberg@bitbucket.org/finsberg/modelparameters.git
Source code¶
Modelparmeters is orginally developed by Johan Hake, and the original source code can be found in his repoistory. The current maintained version can be foud here.
Contributors¶
The main contributors are
Henrik Finsberg (henriknf@simula.no)
Johan Hake (hake.dev@gmail.com)
License¶
GNU LGPLv3
- modelparameters package
- Subpackages
- Submodules
- modelparameters.codegeneration module
- modelparameters.commands module
- modelparameters.config module
- modelparameters.logger module
Logger
Logger.add_log_indent()
Logger.add_logfile()
Logger.begin_log()
Logger.debug()
Logger.end_log()
Logger.error()
Logger.flush_logger()
Logger.get_log_handler()
Logger.get_log_level()
Logger.get_logfile_handler()
Logger.get_logger()
Logger.info()
Logger.info_blue()
Logger.info_green()
Logger.info_red()
Logger.log()
Logger.pop_log_level()
Logger.push_log_level()
Logger.remove_logfile()
Logger.set_default_exception()
Logger.set_log_handler()
Logger.set_log_indent()
Logger.set_log_level()
Logger.set_log_prefix()
Logger.set_raise_error()
Logger.suppress_logging()
Logger.type_error()
Logger.value_error()
Logger.warning()
Logger.wrap_log_message()
- modelparameters.parameterdict module
- modelparameters.parameters module
ArrayParam
ConstParam
OptionParam
Param
Range
ScalarParam
SlaveParam
Timer
TypelessParam
check_arg()
check_kwarg()
debug()
error()
eval_param_expr()
format_babel()
info()
pythoncode()
store_symbol_parameter()
symbol_to_param()
symbols_from_expr()
sympycode()
type_error()
value_error()
value_formatter()
value_namespace()
warning()
- modelparameters.sympytools module
Conditional()
ContinuousConditional()
add_pair_to_subs()
check_arg()
deprecated()
error()
iter_symbol_params_from_expr()
store_symbol_parameter()
symbol_param_value_namespace()
symbol_params_from_expr()
symbol_to_param()
symbol_to_params()
symbols_from_expr()
type_error()
value_error()
value_namespace()
- modelparameters.utils module
ClassType
Range
Timer
VALUE_JUST()
add_iterable()
camel_capitalize()
check_arg()
check_arginlist()
check_kwarg()
clear_timings()
deprecated()
error()
float_format()
format_time()
is_iterable()
list_timings()
listwrap()
param2value()
quote_join()
reduce()
rjust()
tic()
toc()
tuplewrap()
type_error()
value_error()
value_formatter()
warning()
- Module contents