Class Simulation
- Namespace
- DotFly
- Assembly
- DotFly.Engine.dll
A running network: one Brain, one backend, the input/output ports bound to neuron sets, the clock, the recorder and the causal switches. All members are meant to be called from one thread (the caller of Run(TimeSpan)/Advance(int), or the RealtimeDriver's thread) except Write(ReadOnlySpan<float>), Snapshot, the switches and the read-only properties, which are safe from any thread.
public sealed class Simulation : IDisposable, ISpikeSink
- Inheritance
-
Simulation
- Implements
- Inherited Members
Properties
Backend
The backend (kernel-level access; prefer the engine API).
public ISpikingBackend Backend { get; }
Property Value
Brain
The checkpoint.
public Brain Brain { get; }
Property Value
Clock
Neural / wall time bookkeeping.
public SimulationClock Clock { get; }
Property Value
Constants
Per-step constants in use.
public LifStepConstants Constants { get; }
Property Value
DtMs
Timestep in ms.
public double DtMs { get; }
Property Value
ExternalInput
Causal switch: apply external inputs (Poisson, currents, injections) or ignore them all.
public bool ExternalInput { get; set; }
Property Value
Inputs
Input ports created so far.
public IReadOnlyList<InputPort> Inputs { get; }
Property Value
NeuralTime
Neural time elapsed.
public TimeSpan NeuralTime { get; }
Property Value
Options
Options this simulation was created with.
public SimulationOptions Options { get; }
Property Value
Outputs
Output ports created so far.
public IReadOnlyList<OutputPort> Outputs { get; }
Property Value
RecurrentTransmission
Causal switch: deliver spikes to their targets (true) or cut all recurrent transmission (false).
public bool RecurrentTransmission { get; set; }
Property Value
Seed
Current seed of the backend.
public ulong Seed { get; }
Property Value
Silenced
Neurons currently silenced (outgoing synapses zeroed; they still spike).
public IReadOnlyCollection<int> Silenced { get; }
Property Value
Step
Steps completed.
public long Step { get; }
Property Value
Methods
Advance(int)
Advances by steps steps.
public void Advance(int steps)
Parameters
stepsint
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Inject(NeuronSet, TimeSpan)
Schedules an event on every neuron of set at at.
public void Inject(NeuronSet set, TimeSpan at)
Parameters
Inject(int, TimeSpan)
Schedules one input event of the model's Poisson weight on neuron at neural time at (≥ now).
public void Inject(int neuron, TimeSpan at)
Parameters
Inject(int, TimeSpan, double)
Schedules a voltage injection of mv on neuron at neural time at (≥ now).
public void Inject(int neuron, TimeSpan at, double mv)
Parameters
Input(NeuronSet, InputKind)
Creates an input port over set; values start at 0 (no input).
public InputPort Input(NeuronSet set, InputKind kind)
Parameters
Returns
Output(NeuronSet, OutputKind, TimeSpan?)
Creates an output port over set, published every publishEvery (default 20 ms).
public OutputPort Output(NeuronSet set, OutputKind kind, TimeSpan? publishEvery = null)
Parameters
setNeuronSetkindOutputKindpublishEveryTimeSpan?
Returns
Record(string, RecordFlags)
Starts recording to a .dfs file; dispose the returned recorder (or this simulation) to finish it.
public Recorder Record(string path, RecordFlags what = RecordFlags.All)
Parameters
pathstringwhatRecordFlags
Returns
Reset()
Resets the network state and clock to step 0 (same seed ⇒ same run). Ports, silencing and switches are kept.
public void Reset()
Reset(ulong)
Resets the network state and clock to step 0 with a new seed (a fresh trial). Ports, silencing and switches are kept.
public void Reset(ulong seed)
Parameters
seedulong
Restore(SimulationSnapshot)
Restores a snapshot taken from this simulation (or one with the same checkpoint and options). Scheduled actions and injections are dropped.
public void Restore(SimulationSnapshot snapshot)
Parameters
snapshotSimulationSnapshot
Run(TimeSpan)
Advances by neural of neural time (rounded to whole steps).
public void Run(TimeSpan neural)
Parameters
neuralTimeSpan
ScheduleAt(long, Action<Simulation>)
Runs action on the simulation thread just before step step executes (≥ current step).
public void ScheduleAt(long step, Action<Simulation> action)
Parameters
steplongactionAction<Simulation>
ScheduleAt(TimeSpan, Action<Simulation>)
Runs action just before the step at neural time at.
public void ScheduleAt(TimeSpan at, Action<Simulation> action)
Parameters
atTimeSpanactionAction<Simulation>
Silence(NeuronSet)
Zeroes the outgoing synapses of the set's neurons (Shiu-style silencing). They still integrate and spike.
public void Silence(NeuronSet set)
Parameters
setNeuronSet
Snapshot()
Captures the dynamic state for later Restore(SimulationSnapshot) (branching experiments, episode resets).
public SimulationSnapshot Snapshot()
Returns
StepOf(TimeSpan)
Step index of a neural time (rounded to the nearest step).
public long StepOf(TimeSpan neuralTime)
Parameters
neuralTimeTimeSpan
Returns
Unsilence(NeuronSet)
Restores the outgoing synapses of the set's neurons.
public void Unsilence(NeuronSet set)
Parameters
setNeuronSet
Events
OnSpikes
Called on the simulation thread with each step's spikes.
public event SpikeHandler OnSpikes