spux.utils package

Submodules

spux.utils.annotate module

spux.utils.annotate.annotate(data, labels, time, auxiliary=None)[source]

Annotate data array with the given labels (with an option for auxiliary information).

Optional auxiliary object of any type can be provided and will be passed to the error model, but will not be stored in the corresponding ‘info’ as the model prediction, and hence will be node-local. In the error model, the ‘prediction’ will then be a dictionary of the form: {‘scalars’ : predictions, ‘auxiliary’ : auxiliary}. This is useful for large non-scalar model outputs, such as vectors or multi-dimensional arrays (e.g. xarray’s). Any additional (i.e outside the error model) access of such auxiliary information is not supported. As such data is often very large, the recommended option is to keep the trace of all sandboxes and perform additional a posteriori post-processing.

spux.utils.assign module

spux.utils.debug_inparallel module

spux.utils.environment module

spux.utils.evaluations module

spux.utils.evaluations.construct(instance, tasks)[source]

Recursively construct model evaluations report.

spux.utils.progress module

class spux.utils.progress.Progress(prefix, steps, length=20, caption='Progress: ')[source]

Bases: object

Class for update’able progress bar for the command line.

finalize()[source]
increment(diff=1)[source]
init()[source]
message(message)[source]
reset()[source]
update(step)[source]

spux.utils.sandbox module

spux.utils.seed module

class spux.utils.seed.Seed(seed=0, name='root')[source]

Bases: object

Class to generate independent seeds for random number generators.

cumulative()[source]

Get cumulative seed.

spawn(seed, name='noname')[source]

Spawn new seed based on current state (append lists).

spux.utils.seed.inc(a)[source]
spux.utils.seed.pair(a, b)[source]

Construct (pair) two seeds from one [Szudzik].

spux.utils.serialize module

spux.utils.setup module

spux.utils.shell module

spux.utils.shell.execute(command, directory=None, verbosity=1, executable=None)[source]

Execute an application command (including any arguments) in a command line shell.

spux.utils.synthesize module

spux.utils.testing module

spux.utils.timer module

class spux.utils.timer.Timer[source]

Bases: object

current(format=0)[source]
pause()[source]
start()[source]
timestamp()[source]

spux.utils.timing module

class spux.utils.timing.Timing[source]

Bases: object

start(name)[source]
time(name)[source]

spux.utils.transforms module

spux.utils.transforms.flatten(dictlist)[source]

Flatten a list of dictionaries into a dictionary.

spux.utils.transforms.logmeanstd(logm, logs)[source]

Return the needed quantities to construct stats.lognorm with a specified mean (logm) and standard deviation (logs).

According to documentation at: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.lognorm.html

spux.utils.transforms.numpify(dictionary)[source]

Convert dict with integer keys to numpy array - assume user plays nice.

spux.utils.transforms.pandify(dictionary)[source]

Convert dict with integer keys and pandas DataFrame rows to pandas DataFrame - assume user plays nice.

spux.utils.transforms.rounding(method)[source]

A decorator to map method arguments from float to integer by rounding.

spux.utils.traverse module

spux.utils.traverse.components(root, includes=['Model', 'Likelihood', 'Sampler'])[source]

Auto-magically generate a table for all SPUX components.

spux.utils.traverse.infos(info)[source]

Auto-magically generate a table for info tructure.