booldog.utils

Submodules

Attributes

logger

Classes

ExtendedEnum

Generic enumeration.

Functions

ensure_ndarray(v)

Return numpy array of v, given array, int/float, list, tuple

parameter_to_array(parameter, graph_keys)

Parameter argument to numpy array

file_writable(path)

Checks if path is writeable. If not, attempts to provide reason, and raises

get_pkg_version()

Get version of booldog package

Package Contents

booldog.utils.logger
class booldog.utils.ExtendedEnum

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

classmethod values()
booldog.utils.ensure_ndarray(v)

Return numpy array of v, given array, int/float, list, tuple

booldog.utils.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.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.get_pkg_version()

Get version of booldog package

Returns:

version – Version of booldog package

Return type:

str