util: utilities¶
qecsim.util¶
This module contains utility functions.
-
qecsim.util.chunker(iterable, chunk_len)¶ Returns an iterator of iterables of length chunk or less (for the final chunk).
- Parameters
iterable (iterable) – Iterable.
chunk_len (int) – Chunk length.
- Returns
An iterator of iterables of size chunk or less
- Return type
iterator
-
qecsim.util.init_logging()¶ Initialise logging.
Notes:
Configuration loaded from
$QECSIM_CFG/logging_qecsim.ini(ifQECSIM_CFGenv variable is set).Configuration loaded from
./logging_qecsim.inior~/.qecsim/logging_qecsim.ini(otherwise).If configuration not found then a basic configuration is used.
-
qecsim.util.load_clib(filename)¶ Load clib shared library.
Notes:
Library loaded from
$QECSIM_CFG/clib/<filename>(ifQECSIM_CFGenv variable is set).Library loaded from
./clib/<filename>or~/.qecsim/clib/<filename>(otherwise).
- Parameters
filename (str) – Library file name, e.g. ‘libpypm.so’.
- Returns
Library
- Return type
ctypes.CDLL
- Raises
FileNotFoundError – if filename does not resolve to an existing file.
OSError – if filename cannot be loaded as a shared library.