AxoBench API
Intervention inputs
Signatures, parameters, return values, and source for intervention inputs.
Overview
Input-side constructors for the five intervention conditions and a loader for paired intervention shards. Each constructor returns the edited inputs and a boolean mask of the baseline events it removed or moved. Producing teacher targets for new inputs requires the simulator stack in axobench.generation. Paired interventions describes the released conditions.
Source revision: 496e0c1a2dfd. Export index.
make_structured_intervention_inputs
axobench.benchmark.structured_intervention.make_structured_intervention_inputs(inputs: np.ndarray, *, intervention: str, seed: int=0, dropout_probability: float=0.35, jitter_steps: int=2, site_start_fraction: float=0.0, site_fraction: float=0.25) -> tuple[np.ndarray, np.ndarray, dict[str, Any]]
Apply one named condition with the released v1 parameters as defaults. Exported from axobench.benchmark.
Parameters
inputsnp.ndarray- required. Signed inputs, (trace, time, channels) or (time, channels).
interventionstr- keyword-only, required. event_dropout, exc_dropout, inh_dropout, temporal_jitter, or site_silence.
seedint- keyword-only, default=0. Seed of the random conditions.
dropout_probabilityfloat- keyword-only, default=0.35. Removal probability of the dropout conditions.
jitter_stepsint- keyword-only, default=2. Maximum absolute shift of temporal_jitter.
site_start_fractionfloat- keyword-only, default=0.0. Start of the silenced band as a fraction of the sites per sign.
site_fractionfloat- keyword-only, default=0.25. Width of the silenced band as a fraction of the sites per sign.
Returns
intervenednp.ndarray- Edited inputs.
changednp.ndarray- Boolean mask of edited baseline events.
metadatadict[str, Any]- Condition parameters and baseline, intervention, and changed event counts.
make_event_dropout_inputs
axobench.benchmark.structured_intervention.make_event_dropout_inputs(inputs: np.ndarray, *, dropout_probability: float, seed: int=0) -> tuple[np.ndarray, np.ndarray]
Remove each nonzero event independently with the given probability. Exported from axobench.benchmark.
Parameters
inputsnp.ndarray- required. Signed inputs.
dropout_probabilityfloat- keyword-only, required. Removal probability in [0, 1].
seedint- keyword-only, default=0. Random seed.
Returns
intervenednp.ndarray- Edited inputs.
changednp.ndarray- Mask of removed events.
make_selective_event_dropout_inputs
axobench.benchmark.structured_intervention.make_selective_event_dropout_inputs(inputs: np.ndarray, *, dropout_probability: float, event_sign: int, seed: int=0) -> tuple[np.ndarray, np.ndarray]
Remove only excitatory (+1) or only inhibitory (-1) events with the given probability. Exported from axobench.benchmark.
Parameters
inputsnp.ndarray- required. Signed inputs.
dropout_probabilityfloat- keyword-only, required. Removal probability in [0, 1].
event_signint- keyword-only, required. 1 for excitatory or -1 for inhibitory events.
seedint- keyword-only, default=0. Random seed.
Returns
intervenednp.ndarray- Edited inputs.
changednp.ndarray- Mask of removed events.
make_temporal_jitter_inputs
axobench.benchmark.structured_intervention.make_temporal_jitter_inputs(inputs: np.ndarray, *, max_jitter_steps: int, seed: int=0) -> tuple[np.ndarray, np.ndarray]
Move every event by an integer shift drawn uniformly from -max_jitter_steps to +max_jitter_steps, clipped to the trace. Events that land on the same step and channel merge. Exported from axobench.benchmark.
Parameters
inputsnp.ndarray- required. Signed inputs.
max_jitter_stepsint- keyword-only, required. Maximum absolute shift; 0 returns a copy.
seedint- keyword-only, default=0. Random seed.
Returns
intervenednp.ndarray- Edited inputs, (trace, time, channels).
changednp.ndarray- Mask of baseline events that moved.
make_site_silence_inputs
axobench.benchmark.structured_intervention.make_site_silence_inputs(inputs: np.ndarray, *, start_fraction: float=0.0, site_fraction: float=0.25) -> tuple[np.ndarray, np.ndarray]
Remove all events on a contiguous band of sites in both the excitatory and the inhibitory half of the channels. The band is a channel range; on a morphology that leaves some sites without a synapse it silences fewer effective synapses. Exported from axobench.benchmark.
Parameters
inputsnp.ndarray- required. Signed inputs with excitatory and inhibitory halves.
start_fractionfloat- keyword-only, default=0.0. Start of the band as a fraction of the sites per sign.
site_fractionfloat- keyword-only, default=0.25. Width of the band as a fraction of the sites per sign; at least one site.
Returns
intervenednp.ndarray- Edited inputs.
changednp.ndarray- Mask of removed events.
load_intervention_pair_npz
axobench.benchmark.runner.load_intervention_pair_npz(path: str | Path, *, max_samples: int | None=None) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, list[str]]
Load the first pairs of a paired intervention shard. The file is opened with allow_pickle=True, so load only trusted files. Exported from axobench.benchmark.
Parameters
pathstr | Path- required. Pair shard.
max_samplesint | None- keyword-only, default=None. Maximum pairs; None loads all.
Returns
arraystuple- baseline_inputs, baseline_targets, intervention_inputs, intervention_targets, and the sample IDs.