Skip to content

Commit 52a1705

Browse files
committed
Script for running multiple simulations
1 parent 0dbcc25 commit 52a1705

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ x86_64
1717
/jsbml.log
1818
/libjhdf5.so
1919
/temp/
20+
/ISN-nest-EI-0.gdf
21+
/pertinh.rate.*.dat
22+
/rates.png

runall.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -e
3+
# This script requires the repo https://github.com/OpenSourceBrain/SadehEtAl2017-InhibitionStabilizedNetworks
4+
# to be present in the directory ../SadehEtAl2017-InhibitionStabilizedNetworks
5+
6+
# This path is required for https://github.com/OpenSourceBrain/SadehEtAl2017-InhibitionStabilizedNetworks/blob/master/SpikingSimulationModels/defaultParams.py
7+
export PYTHONPATH=PYTHONPATH:../SadehEtAl2017-InhibitionStabilizedNetworks/SpikingSimulationModels
8+
9+
for i in `seq 100 100 4000`;
10+
do
11+
echo "==============================="
12+
echo "Running with seed: "$i
13+
python ISN.py -AllenCells -perturbation -netpyne -seed:$i
14+
python to_gdf.py
15+
python3 ../SadehEtAl2017-InhibitionStabilizedNetworks/PyNN/analysis_perturbation_pynn.py .9 1000 -nogui -average -legend
16+
done

to_gdf.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import os, sys
2+
3+
def convert(base_dir='./temp/', detailed_also = False):
4+
5+
files = ['%sSim_ISN_net.popExc.spikes'%base_dir,'%sSim_ISN_net.popInh.spikes'%base_dir]
6+
7+
if detailed_also:
8+
files = ['%sSim_ISN_net.popExc.spikes'%base_dir,'%sSim_ISN_net.popInh.spikes'%base_dir, '%sSim_ISN_net.popExc2.spikes'%base_dir]
9+
10+
11+
out_file = 'ISN-nest-EI-0.gdf'
12+
out = open(out_file,'w')
13+
14+
for fn in files:
15+
f = open(fn)
16+
17+
for l in f.readlines():
18+
w = l.split('\t')
19+
i = int(w[0])
20+
t = float(w[1])*1000
21+
if 'Inh' in fn:
22+
i+=800
23+
if 'Exc2' in fn:
24+
i+=790
25+
26+
out.write('%s %s\n'%(t, i))
27+
28+
print("> Converted: %s"%os.path.abspath(fn))
29+
30+
print("> Saved: %s"%os.path.abspath(out_file))
31+
32+
out.close()
33+
34+
35+
if __name__ == '__main__':
36+
37+
38+
detailed_also = '-detailed' in sys.argv
39+
40+
convert(detailed_also=detailed_also)
41+
42+

0 commit comments

Comments
 (0)