// end ReadPostsynapticFile() /* * DendriteAccumulate(Synapse) * * */ public static void DendriteAccumulate(Synapse synapse, StreamWriter writer, string threadName) { foreach (var con in Connectome) { if (con.NeuronA == synapse.NeuronA) { foreach (var postsyn in Postsynaptic) { if (postsyn.NeuronA == con.NeuronB) { postsyn.Weight = con.Weight; // output for file to show Postsynaptic Weight changes /* * Console.WriteLine("\t[{0}]Postsynaptic Weight: {1} {2} + {3} = {4}", threadName, * postsyn.NeuronA, postsyn.Weight - con.Weight, con.Weight, postsyn.Weight); * writer.WriteLine("\t[{0}]Postsynaptic Weight: {1} {2} + {3} = {4}", threadName, * postsyn.NeuronA, postsyn.Weight - con.Weight, con.Weight, postsyn.Weight); */ } } } } }
// end DendriteAccumulate(Synapse) /* * FireNeuron(Synapse) * * */ public static void FireNeuron(Synapse neuron, StreamWriter writer, string threadName) { //Console.WriteLine("DendriteAccumulate [sent from FireNeuron] : {0} {1} {2}", neuron.NeuronA, neuron.NeuronB, neuron.Weight.ToString()); //writer.WriteLine("DendriteAccumulate [sent from FireNeuron] : {0} {1} {2}", neuron.NeuronA, neuron.NeuronB, neuron.Weight.ToString()); DendriteAccumulate(neuron, writer, threadName); foreach (var postsyn in Postsynaptic) { if (Math.Abs(postsyn.Weight) > Threshold) { if (postsyn.NeuronA == "PLMR" || postsyn.NeuronA == "PLML" || postsyn.NeuronA.Substring(0, 2) == "MV" || postsyn.NeuronA.Substring(0, 2) == "MD") { MuscleFireCount++; Console.WriteLine("[{0}] Fire Muscle {1}{2}", threadName, postsyn.NeuronA, postsyn.NeuronB); writer.WriteLine("[{0}] Fire Muscle {1}{2}", threadName, postsyn.NeuronA, postsyn.NeuronB); postsyn.ResetWeight = 0; } else { NeuronFireCount++; Console.WriteLine("[{0}] Fire Neuron {1}", threadName, postsyn.NeuronA); writer.WriteLine("[{0}] Fire Neuron {1}", threadName, postsyn.NeuronA); DendriteAccumulate(postsyn, writer, threadName); postsyn.ResetWeight = 0; } } } }
// end FireNeuron(Synapse) /* * RunConnectome(Synapse) * * */ public static void RunConnectome(Synapse neuron, StreamWriter writer, string threadName) { //Console.WriteLine("DendriteAccumulate [sent from RunConnectome] : {0} {1} {2}", neuron.NeuronA, neuron.NeuronB, neuron.Weight.ToString()); //writer.WriteLine("DendriteAccumulate [sent from RunConnectome] : {0} {1} {2}", neuron.NeuronA, neuron.NeuronB, neuron.Weight.ToString()); DendriteAccumulate(neuron, writer, threadName); foreach (var postsyn in Postsynaptic) { //Console.WriteLine("[RunConnectome] postsyn: {0} {1} ", postsyn.NeuronA, postsyn.Weight.ToString()); //writer.WriteLine("[RunConnectome] postsyn: {0} {1} ", postsyn.NeuronA, postsyn.Weight.ToString()); if (Math.Abs(postsyn.Weight) > Threshold) { //Console.WriteLine("{0} > {1}", Math.Abs(postsyn.Weight).ToString(), Threshold); FireNeuron(postsyn, writer, threadName); postsyn.ResetWeight = 0; } } }
public static void NodeFive(Synapse n, StreamWriter writer) { //Console.WriteLine("\tNode5, {0} {1}", n.NeuronA, n.NeuronB); //writer.WriteLine("\tNode5, {0} {1}", n.NeuronA, n.NeuronB); TheConnectome.RunConnectome(n, writer, "NodeFive"); }