-dt = 0.001 # Time step
-t_cue = 1.0 # Duration of cue presentation
-cue_scale = 1.0 # How strong the cuelus is from the visual system
-perceived = 0 # ???
-time_scale = 0.4
-steps = 100 # How fine to run the outer loop of the simulation
-noise_wm = 0.005 # Standard deviation of white noise added to workin memory
-noise_decision = 0.005 # Standard deviation of white noise added to decision
-neurons_decide = 100 # Number of neurons for decision
-neurons_inputs = 100 # Number of neurons for inputs ensemble
-neurons_wm = 100 # Number of neurons for working memory ensemble
-tau_wm = 0.1 # Synapse on recurrent connection in wm
-tau = 0.01 # Synaptic time constant between ensemblesA
-dt_sample = 0.01 # Timestep for data recording through probes
-t_delay = 8.0 # Duration of delay period between cue and decision
+dt = 0.001 # Time step
+t_cue = 1.0 # Duration of cue presentation
+cue_scale = 1.0 # How strong the cuelus is from the visual system
+perceived = 0 # ???
+time_scale = 0.4 # ???
+steps = 100 # How fine to run the outer loop of the simulation
+noise_wm = 0.005 # Standard deviation of white noise added to WM
+noise_decision = 0.005 # Standard deviation of white noise added to decision
+neurons_decide = 100 # Number of neurons for decision
+neurons_inputs = 100 # Number of neurons for inputs ensemble
+neurons_wm = 100 # Number of neurons for working memory ensemble
+tau_wm = 0.1 # Synapse on recurrent connection in wm
+tau = 0.01 # Synaptic time constant between ensembles
+dt_sample = 0.01 # Timestep for data recording through probes
+t_delay = 8.0 # Duration of delay period between cue and decision
exec(open("conf.py").read())
+def fmt_num(num):
+ """
+ Format number to string.
+ """
+
+ return str(num)[:18].zfill(18)
+
+
def wm_recurrent_function(x):
- return x
+ return x
def inputs_function(x):
- return x * tau_wm
+ return x * tau_wm
def noise_decision_function(t):
- return np.random.normal(0.0, noise_decision)
+ return np.random.normal(0.0, noise_decision)
def noise_bias_function(t):
- return np.random.normal(0.0, noise_wm)
+ return np.random.normal(0.0, noise_wm)
def time_function(t):
pass
out = f"./out/{self.__class__.__name__}"
+ plt.figure()
plt.plot(self.x, self.y)
plt.xlabel("Norepinephrine concentration (nM)")
#######################################################################
+ plt.figure()
plt.plot(self.x, self.gain)
plt.xlabel("Norepinephrine concentration (nM)")
#######################################################################
+ plt.figure()
plt.plot(self.x, self.bias)
plt.xlabel("Norepinephrine concentration (nM)")
plt.savefig(f"{out}-concentration-bias.png", dpi=1000)
def simulate(self):
+ for i in range(steps):
+ print(f"{self.__class__.__name__}, gain: {fmt_num(self.gain[i])}, bias: {fmt_num(self.bias[i])}")
with nengo.Network() as net:
# Nodes
time_node = nengo.Node(output=time_function)
# Ensembles
wm = nengo.Ensemble(neurons_wm, 2)
+ wm.gain = np.full(wm.n_neurons, self.gain[i])
+ wm.bias = np.full(wm.n_neurons, self.bias[i])
decision = nengo.Ensemble(neurons_decide, 2)
inputs = nengo.Ensemble(neurons_inputs, 2)
output = nengo.Ensemble(neurons_decide, 1)
nengo.Connection(decision, output, function=decision_function)
# Probes
- #probes_wm = nengo.Probe(
- # wm[0], synapse=0.01, sample_every=dt_sample)
- #probes_spikes = nengo.Probe(wm.neurons, 'spikes',
- # sample_every=dt_sample)
- #probe_output = nengo.Probe(output, synapse=None,
- # same_every=dt_sample)
+ # probes_wm = nengo.Probe(wm[0], synapse=0.01, sample_every=dt_sample)
+ # probes_spikes = nengo.Probe(wm.neurons, 'spikes',
+ # sample_every=dt_sample)
+ # probe_output = nengo.Probe(output, synapse=None, same_every=dt_sample)
# Run simulation
- with nengo.Simulator(net, dt=dt) as sim:
- sim.run(t_cue + t_delay)
+ with nengo.Simulator(net, dt=dt, progress_bar=False) as sim:
+ sim.run(t_cue + t_delay)
class Alpha1(Alpha):
self.ki = 330
self.offset = 5.895
self.pretty = "α1 Receptor"
- self.gaind = 0.1
- self.biasd = 0.1
+ self.gaind = -0.04
+ self.biasd = -0.02
super().__init__()
self.ki = 56
self.offset = 1
self.pretty = "α2 Receptor"
- self.gaind = -0.04
- self.biasd = -0.02
+ self.gaind = -0.1
+ self.biasd = 0.1
super().__init__()
def main():
plt.style.use("ggplot") # Nice looking and familiar style
-
a1 = Alpha1()
# a1.plot()
a1.simulate()
- #a2 = Alpha2()
+ a2 = Alpha2()
# a2.plot()
+ a2.simulate()
if __name__ == "__main__":