Skip to content

Commit 844eca8

Browse files
committed
same dead code
1 parent ff06fbc commit 844eca8

1 file changed

Lines changed: 0 additions & 69 deletions

File tree

examples/pynnBrunnel.py

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -14,80 +14,11 @@
1414

1515
import pyNN.spiNNaker as pynn
1616

17-
import numpy as np
1817
import matplotlib.pyplot as plt
1918
from pyNN.random import RandomDistribution
2019
from pyNN.utility.plotting import Figure, Panel
2120

2221
simulator_Name = 'spiNNaker'
23-
# exec('import pyNN.%s as pynn' % simulator_Name)
24-
25-
26-
def poisson_generator(_rate, _rng, _t_start=0.0, _t_stop=1000.0, _debug=False):
27-
"""
28-
Returns a SpikeTrain whose spikes are a realization of a Poisson process
29-
with the given rate (Hz) and stopping time t_stop (milliseconds).
30-
31-
Note: t_start is always 0.0, thus all realizations are as if
32-
they spiked at t=0.0, though this spike is not included in the SpikeList.
33-
34-
Inputs:
35-
rate - the rate of the discharge (in Hz)
36-
t_start - the beginning of the SpikeTrain (in ms)
37-
t_stop - the end of the SpikeTrain (in ms)
38-
array - if True, a numpy array of sorted spikes is returned,
39-
rather than a SpikeTrain object.
40-
41-
Examples:
42-
>> gen.poisson_generator(50, 0, 1000)
43-
>> gen.poisson_generator(20, 5000, 10000, array=True)
44-
45-
See also:
46-
inh_poisson_generator, inh_gamma_generator,
47-
inh_adaptingmarkov_generator
48-
"""
49-
50-
n = (_t_stop - _t_start) / 1000.0 * _rate
51-
number = np.ceil(n + 3 * np.sqrt(n))
52-
if number < 100:
53-
number = min(5 + np.ceil(2 * n), 100)
54-
55-
if number > 0:
56-
isi = _rng.exponential(1.0 / _rate, number) * 1000.0
57-
if number > 1:
58-
spikes = np.add.accumulate(isi)
59-
else:
60-
spikes = isi
61-
else:
62-
spikes = np.array([])
63-
64-
spikes += _t_start
65-
i = np.searchsorted(spikes, _t_stop)
66-
67-
extra_spikes = []
68-
if i == len(spikes):
69-
# Interspike interval buffer overrun
70-
71-
t_last = spikes[-1] + _rng.exponential(1.0 / _rate, 1)[0] * 1000.0
72-
73-
while (t_last < _t_stop):
74-
extra_spikes.append(t_last)
75-
t_last += _rng.exponential(1.0 / _rate, 1)[0] * 1000.0
76-
77-
spikes = np.concatenate((spikes, extra_spikes))
78-
79-
if _debug:
80-
print(f"ISI buf overrun handled. {len(spikes)=}, "
81-
f"{len(extra_spikes)=}")
82-
83-
else:
84-
spikes = np.resize(spikes, (i,))
85-
86-
if _debug:
87-
return spikes, extra_spikes
88-
else:
89-
return [round(x) for x in spikes]
90-
9122

9223
# Total number of neurons
9324
Neurons = 1000

0 commit comments

Comments
 (0)