booldog.utils.misc
Attributes
Classes
Generic enumeration. |
Functions
Return numpy array of v, given array, int/float, list, tuple |
|
|
Parameter argument to numpy array |
|
Checks if path is writeable. If not, attempts to provide reason, and raises |
Get version of booldog package |
Module Contents
- booldog.utils.misc.logger
- class booldog.utils.misc.ExtendedEnum
Bases:
enum.EnumGeneric enumeration.
Derive from this class to define new enumerations.
- classmethod values()
- booldog.utils.misc.ensure_ndarray(v)
Return numpy array of v, given array, int/float, list, tuple
- booldog.utils.misc.parameter_to_array(parameter, graph_keys)
Parameter argument to numpy array
- Parameters:
parameter (array, int, float or dict) –
- if array:
make sure length is n
- if int or float:
return an array of length n with value
- if dict:
returns an array of length n with values set according to
keys (nodes indexed by graph_keys), and the rest set to ‘default’ key
graph_keys (dict)
- Returns:
parameter_array – array of length n
- Return type:
numpy array
- booldog.utils.misc.file_writable(path)
Checks if path is writeable. If not, attempts to provide reason, and raises an Exception.
- Parameters:
path (str or Path) – Path to file to check for writability. If the file does not exist, the function will check if it can be created.
- Return type:
None
- booldog.utils.misc.get_pkg_version()
Get version of booldog package
- Returns:
version – Version of booldog package
- Return type:
str