4     using Lib.NeuronModels;
 
    6     using System.Collections.Generic;
 
   59             const int numInputs = 4;
 
   60             const int maxNumOutputSpikes = 3;
 
   61             var inputSpikeTimes = 
new List<Spike>
 
   63                     new Spike { Time = 2, NeuronIndex = 0}, 
 
   64                     new Spike { Time = 1, NeuronIndex = 2}, 
 
   65                     new Spike { Time = 1.5, NeuronIndex = 2}, 
 
   66                     new Spike { Time = 4, NeuronIndex = 3}, 
 
   73             Console.WriteLine(thetaNeuron);
 
   76             thetaNeuron.Method = SimulationMethod.Numerical;
 
   77             var outputSpikeTimes = thetaNeuron.RunThetaNeuron(inputSpikeTimes, maxNumOutputSpikes).ToList();
 
   80             thetaNeuron.ResetState();
 
   81             thetaNeuron.Method = SimulationMethod.EventDriven;
 
   82             var outputSpikeTimes2 = thetaNeuron.RunThetaNeuron(inputSpikeTimes, maxNumOutputSpikes).ToList();
 
   85             if (outputSpikeTimes.Count != outputSpikeTimes2.Count) 
 
   87                 Console.WriteLine(
"The Two Simulation Methods Produced Different Numbers of Output Spikes!");
 
   90             else if (outputSpikeTimes.Count == 0) 
 
   92                 Console.WriteLine(
"The Two Simulation Methods Produced No Output Spikes!");
 
   97                 double meanSquaredError = 0;
 
   98                 meanSquaredError += outputSpikeTimes.Select((t, j) => Math.Pow(t.Time - outputSpikeTimes2[j].Time, 2)).Sum();
 
   99                 meanSquaredError /= outputSpikeTimes.Count;
 
  100                 Console.WriteLine(
"Output Spike Mean-Squared Error Between Simulation Methods: ");
 
  101                 Console.WriteLine(
"\t" + meanSquaredError);
 
  106             if (outputSpikeTimes.Count > 0)
 
  108                 Console.WriteLine(
"A second neuron is simulated in connection to the output of the previous neuron");
 
  110                 var outputSpikeTimesList = outputSpikeTimes.Select((t, j) => 
new Spike{Time = t.Time, NeuronIndex = j}).ToList();
 
  111                 thetaNeuron2.RunThetaNeuron(outputSpikeTimesList, maxNumOutputSpikes);
 
Spiking Neuron Network Class