lanes

run.lanes

Run one experiment once per lane of the per-node values its event parameters source.

An event parameter whose used: DataRef resolves to an array on the network’s nodes and one axis more varies per lane: every entry of that extra axis is one run of the same settled experiment with the parameter set to that entry’s per-node values. A DBS cohort is the case this serves: a curated container holds one row per stimulation programme (programme × node, with subject and session as coordinates on programme), and each row drives the stimulus of one lane.

The experiment is rendered and settled once. The lanes then run as one zip space over the event parameters’ leaves in state.external through tvboptim’s ParallelExecution, and every declared observation is recorded in that one sweep. With baseline=True one more run, every lane parameter at zero, is recorded beside them as <observation>_baseline, the undriven reference an evoked response is read against. The result is one xarray.Dataset: each observation on the lane axis (its coordinates carried over from the source) and the observation’s own dims, node axes labelled with the network’s node labels, and the lane values themselves as axis_points__<event>.<parameter>, the name a saved exploration gives its array-valued axes.

Attributes

Name Description
AXIS_POINTS Prefix of the variables that carry each lane’s parameter values, as in a saved exploration.
BASELINE Suffix of the undriven reference recorded beside each observation.
NODE_DIMS Observation dims that name the network’s node axis.

Classes

Name Description
LaneParameter One event parameter that varies per lane: the key of its event in state.external, its name, and its (lane, node) values.

LaneParameter

run.lanes.LaneParameter(event, name, values)

One event parameter that varies per lane: the key of its event in state.external, its name, and its (lane, node) values.

Attributes

Name Description
key <event>.<parameter>, the path an exploration axis spells it with.

Functions

Name Description
build_network The emitted module’s network over the spec’s own weights, and its tract lengths where create_network takes them.
lane_parameters The experiment’s lane-varying event parameters, every one on the same lane axis.
run_lanes Every lane of the experiment’s lane parameters run once from the settled state, every observation recorded.
settle (model_fn, state) after the experiment’s transient, the noise key reset to the declared execution.random_seed so every lane integrates the same realisation.

build_network

run.lanes.build_network(experiment, namespace)

The emitted module’s network over the spec’s own weights, and its tract lengths where create_network takes them.

lane_parameters

run.lanes.lane_parameters(experiment, lanes=None, *, results_root=None)

The experiment’s lane-varying event parameters, every one on the same lane axis.

Without lanes, each event parameter whose used: DataRef names a container (an iri, an experiment or an analysis) is resolved through tvbo.data.dataref.resolve_dataref, reconciled by node label when the reference asks for it; the data parameter of a data-driven stimulus is a recording, not a lane parameter, and is left to the stimulus. With lanes, its <event>.<parameter> variables are the values instead, which is how a caller that holds the arrays in memory runs the same sweep without writing them first. Raises when nothing varies per lane or the parameters disagree on the lane axis.

run_lanes

run.lanes.run_lanes(
    experiment,
    lanes=None,
    *,
    results_root=None,
    observations=None,
    batch_size=8,
    n_devices=1,
    baseline=True,
    namespace=None,
)

Every lane of the experiment’s lane parameters run once from the settled state, every observation recorded.

lanes and results_root are as in lane_parameters. observations restricts the recorded observations (default: every declared one). batch_size lanes are vectorised together on each of n_devices devices; neither changes a lane’s value. namespace is the experiment’s rendered tvboptim module when the caller already holds it. Observations keep the precision the experiment computed in and come back as float64.

settle

run.lanes.settle(experiment, namespace, network)

(model_fn, state) after the experiment’s transient, the noise key reset to the declared execution.random_seed so every lane integrates the same realisation.