protected void AddNeuron(Neuron n, DataTable dt, NeuronConfig cfg) { DataRow row = dt.NewRow(); row["n"] = dt.Rows.Count + 1; row["RP"] = cfg.RestingPotential.ToDisplayValue(); row["APT"] = cfg.ActionPotentialThreshold.ToDisplayValue(); row["APV"] = cfg.ActionPotentialValue.ToDisplayValue(); row["RRR"] = cfg.RefractoryRecoveryRate.ToDisplayValue(); row["HPO"] = cfg.HyperPolarizationOvershoot.ToDisplayValue(); row["RPRR"] = cfg.RestingPotentialReturnRate.ToDisplayValue(); row["LKG"] = "0"; row["PCOLOR"] = probeColors[probeColorIdx]; row["Location"] = new Point(20 + probeColorIdx * 30, pnlNetwork.Height / 2); dt.Rows.Add(row); rowNeuronMap[row] = n; }
protected void Bind(TrackBar tb, Label lbl, NeuronConfig config, string field) { Type t = config.GetType(); PropertyInfo pi = t.GetProperty(field, BindingFlags.Instance | BindingFlags.Public); int p = (int)pi.GetValue(config); int v = ConvertPotential(p); tb.Value = v; lbl.Text = (v / 10.0).ToString("###.0"); tb.ValueChanged += (sender, args) => { v = tb.Value; lbl.Text = (v / 10.0).ToString("###.0"); p = ConvertTrackBar(v); pi.SetValue(config, p); }; }
/// <summary> /// Instantiate the neuron with a custom configuration. /// </summary> public Neuron(NeuronConfig config) { this.config = config; Initialize(); }
/// <summary> /// Use default configuration for the neuron. /// </summary> public Neuron() { config = NeuronConfig.DefaultConfiguration; Initialize(); }