Table of Contents

Class Brain

Namespace
DotFly.Core.Graph
Assembly
DotFly.Core.dll

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

ReadOnlySpan<ulong>

Columns

CSR column indices (postsynaptic neuron index).

public ReadOnlySpan<int> Columns { get; }

Property Value

ReadOnlySpan<int>

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

long

EdgeCount

Number of directed edges.

public long EdgeCount { get; }

Property Value

long

this[int]

Full annotation record of one neuron.

public NeuronInfo this[int index] { get; }

Parameters

index int

Property Value

NeuronInfo

Model

Neuron model the checkpoint was built for.

public NeuronModel Model { get; }

Property Value

NeuronModel

NeuronCount

Number of neurons.

public int NeuronCount { get; }

Property Value

int

Neurotransmitters

Neurotransmitter by neuron index.

public ReadOnlySpan<Neurotransmitter> Neurotransmitters { get; }

Property Value

ReadOnlySpan<Neurotransmitter>

Path

Path of the underlying file.

public string Path { get; }

Property Value

string

Provenance

Provenance record of the checkpoint.

public Provenance Provenance { get; }

Property Value

Provenance

RowPtr

CSR row pointers (length N+1).

public ReadOnlySpan<long> RowPtr { get; }

Property Value

ReadOnlySpan<long>

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

IReadOnlyDictionary<string, NeuronSet>

Sides

Side by neuron index.

public ReadOnlySpan<Side> Sides { get; }

Property Value

ReadOnlySpan<Side>

SomaPositions

Soma voxel coordinates, 3 ints per neuron (MinValue = unknown).

public ReadOnlySpan<int> SomaPositions { get; }

Property Value

ReadOnlySpan<int>

Strings

The interned annotation strings.

public StringTable Strings { get; }

Property Value

StringTable

Weights

CSR weights (signed contact counts).

public ReadOnlySpan<short> Weights { get; }

Property Value

ReadOnlySpan<short>

WeightsPointer

Unsafe pointer access for kernels; valid until Dispose().

public short* WeightsPointer { get; }

Property Value

short*

Methods

ByBodyId(ulong)

A single-neuron set by body ID.

public NeuronSet ByBodyId(ulong bodyId)

Parameters

bodyId ulong

Returns

NeuronSet

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

name string
bodyIds ReadOnlySpan<ulong>

Returns

NeuronSet

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

seed NeuronSet
hops int
minWeight int

Returns

NeuronSet

IndexOf(ulong)

Neuron index of a body ID, or −1.

public int IndexOf(ulong bodyId)

Parameters

bodyId ulong

Returns

int

Open(string)

Opens a checkpoint file.

public static Brain Open(string path)

Parameters

path string

Returns

Brain

OutEdges(int)

Out-edges of a neuron: (postsynaptic index, signed contact count) pairs.

public EdgeSpan OutEdges(int neuron)

Parameters

neuron int

Returns

EdgeSpan

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

type string
superclass string
cls string
instance string
flywireType string
hemibrainType string
side Side?
nt Neurotransmitter?
name string

Returns

NeuronSet

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)

Parameters

target NeuronSet
hops int
minWeight int

Returns

NeuronSet