Observation models define what to measure from a simulation — BOLD signals, functional connectivity, power spectral density, and custom pipelines. Everything is defined in YAML: functions are declared in the functions: section and referenced by name in the observation pipeline:.
BOLD Signal
The Balloon-Windkessel hemodynamic model transforms neural activity into a BOLD fMRI signal. The pipeline is defined entirely in YAML — each function is specified with its equation, callable, or time range, then chained together:
work.conduction_speed.value > 0 else jnp.zeros((int(n_nodes), int(n_nodes)), dtype=jnp.int32)
di = -1 * idelays - 1
delay_indices = (di, dn)
dt = state.dt
nt = state.nt
time_steps = jnp.arange(0, nt)
# Generate batch noise using xi with per-state sigma_vec.
# Prefer state-provided sigma_vec (supports vmapped sweeps); fallback to experiment-level constants.
seed = getattr(state.noise, 'seed', 0) if hasattr(state.noise, 'seed') else 0
try:
sigma_vec_runtime = getattr(state.noise, 'sigma_vec', None)
except Exception:
sigma_vec_runtime = None
sigma_vec = sigma_vec_runtime if sigma_vec_runtime is not None else jnp.array([0.])
noise = g(dt, nt, n_svar, n_nodes, n_modes, seed=seed, sigma_vec=sigma_vec)
p = transform_parameters(state.parameters.dynamics)
params_integrate = (p, state.parameters.coupling, state.stimulus)
op = lambda ics, external_input: integrate(ics, weights, dt, params_integrate, delay_indices, external_input)
latest_carry, res = jax.lax.scan(op, ics, (time_steps, noise))
trace = res
trace = jnp.hstack((
trace[:, [0], :],
))
t_offset = 0
time_steps = time_steps + 1
labels_dimensions = {
"Time": None,
"State Variable": ['S'],
"Space": ['0'],
"Mode": ['m0'],
}
return TimeSeries(time=(time_steps + t_offset) * dt, data=trace, title = "Raw", sample_period=dt, labels_dimensions=labels_dimensions)
The generated code shows each function definition followed by the pipeline composition. No Python functions are hardcoded — everything is generated from the YAML specification.
Pipeline Architecture
Observation pipelines chain functions sequentially. Each step’s output becomes the next step’s input automatically. Steps can be:
Type
YAML Field
Description
Equation
equation.rhs
Symbolic math expression, rendered to JAX
Callable
callable: {module, name}
Reference to an external library function
Kernel
time_range + equation
Generates a TimeSeries over a time range
Available Observation Models
Pre-defined observation models in tvbo/database/observation_models/:
Model
File
Description
BOLD (TVB)
bold_tvb.yaml
Balloon-Windkessel HRF with downsampling
FC
FC.yaml
Pearson correlation matrix
See Also
Model Fitting — use observations as targets for optimization