AxoBench API

NeuronIO conversion

Signatures, parameters, return values, and source for neuronIO conversion.

Overview

Parse raw NeuronIO simulation pickles and write deterministic AxoBench shards. Inhibitory channels receive the sign -1, and the soma target is clipped at -55 mV and normalized as (v + 67.7) * 0.1. Converted shards store no unclipped voltage; NeuronIO compatibility explains the consequences for the metrics. Raw files are Python pickles: parse only trusted files.

Source revision: 496e0c1a2dfd. Export index.

convert_neuronio_pickles

axobench.neuronio_raw.convert_neuronio_pickles(input_path: str | Path, output_dir: str | Path, *, shard_size: int=128, window_size: int | None=None, window_stride: int | None=None, ignore_start: int=0, y_soma_threshold: float=DEFAULT_Y_SOMA_THRESHOLD, y_train_soma_bias: float=DEFAULT_Y_TRAIN_SOMA_BIAS, y_train_soma_scale: float=DEFAULT_Y_TRAIN_SOMA_SCALE) -> list[Path]

Source

Convert raw NeuronIO files (sim__ below input_path, or one file) to shards named neuronio_00000.npz with a manifest. Existing manifest entries in output_dir are kept and new shards are numbered after them.

Parameters

input_path str | Path
required. Raw file or directory searched recursively.
output_dir str | Path
required. Destination directory.
shard_size int
keyword-only, default=128. Traces per shard.
window_size int | None
keyword-only, default=None. Optional window length; None keeps whole simulations.
window_stride int | None
keyword-only, default=None. Window stride; defaults to window_size.
ignore_start int
keyword-only, default=0. First window start when windowing.
y_soma_threshold float
keyword-only, default=DEFAULT_Y_SOMA_THRESHOLD = -55.0. Clipping level in millivolts.
y_train_soma_bias float
keyword-only, default=DEFAULT_Y_TRAIN_SOMA_BIAS = -67.7. Millivolt bias subtracted after clipping.
y_train_soma_scale float
keyword-only, default=DEFAULT_Y_TRAIN_SOMA_SCALE. Scale applied after the bias.

Returns

paths list[Path]
Written shard files.

parse_neuronio_pickle

axobench.neuronio_raw.parse_neuronio_pickle(path: str | Path) -> RawNeuronIO

Source

Parse one raw NeuronIO pickle into dense arrays at 1 ms.

Parameters

path str | Path
required. Raw pickle file.

Returns

raw RawNeuronIO
Unsigned inputs, spikes, soma voltage, and metadata.

RawNeuronIO

axobench.neuronio_raw.RawNeuronIO(inputs: np.ndarray, spikes: np.ndarray, soma: np.ndarray, metadata: dict[str, object])

Source

Arrays of one raw NeuronIO file.

Parameters

inputs np.ndarray
required. Unsigned input events (simulation, time, 2 x segments), excitatory segments first.
spikes np.ndarray
required. Output spike indicators, (simulation, time).
soma np.ndarray
required. Soma voltage in millivolts, (simulation, time).
metadata dict[str, object]
required. Simulation count, duration, synapse count, segment types, and distances from the soma.

Attributes

Constructor fields are retained as read-only attributes.

normalize_soma

axobench.neuronio_raw.normalize_soma(soma: np.ndarray, threshold: float=DEFAULT_Y_SOMA_THRESHOLD, bias: float=DEFAULT_Y_TRAIN_SOMA_BIAS, scale: float=DEFAULT_Y_TRAIN_SOMA_SCALE) -> np.ndarray

Source

Clip at the threshold and normalize: (min(v, threshold) - bias) * scale.

Parameters

soma np.ndarray
required. Voltage in millivolts.
threshold float
default=DEFAULT_Y_SOMA_THRESHOLD = -55.0. Clipping level in millivolts.
bias float
default=DEFAULT_Y_TRAIN_SOMA_BIAS = -67.7. Millivolt bias.
scale float
default=DEFAULT_Y_TRAIN_SOMA_SCALE. Scale after the bias.

Returns

normalized np.ndarray
float32 target coordinate.

create_neuronio_input_type

axobench.neuronio_raw.create_neuronio_input_type(num_input: int) -> np.ndarray

Source

Channel signs: +1 for the first half and -1 for the second half.

Parameters

num_input int
required. Even channel count.

Returns

signs np.ndarray
float32 sign per channel.

Search guides, examples, and API signatures.