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]
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_pathstr | Path- required. Raw file or directory searched recursively.
output_dirstr | Path- required. Destination directory.
shard_sizeint- keyword-only, default=128. Traces per shard.
window_sizeint | None- keyword-only, default=None. Optional window length; None keeps whole simulations.
window_strideint | None- keyword-only, default=None. Window stride; defaults to window_size.
ignore_startint- keyword-only, default=0. First window start when windowing.
y_soma_thresholdfloat- keyword-only, default=DEFAULT_Y_SOMA_THRESHOLD = -55.0. Clipping level in millivolts.
y_train_soma_biasfloat- keyword-only, default=DEFAULT_Y_TRAIN_SOMA_BIAS = -67.7. Millivolt bias subtracted after clipping.
y_train_soma_scalefloat- keyword-only, default=DEFAULT_Y_TRAIN_SOMA_SCALE. Scale applied after the bias.
Returns
pathslist[Path]- Written shard files.
parse_neuronio_pickle
axobench.neuronio_raw.parse_neuronio_pickle(path: str | Path) -> RawNeuronIO
Parse one raw NeuronIO pickle into dense arrays at 1 ms.
Parameters
pathstr | Path- required. Raw pickle file.
Returns
rawRawNeuronIO- 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])
Arrays of one raw NeuronIO file.
Parameters
inputsnp.ndarray- required. Unsigned input events (simulation, time, 2 x segments), excitatory segments first.
spikesnp.ndarray- required. Output spike indicators, (simulation, time).
somanp.ndarray- required. Soma voltage in millivolts, (simulation, time).
metadatadict[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
Clip at the threshold and normalize: (min(v, threshold) - bias) * scale.
Parameters
somanp.ndarray- required. Voltage in millivolts.
thresholdfloat- default=DEFAULT_Y_SOMA_THRESHOLD = -55.0. Clipping level in millivolts.
biasfloat- default=DEFAULT_Y_TRAIN_SOMA_BIAS = -67.7. Millivolt bias.
scalefloat- default=DEFAULT_Y_TRAIN_SOMA_SCALE. Scale after the bias.
Returns
normalizednp.ndarray- float32 target coordinate.
create_neuronio_input_type
axobench.neuronio_raw.create_neuronio_input_type(num_input: int) -> np.ndarray
Channel signs: +1 for the first half and -1 for the second half.
Parameters
num_inputint- required. Even channel count.
Returns
signsnp.ndarray- float32 sign per channel.