Analysis, random and diagrams

cimba.analysis

cimba.analysis.summary(samples, *, confidence=0.95)

Per design point statistics of a (points, replications) array (or Samples), ignoring non-finite values. Returns a Summary.

class cimba.analysis.Summary

Arrays with one entry per design point: n, mean, std (sample, ddof=1), lower and upper (Student-t confidence interval for the mean).

cimba.analysis.compare(samples, *, a, b, confidence=0.95)

Paired comparison of design points a and b: the mean of samples[b] - samples[a] over replications where both are finite, with a Student-t interval. Returns a Comparison.

class cimba.analysis.Comparison

a, b, n (pairs used), difference, lower, upper. nan if fewer than two pairs.

cimba.analysis.check_input(source, *, reference, n=4096, seed=0, lags=10)

Generate n values from source (a distribution, trace or row source) and compare them with the 1-D reference. Returns an InputCheck. For a bootstrap.joint source, reference is a mapping with the same keys or a 2-D array with one column per member, and the result is a JointInputCheck.

class cimba.analysis.InputCheck

reference_mean, generated_mean, reference_variance, generated_variance, reference_quantiles and generated_quantiles (5, 25, 50, 75 and 95%), reference_acf/generated_acf and reference_pacf/generated_pacf (from lag 0), ks_statistic and ks_pvalue (two-sample Kolmogorov–Smirnov).

class cimba.analysis.JointInputCheck

keys, members (one InputCheck per member), reference_correlation and generated_correlation matrices.

cimba.random

Distribution draws for model-internal randomness in compiled code (routing, tie-breaking). They use the trial’s default stream. For real-world variability, prefer an input with an inputs.dist source. Calling these on the host raises RuntimeError.

Function

Returns

uniform(min=0.0, max=1.0)

float

exponential(mean=1.0), erlang(k, mean), hypoexponential(means), hyperexponential(means, probabilities)

float

normal(mu=0.0, sigma=1.0), lognormal(m, s), logistic(m, s), cauchy(mode, scale), student_t(v, m=0.0, s=1.0)

float

gamma(shape, scale=1.0), beta(a, b, min=0.0, max=1.0), weibull(shape, scale), pareto(shape, mode), rayleigh(s), chi_squared(k), f_dist(a, b)

float

triangular(min, mode, max), pert(min, mode, max), pert_mod(min, mode, max, lambda_)

float

bernoulli(p)

bool

dice(min, max), geometric(p), binomial(n, p), negative_binomial(m, p), poisson(r), categorical(probabilities)

int

categorical(probabilities) returns an index into probabilities.

cimba.diagrams

Draw configured models. Nothing is compiled or run, and input sources need not be bound yet. See Draw your model.

cimba.diagrams.structure(model)

The object tree: one "instance" node per static model instance (labelled path: Class), solid edges to children and list items, dotted edges for references. Returns a Graph.

cimba.diagrams.process_graph(model, *, fields=False, hooks=False)

Interactions inferred from the source of every process and event, resolved against the configured objects. Nodes: processes, entities, inputs (with their source), events, and new X nodes for spawned model classes, grouped by model instance and by spawned class. Edges are labelled with the operation (put, get, acquire, release, preempt, enqueue, cancel, wait, signal, record, next, now, at, spawn, schedule, and write with fields=True) and point the way things flow. hooks=True adds on_start/on_end hooks as actors. Returns a Graph.

cimba.diagrams.mermaid(model)

Shortcut for structure(model).to_mermaid().

class cimba.diagrams.Graph
nodes

Tuple of Node.

edges

Tuple of Edge.

groups

Tuple of Group.

node(key)

The node with that key.

to_mermaid(direction='TD')

Mermaid flowchart text (TD, LR, …); groups become subgraphs.

to_dot(rankdir='TB')

Graphviz DOT text; groups become clusters (dashed for spawned classes).

topological_order()

Node keys in flow order; ValueError if the graph has a cycle.

class cimba.diagrams.Node

key (a canonical path such as harbor.facilities.tugs or Ship.voyage), label, kind (instance, process, hook, event, entity, input, field or model) and group.

class cimba.diagrams.Edge

source, target, label and style ("solid" or "dotted").

class cimba.diagrams.Group

key, label and kind ("model" or "spawned").