private static string GetTriggersWithChargeString(IEnumerable <TriggerInfo> triggers, NeuronCollection neurons) { string result = string.Join( string.Empty, triggers.Select(et => (et.Effect == NeurotransmitterEffect.Excite ? "+" : "-") + (neurons.Contains(et.PresynapticId) ? neurons[et.PresynapticId].Data : string.Empty)) ); return(result); }
public void AddTriggered(Neuron value, TriggeredEventArgs triggeredEventArgs) { if (this.enabled) { this.TriggeredAdded?.Invoke(this, new SpikeResultEventArgs(new NeuronResult(triggeredEventArgs.TriggerInfo.Timestamp, value.Id, value.Data, triggeredEventArgs.TriggerInfo.Effect, triggeredEventArgs.Charge))); var path = string.Join(" >> ", triggeredEventArgs.Path.Select(fi => SpikeResultsService.GetTriggersWithChargeString(fi.Triggers, this.neurons))); SpikeResultsService.logger.Info($"{value.ToString()} triggered." + $"{Environment.NewLine}\t{triggeredEventArgs.SpikeOrigin.ToString()}" + $"{Environment.NewLine}\tCharge: {triggeredEventArgs.Charge} mV" + $"{Environment.NewLine}\tPath: {path} >> {(neurons.Contains(triggeredEventArgs.TriggerInfo.PresynapticId) ? neurons[triggeredEventArgs.TriggerInfo.PresynapticId].Data : string.Empty)} "); } }