amisc.utils
Provides some basic utilities for the package.
Includes:
load_variables
: convenience function for loading RVs from a .json config fileget_logger
: logging utility with nice formatting
get_logger(name, stdout=True, log_file=None)
Return a file/stdout logger with the given name.
PARAMETER | DESCRIPTION |
---|---|
name |
the name of the logger to return
TYPE:
|
stdout |
whether to add a stdout handler to the logger
DEFAULT:
|
log_file |
add file logging to this file (optional)
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Logger
|
the logger |
Source code in src/amisc/utils.py
load_variables(variables, file)
Load a list of BaseRV objects from a variables json file
.
PARAMETER | DESCRIPTION |
---|---|
variables |
a list of str ids for variables to find in
TYPE:
|
file |
json file to search for variable definitions
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[BaseRV]
|
a list of corresponding |