sim-ballena 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sim-ballena might be problematic. Click here for more details.
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/Cargo.lock +1 -1
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/Cargo.toml +1 -1
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/PKG-INFO +1 -1
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/src/responses.rs +5 -4
- sim_ballena-0.1.3/test_file.py +37 -0
- sim_ballena-0.1.2/test_file.py +0 -49
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/.github/workflows/CI.yml +0 -0
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/.gitignore +0 -0
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/lista_de_deseos.py +0 -0
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/pyproject.toml +0 -0
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/src/instances.rs +0 -0
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/src/lib.rs +0 -0
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/src/networks.rs +0 -0
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/src/neurons.rs +0 -0
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/src/simulation.rs +0 -0
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/src/utils.rs +0 -0
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/test.sh +0 -0
- {sim_ballena-0.1.2 → sim_ballena-0.1.3}/tests.ipynb +0 -0
|
@@ -8,6 +8,7 @@ const MAX_PRECISION :f64 = 100_000.0;
|
|
|
8
8
|
/* ======= OBJECTS ========= */
|
|
9
9
|
/* ========================== */
|
|
10
10
|
#[derive(Clone)]
|
|
11
|
+
#[derive(Debug)]
|
|
11
12
|
struct VoltageMarker{
|
|
12
13
|
pub t : f64,
|
|
13
14
|
pub v : f64,
|
|
@@ -198,13 +199,13 @@ impl Response{
|
|
|
198
199
|
let tau_list = self.tau_list.as_ref().unwrap();
|
|
199
200
|
let v_rest_list = self.v_rest_list.as_ref().unwrap();
|
|
200
201
|
|
|
201
|
-
for
|
|
202
|
+
for (o_idx,o) in self.outputs.iter().enumerate(){
|
|
202
203
|
let markers_serie:Vec<&VoltageMarker> = self.voltages.iter()
|
|
203
|
-
.filter(|vm|vm.id
|
|
204
|
+
.filter(|vm|vm.id==*o)
|
|
204
205
|
.collect();
|
|
205
206
|
|
|
206
|
-
let tau = *tau_list.get(
|
|
207
|
-
let v_rest = *v_rest_list.get(
|
|
207
|
+
let tau = *tau_list.get(o_idx).unwrap();
|
|
208
|
+
let v_rest = *v_rest_list.get(o_idx).unwrap();
|
|
208
209
|
voltages.push( self.extract_voltage_serie(markers_serie, simulation_times, tau, v_rest) );
|
|
209
210
|
}
|
|
210
211
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import sim_ballena as ballena
|
|
2
|
+
import matplotlib.pyplot as plt
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
net = (ballena.Network( [ballena.Lif().tau(5),ballena.Lif().tau(0.2)] )
|
|
6
|
+
.synapses_net([])
|
|
7
|
+
.weights_net([])
|
|
8
|
+
.outputs([1])
|
|
9
|
+
.mode(['VOLTAGES','SPIKES']))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# ==========
|
|
14
|
+
# STEP 1
|
|
15
|
+
# ==========
|
|
16
|
+
net = net.synapses_in([(0,0),(0,1)])
|
|
17
|
+
net = net.weights_in([10,10])
|
|
18
|
+
|
|
19
|
+
times = [ (1, 0) ]
|
|
20
|
+
instance = ballena.Instance( times )
|
|
21
|
+
res = net.simulate( instance, 2 )
|
|
22
|
+
|
|
23
|
+
time = res.time()
|
|
24
|
+
volt = res.voltages()
|
|
25
|
+
|
|
26
|
+
plt.figure(figsize=(10,5))
|
|
27
|
+
plt.subplot(121)
|
|
28
|
+
plt.ylim(-80,-55)
|
|
29
|
+
plt.plot( time, volt[0], label='true')
|
|
30
|
+
# plt.subplot(122)
|
|
31
|
+
# plt.ylim(-80,-55)
|
|
32
|
+
# plt.plot( time, volt[1], label='true')
|
|
33
|
+
|
|
34
|
+
plt.show()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
sim_ballena-0.1.2/test_file.py
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import sim_ballena as ballena
|
|
2
|
-
import matplotlib.pyplot as plt
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
net = (ballena.Network( ballena.Lif().tau(5).t_refractory(0).repeat(2) )
|
|
6
|
-
.synapses_net([])
|
|
7
|
-
.weights_net([])
|
|
8
|
-
.outputs([0,1])
|
|
9
|
-
.mode(['VOLTAGES','SPIKES']))
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# ==========
|
|
14
|
-
# STEP 1
|
|
15
|
-
# ==========
|
|
16
|
-
net = net.synapses_in([(0,0),(0,1),(1,0),(1,1)])
|
|
17
|
-
net = net.weights_in([16,0,-16,0])
|
|
18
|
-
|
|
19
|
-
times = [ (1, 0), (5, 1) ]
|
|
20
|
-
instance = ballena.Instance( times )
|
|
21
|
-
res = net.simulate( instance, 10 )
|
|
22
|
-
|
|
23
|
-
time = res.time()
|
|
24
|
-
volt = res.voltages()
|
|
25
|
-
plt.figure(figsize=(10,4))
|
|
26
|
-
plt.subplot(121)
|
|
27
|
-
plt.plot( time, volt[0], label='true')
|
|
28
|
-
plt.subplot(122)
|
|
29
|
-
plt.plot( time, volt[1], label='false')
|
|
30
|
-
plt.show()
|
|
31
|
-
|
|
32
|
-
# ==========
|
|
33
|
-
# STEP 1
|
|
34
|
-
# ==========
|
|
35
|
-
net = net.weights_in([16,0,-16,0])
|
|
36
|
-
|
|
37
|
-
times = [ (1, 0), (5, 1) ]
|
|
38
|
-
instance = ballena.Instance( times )
|
|
39
|
-
res = net.simulate( instance, 10 )
|
|
40
|
-
|
|
41
|
-
time = res.time()
|
|
42
|
-
volt = res.voltages()
|
|
43
|
-
plt.figure(figsize=(10,4))
|
|
44
|
-
plt.subplot(121)
|
|
45
|
-
plt.plot( time, volt[0], label='true')
|
|
46
|
-
plt.subplot(122)
|
|
47
|
-
plt.plot( time, volt[1], label='false')
|
|
48
|
-
plt.show()
|
|
49
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|