Class Brain
An opened, immutable checkpoint: the neuron table, the CSR graph and the named sets, all read in place from the memory-mapped file. Thread-safe for concurrent readers; share one instance between simulations.
public sealed class Brain : IDisposable
- Inheritance
-
Brain
- Implements
- Inherited Members
- Extension Methods
Properties
BodyIds
Body / root IDs by neuron index.
public ReadOnlySpan<ulong> BodyIds { get; }
Property Value
Columns
CSR column indices (postsynaptic neuron index).
public ReadOnlySpan<int> Columns { get; }
Property Value
ColumnsPointer
Unsafe pointer access for kernels; valid until Dispose().
public int* ColumnsPointer { get; }
Property Value
- int*
ContactCount
Sum of absolute contact counts over all edges.
public long ContactCount { get; }
Property Value
EdgeCount
Number of directed edges.
public long EdgeCount { get; }
Property Value
this[int]
Full annotation record of one neuron.
public NeuronInfo this[int index] { get; }
Parameters
indexint
Property Value
Model
Neuron model the checkpoint was built for.
public NeuronModel Model { get; }
Property Value
NeuronCount
Number of neurons.
public int NeuronCount { get; }
Property Value
Neurotransmitters
Neurotransmitter by neuron index.
public ReadOnlySpan<Neurotransmitter> Neurotransmitters { get; }
Property Value
Path
Path of the underlying file.
public string Path { get; }
Property Value
Provenance
Provenance record of the checkpoint.
public Provenance Provenance { get; }
Property Value
RowPtr
CSR row pointers (length N+1).
public ReadOnlySpan<long> RowPtr { get; }
Property Value
RowPtrPointer
Unsafe pointer access for kernels; valid until Dispose().
public long* RowPtrPointer { get; }
Property Value
- long*
Sets
Named sets shipped in the checkpoint.
public IReadOnlyDictionary<string, NeuronSet> Sets { get; }
Property Value
Sides
Side by neuron index.
public ReadOnlySpan<Side> Sides { get; }
Property Value
SomaPositions
Soma voxel coordinates, 3 ints per neuron (MinValue = unknown).
public ReadOnlySpan<int> SomaPositions { get; }
Property Value
Strings
The interned annotation strings.
public StringTable Strings { get; }
Property Value
Weights
CSR weights (signed contact counts).
public ReadOnlySpan<short> Weights { get; }
Property Value
WeightsPointer
Unsafe pointer access for kernels; valid until Dispose().
public short* WeightsPointer { get; }
Property Value
Methods
ByBodyId(ulong)
A single-neuron set by body ID.
public NeuronSet ByBodyId(ulong bodyId)
Parameters
bodyIdulong
Returns
Exceptions
- KeyNotFoundException
The ID is not in this checkpoint.
ByBodyIds(string, ReadOnlySpan<ulong>)
A set from body IDs; every ID must exist (no silent drops).
public NeuronSet ByBodyIds(string name, ReadOnlySpan<ulong> bodyIds)
Parameters
namestringbodyIdsReadOnlySpan<ulong>
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Downstream(NeuronSet, int, int)
Neurons reachable from seed within hops forward hops
over edges with |contact count| ≥ minWeight, including the seed.
public NeuronSet Downstream(NeuronSet seed, int hops, int minWeight = 1)
Parameters
Returns
IndexOf(ulong)
Neuron index of a body ID, or −1.
public int IndexOf(ulong bodyId)
Parameters
bodyIdulong
Returns
Open(string)
Opens a checkpoint file.
public static Brain Open(string path)
Parameters
pathstring
Returns
OutEdges(int)
Out-edges of a neuron: (postsynaptic index, signed contact count) pairs.
public EdgeSpan OutEdges(int neuron)
Parameters
neuronint
Returns
Query(string?, string?, string?, string?, string?, string?, Side?, Neurotransmitter?, string?)
Neurons matching all given criteria. String criteria match exactly, or as a prefix/suffix
glob when they contain a trailing/leading *. Returns an empty set when nothing matches.
public NeuronSet Query(string? type = null, string? superclass = null, string? cls = null, string? instance = null, string? flywireType = null, string? hemibrainType = null, Side? side = null, Neurotransmitter? nt = null, string? name = null)
Parameters
typestringsuperclassstringclsstringinstancestringflywireTypestringhemibrainTypestringsideSide?ntNeurotransmitter?namestring
Returns
Upstream(NeuronSet, int, int)
Neurons from which target is reachable within hops
forward hops over edges with |contact count| ≥ minWeight, including the
target. Each hop is one pass over the CSR (no in-edge index is stored), ~25 M edges for MaleCNS.
public NeuronSet Upstream(NeuronSet target, int hops, int minWeight = 1)