6 | #include "scoplib_ansi.h"
7 | #undef PI
8 | #define nil 0
9 | #include "md1redef.h"
10 | #include "section.h"
11 | #include "nrniv_mf.h"
12 | #include "md2redef.h"
13 |
14 | #if METHOD3
15 | extern int _method3;
16 | #endif
17 |
18 | #if !NRNGPU
19 | #undef exp
20 | #define exp hoc_Exp
21 | extern double hoc_Exp(double);
22 | #endif
23 |
24 | #define _threadargscomma_ /**/
25 | #define _threadargs_ /**/
26 |
27 | #define _threadargsprotocomma_ /**/
28 | #define _threadargsproto_ /**/
29 | /*SUPPRESS 761*/
30 | /*SUPPRESS 762*/
31 | /*SUPPRESS 763*/
32 | /*SUPPRESS 765*/
33 | extern double *getarg();
34 | static double *_p; static Datum *_ppvar;
35 |
36 | #define t nrn_threads->_t
37 | #define dt nrn_threads->_dt
38 | #define index _p[0]
39 | #define etime _p[1]
40 | #define space _p[2]
41 | #define _tsav _p[3]
42 | #define _nd_area *_ppvar[0]._pval
43 |
44 | #if MAC
45 | #if !defined(v)
46 | #define v _mlhv
47 | #endif
48 | #if !defined(h)
49 | #define h _mlhh
50 | #endif
51 | #endif
52 |
53 | #if defined(__cplusplus)
54 | extern "C" {
55 | #endif
56 | static int hoc_nrnpointerindex = -1;
57 | /* external NEURON variables */
58 | /* declaration of user functions */
59 | static double _hoc_element();
60 | static double _hoc_play();
61 | static int _mechtype;
62 | extern void _nrn_cacheloop_reg(int, int);
63 | extern void hoc_register_prop_size(int, int, int);
64 | extern void hoc_register_limits(int, HocParmLimits*);
65 | extern void hoc_register_units(int, HocParmUnits*);
66 | extern void nrn_promote(Prop*, int, int);
67 | extern Memb_func* memb_func;
68 | extern Prop* nrn_point_prop_;
69 | static int _pointtype;
70 | static void* _hoc_create_pnt(_ho) Object* _ho; { void* create_point_process();
71 | return create_point_process(_pointtype, _ho);
72 | }
73 | static void _hoc_destroy_pnt();
74 | static double _hoc_loc_pnt(_vptr) void* _vptr; {double loc_point_process();
75 | return loc_point_process(_pointtype, _vptr);
76 | }
77 | static double _hoc_has_loc(_vptr) void* _vptr; {double has_loc_point();
78 | return has_loc_point(_vptr);
79 | }
80 | static double _hoc_get_loc_pnt(_vptr)void* _vptr; {
81 | double get_loc_point_process(); return (get_loc_point_process(_vptr));
82 | }
83 | extern void _nrn_setdata_reg(int, void(*)(Prop*));
84 | static void _setdata(Prop* _prop) {
85 | _p = _prop->param; _ppvar = _prop->dparam;
86 | }
87 | static void _hoc_setdata(void* _vptr) { Prop* _prop;
88 | _prop = ((Point_process*)_vptr)->_prop;
89 | _setdata(_prop);
90 | }
91 | /* connect user functions to hoc names */
92 | static VoidFunc hoc_intfunc[] = {
93 | 0,0
94 | };
95 | static Member_func _member_func[] = {
96 | "loc", _hoc_loc_pnt,
97 | "has_loc", _hoc_has_loc,
98 | "get_loc", _hoc_get_loc_pnt,
99 | "element", _hoc_element,
100 | "play", _hoc_play,
101 | 0, 0
102 | };
103 | /* declare global and static user variables */
104 | /* some parameters have upper and lower limits */
105 | static HocParmLimits _hoc_parm_limits[] = {
106 | 0,0,0
107 | };
108 | static HocParmUnits _hoc_parm_units[] = {
109 | 0,0
110 | };
111 | static double v = 0;
112 | /* connect global user variables to hoc */
113 | static DoubScal hoc_scdoub[] = {
114 | 0,0
115 | };
116 | static DoubVec hoc_vdoub[] = {
117 | 0,0,0
118 | };
119 | static double _sav_indep;
120 | static void nrn_alloc(Prop*);
121 | static void nrn_init(_NrnThread*, _Memb_list*, int);
122 | static void nrn_state(_NrnThread*, _Memb_list*, int);
123 | static void _hoc_destroy_pnt(_vptr) void* _vptr; {
124 | destroy_point_process(_vptr);
125 | }
126 | /* connect range variables in _p that hoc is supposed to know about */
127 | static const char *_mechanism[] = {
128 | "6.2.0",
129 | "VecStim",
130 | 0,
131 | 0,
132 | 0,
133 | 0};
134 |
135 | extern Prop* need_memb(Symbol*);
136 |
137 | static void nrn_alloc(Prop* _prop) {
138 | Prop *prop_ion;
139 | double *_p; Datum *_ppvar;
140 | if (nrn_point_prop_) {
141 | _prop->_alloc_seq = nrn_point_prop_->_alloc_seq;
142 | _p = nrn_point_prop_->param;
143 | _ppvar = nrn_point_prop_->dparam;
144 | }else{
145 | _p = nrn_prop_data_alloc(_mechtype, 4, _prop);
146 | /*initialize range parameters*/
147 | }
148 | _prop->param = _p;
149 | _prop->param_size = 4;
150 | if (!nrn_point_prop_) {
151 | _ppvar = nrn_prop_datum_alloc(_mechtype, 3, _prop);
152 | }
153 | _prop->dparam = _ppvar;
154 | /*connect ionic variables to this model*/
155 |
156 | }
157 | static void _initlists();
158 |
159 | #define _tqitem &(_ppvar[2]._pvoid)
160 | static void _net_receive(Point_process*, double*, double);
161 | extern Symbol* hoc_lookup(const char*);
162 | extern void _nrn_thread_reg(int, int, void(*f)(Datum*));
163 | extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, _NrnThread*, int));
164 | extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
165 | extern void _cvode_abstol( Symbol**, double*, int);
166 |
167 | void _vecevent_reg() {
168 | int _vectorized = 0;
169 | _initlists();
170 | _pointtype = point_register_mech(_mechanism,
171 | nrn_alloc,(void*)0, (void*)0, (void*)0, nrn_init,
172 | hoc_nrnpointerindex, 0,
173 | _hoc_create_pnt, _hoc_destroy_pnt, _member_func);
174 | _mechtype = nrn_get_mechtype(_mechanism[1]);
175 | _nrn_setdata_reg(_mechtype, _setdata);
176 | hoc_register_prop_size(_mechtype, 4, 3);
177 | add_nrn_artcell(_mechtype, 2);
178 | add_nrn_has_net_event(_mechtype);
179 | pnt_receive[_mechtype] = _net_receive;
180 | pnt_receive_size[_mechtype] = 1;
181 | hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc);
182 | ivoc_help("help ?1 VecStim /home/forrestc/SWDB_2017/DynamicBrain/Modeling/biophysical_notebook/components/mechanisms/x86_64/vecevent.mod\n");
183 | hoc_register_limits(_mechtype, _hoc_parm_limits);
184 | hoc_register_units(_mechtype, _hoc_parm_units);
185 | }
186 | static int _reset;
187 | static char *modelname = "";
188 |
189 | static int error;
190 | static int _ninits = 0;
191 | static int _match_recurse=1;
192 | static void _modl_cleanup(){ _match_recurse=1;}
193 | static int element();
194 | static int play();
195 |
196 | static void _net_receive (_pnt, _args, _lflag) Point_process* _pnt; double* _args; double _lflag;
197 | { _p = _pnt->_prop->param; _ppvar = _pnt->_prop->dparam;
198 | if (_tsav > t){ extern char* hoc_object_name(); hoc_execerror(hoc_object_name(_pnt->ob), ":Event arrived out of order. Must call ParallelContext.set_maxstep AFTER assigning minimum NetCon.delay");}
199 | _tsav = t; if (_lflag == 1. ) {*(_tqitem) = 0;}
200 | {
201 | if ( _lflag == 1.0 ) {
202 | net_event ( _pnt, t ) ;
203 | element ( _threadargs_ ) ;
204 | if ( index > 0.0 ) {
205 | artcell_net_send ( _tqitem, _args, _pnt, t + etime - t , 1.0 ) ;
206 | }
207 | }
208 | } }
209 |
210 | /*VERBATIM*/
211 | extern double* vector_vec();
212 | extern int vector_capacity();
213 | extern void* vector_arg();
214 |
215 | static int element ( ) {
216 |
217 | /*VERBATIM*/
218 |
219 | { void* vv; int i, size; double* px;
220 | i = (int)index;
221 | if (i >= 0) {
222 | vv = *((void**)(&space));
223 | if (vv) {
224 | size = vector_capacity(vv);
225 | px = vector_vec(vv);
226 | if (i < size) {
227 | etime = px[i];
228 | index += 1.;
229 | }else{
230 | index = -1.;
231 | }
232 | }else{
233 | index = -1.;
234 | }
235 | }
236 | }
237 | return 0; }
238 |
239 | static double _hoc_element(void* _vptr) {
240 | double _r;
241 | _hoc_setdata(_vptr);
242 | _r = 1.;
243 | element ( );
244 | return(_r);
245 | }
246 |
247 | static int play ( ) {
248 |
249 | /*VERBATIM*/
250 | void** vv;
251 | vv = (void**)(&space);
252 | *vv = (void*)0;
253 | if (ifarg(1)) {
254 | *vv = vector_arg(1);
255 | }
256 | return 0; }
257 |
258 | static double _hoc_play(void* _vptr) {
259 | double _r;
260 | _hoc_setdata(_vptr);
261 | _r = 1.;
262 | play ( );
263 | return(_r);
264 | }
265 |
266 | static void initmodel() {
267 | int _i; double _save;_ninits++;
268 | {
269 | {
270 | index = 0.0 ;
271 | element ( _threadargs_ ) ;
272 | if ( index > 0.0 ) {
273 | artcell_net_send ( _tqitem, (double*)0, _ppvar[1]._pvoid, t + etime - t , 1.0 ) ;
274 | }
275 | }
276 |
277 | }
278 | }
279 |
280 | static void nrn_init(_NrnThread* _nt, _Memb_list* _ml, int _type){
281 | Node *_nd; double _v; int* _ni; int _iml, _cntml;
282 | #if CACHEVEC
283 | _ni = _ml->_nodeindices;
284 | #endif
285 | _cntml = _ml->_nodecount;
286 | for (_iml = 0; _iml < _cntml; ++_iml) {
287 | _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
288 | _tsav = -1e20;
289 | initmodel();
290 | }}
291 |
292 | static double _nrn_current(double _v){double _current=0.;v=_v;{
293 | } return _current;
294 | }
295 |
296 | static void nrn_state(_NrnThread* _nt, _Memb_list* _ml, int _type){
297 | double _break, _save;
298 | Node *_nd; double _v; int* _ni; int _iml, _cntml;
299 | #if CACHEVEC
300 | _ni = _ml->_nodeindices;
301 | #endif
302 | _cntml = _ml->_nodecount;
303 | for (_iml = 0; _iml < _cntml; ++_iml) {
304 | _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml];
305 | _nd = _ml->_nodelist[_iml];
306 | _break = t + .5*dt; _save = t;
307 | v=_v;
308 | {
309 | }}
310 |
311 | }
312 |
313 | static void terminal(){}
314 |
315 | static void _initlists() {
316 | int _i; static int _first = 1;
317 | if (!_first) return;
318 | _first = 0;
319 | }
320 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/components/mechanisms/x86_64/vecevent.lo:
--------------------------------------------------------------------------------
1 | # vecevent.lo - a libtool object file
2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1
3 | #
4 | # Please DO NOT delete this file!
5 | # It is necessary for linking the library.
6 |
7 | # Name of the PIC object.
8 | pic_object='.libs/vecevent.o'
9 |
10 | # Name of the non-PIC object
11 | non_pic_object=none
12 |
13 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/components/mechanisms/x86_64/vecevent.mod:
--------------------------------------------------------------------------------
1 | ../modfiles/vecevent.mod
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/components/recXelectrodes/linear_electrode.csv:
--------------------------------------------------------------------------------
1 | channel x_pos y_pos z_pos
2 | 0 10.0 0 5.0
3 | 1 10.0 -10 5.0
4 | 2 10.0 -20 5.0
5 | 3 10.0 -30 5.0
6 | 4 10.0 -40 5.0
7 | 5 10.0 -50 5.0
8 | 6 10.0 -60 5.0
9 | 7 10.0 -70 5.0
10 | 8 10.0 -80 5.0
11 | 9 10.0 -90 5.0
12 | 10 10.0 -100 5.0
13 | 11 10.0 -110 5.0
14 | 12 10.0 -120 5.0
15 | 13 10.0 -130 5.0
16 | 14 10.0 -140 5.0
17 | 15 10.0 -150 5.0
18 | 16 10.0 -160 5.0
19 | 17 10.0 -170 5.0
20 | 18 10.0 -180 5.0
21 | 19 10.0 -190 5.0
22 | 20 10.0 -200 5.0
23 | 21 10.0 -210 5.0
24 | 22 10.0 -220 5.0
25 | 23 10.0 -230 5.0
26 | 24 10.0 -240 5.0
27 | 25 10.0 -250 5.0
28 | 26 10.0 -260 5.0
29 | 27 10.0 -270 5.0
30 | 28 10.0 -280 5.0
31 | 29 10.0 -290 5.0
32 | 30 10.0 -300 5.0
33 | 31 10.0 -310 5.0
34 | 32 10.0 -320 5.0
35 | 33 10.0 -330 5.0
36 | 34 10.0 -340 5.0
37 | 35 10.0 -350 5.0
38 | 36 10.0 -360 5.0
39 | 37 10.0 -370 5.0
40 | 38 10.0 -380 5.0
41 | 39 10.0 -390 5.0
42 | 40 10.0 -400 5.0
43 | 41 10.0 -410 5.0
44 | 42 10.0 -420 5.0
45 | 43 10.0 -430 5.0
46 | 44 10.0 -440 5.0
47 | 45 10.0 -450 5.0
48 | 46 10.0 -460 5.0
49 | 47 10.0 -470 5.0
50 | 48 10.0 -480 5.0
51 | 49 10.0 -490 5.0
52 | 50 10.0 -500 5.0
53 | 51 10.0 -510 5.0
54 | 52 10.0 -520 5.0
55 | 53 10.0 -530 5.0
56 | 54 10.0 -540 5.0
57 | 55 10.0 -550 5.0
58 | 56 10.0 -560 5.0
59 | 57 10.0 -570 5.0
60 | 58 10.0 -580 5.0
61 | 59 10.0 -590 5.0
62 | 60 10.0 -600 5.0
63 | 61 10.0 -610 5.0
64 | 62 10.0 -620 5.0
65 | 63 10.0 -630 5.0
66 | 64 10.0 -640 5.0
67 | 65 10.0 -650 5.0
68 | 66 10.0 -660 5.0
69 | 67 10.0 -670 5.0
70 | 68 10.0 -680 5.0
71 | 69 10.0 -690 5.0
72 | 70 10.0 -700 5.0
73 | 71 10.0 -710 5.0
74 | 72 10.0 -720 5.0
75 | 73 10.0 -730 5.0
76 | 74 10.0 -740 5.0
77 | 75 10.0 -750 5.0
78 | 76 10.0 -760 5.0
79 | 77 10.0 -770 5.0
80 | 78 10.0 -780 5.0
81 | 79 10.0 -790 5.0
82 | 80 10.0 -800 5.0
83 | 81 10.0 -810 5.0
84 | 82 10.0 -820 5.0
85 | 83 10.0 -830 5.0
86 | 84 10.0 -840 5.0
87 | 85 10.0 -850 5.0
88 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/components/recXelectrodes/mesh_electrode.csv:
--------------------------------------------------------------------------------
1 | channel x_pos y_pos z_pos
2 | 0 -80.0 0.0 10.0
3 | 1 -80.0 -20.0 10.0
4 | 2 -80.0 -40.0 10.0
5 | 3 -80.0 -60.0 10.0
6 | 4 -80.0 -80.0 10.0
7 | 5 -80.0 -100.0 10.0
8 | 6 -80.0 -120.0 10.0
9 | 7 -80.0 -140.0 10.0
10 | 8 -80.0 -160.0 10.0
11 | 9 -80.0 -180.0 10.0
12 | 10 -80.0 -200.0 10.0
13 | 11 -80.0 -220.0 10.0
14 | 12 -80.0 -240.0 10.0
15 | 13 -80.0 -260.0 10.0
16 | 14 -80.0 -280.0 10.0
17 | 15 -80.0 -300.0 10.0
18 | 16 -80.0 -320.0 10.0
19 | 17 -80.0 -340.0 10.0
20 | 18 -80.0 -360.0 10.0
21 | 19 -80.0 -380.0 10.0
22 | 20 -80.0 -400.0 10.0
23 | 21 -80.0 -420.0 10.0
24 | 22 -80.0 -440.0 10.0
25 | 23 -80.0 -460.0 10.0
26 | 24 -80.0 -480.0 10.0
27 | 25 -80.0 -500.0 10.0
28 | 26 -80.0 -520.0 10.0
29 | 27 -80.0 -540.0 10.0
30 | 28 -80.0 -560.0 10.0
31 | 29 -80.0 -580.0 10.0
32 | 30 -80.0 -600.0 10.0
33 | 31 -80.0 -620.0 10.0
34 | 32 -80.0 -640.0 10.0
35 | 33 -80.0 -660.0 10.0
36 | 34 -80.0 -680.0 10.0
37 | 35 -80.0 -700.0 10.0
38 | 36 -80.0 -720.0 10.0
39 | 37 -80.0 -740.0 10.0
40 | 38 -80.0 -760.0 10.0
41 | 39 -80.0 -780.0 10.0
42 | 40 -80.0 -800.0 10.0
43 | 41 -80.0 -820.0 10.0
44 | 42 -80.0 -840.0 10.0
45 | 43 -60.0 0.0 10.0
46 | 44 -60.0 -20.0 10.0
47 | 45 -60.0 -40.0 10.0
48 | 46 -60.0 -60.0 10.0
49 | 47 -60.0 -80.0 10.0
50 | 48 -60.0 -100.0 10.0
51 | 49 -60.0 -120.0 10.0
52 | 50 -60.0 -140.0 10.0
53 | 51 -60.0 -160.0 10.0
54 | 52 -60.0 -180.0 10.0
55 | 53 -60.0 -200.0 10.0
56 | 54 -60.0 -220.0 10.0
57 | 55 -60.0 -240.0 10.0
58 | 56 -60.0 -260.0 10.0
59 | 57 -60.0 -280.0 10.0
60 | 58 -60.0 -300.0 10.0
61 | 59 -60.0 -320.0 10.0
62 | 60 -60.0 -340.0 10.0
63 | 61 -60.0 -360.0 10.0
64 | 62 -60.0 -380.0 10.0
65 | 63 -60.0 -400.0 10.0
66 | 64 -60.0 -420.0 10.0
67 | 65 -60.0 -440.0 10.0
68 | 66 -60.0 -460.0 10.0
69 | 67 -60.0 -480.0 10.0
70 | 68 -60.0 -500.0 10.0
71 | 69 -60.0 -520.0 10.0
72 | 70 -60.0 -540.0 10.0
73 | 71 -60.0 -560.0 10.0
74 | 72 -60.0 -580.0 10.0
75 | 73 -60.0 -600.0 10.0
76 | 74 -60.0 -620.0 10.0
77 | 75 -60.0 -640.0 10.0
78 | 76 -60.0 -660.0 10.0
79 | 77 -60.0 -680.0 10.0
80 | 78 -60.0 -700.0 10.0
81 | 79 -60.0 -720.0 10.0
82 | 80 -60.0 -740.0 10.0
83 | 81 -60.0 -760.0 10.0
84 | 82 -60.0 -780.0 10.0
85 | 83 -60.0 -800.0 10.0
86 | 84 -60.0 -820.0 10.0
87 | 85 -60.0 -840.0 10.0
88 | 86 -40.0 0.0 10.0
89 | 87 -40.0 -20.0 10.0
90 | 88 -40.0 -40.0 10.0
91 | 89 -40.0 -60.0 10.0
92 | 90 -40.0 -80.0 10.0
93 | 91 -40.0 -100.0 10.0
94 | 92 -40.0 -120.0 10.0
95 | 93 -40.0 -140.0 10.0
96 | 94 -40.0 -160.0 10.0
97 | 95 -40.0 -180.0 10.0
98 | 96 -40.0 -200.0 10.0
99 | 97 -40.0 -220.0 10.0
100 | 98 -40.0 -240.0 10.0
101 | 99 -40.0 -260.0 10.0
102 | 100 -40.0 -280.0 10.0
103 | 101 -40.0 -300.0 10.0
104 | 102 -40.0 -320.0 10.0
105 | 103 -40.0 -340.0 10.0
106 | 104 -40.0 -360.0 10.0
107 | 105 -40.0 -380.0 10.0
108 | 106 -40.0 -400.0 10.0
109 | 107 -40.0 -420.0 10.0
110 | 108 -40.0 -440.0 10.0
111 | 109 -40.0 -460.0 10.0
112 | 110 -40.0 -480.0 10.0
113 | 111 -40.0 -500.0 10.0
114 | 112 -40.0 -520.0 10.0
115 | 113 -40.0 -540.0 10.0
116 | 114 -40.0 -560.0 10.0
117 | 115 -40.0 -580.0 10.0
118 | 116 -40.0 -600.0 10.0
119 | 117 -40.0 -620.0 10.0
120 | 118 -40.0 -640.0 10.0
121 | 119 -40.0 -660.0 10.0
122 | 120 -40.0 -680.0 10.0
123 | 121 -40.0 -700.0 10.0
124 | 122 -40.0 -720.0 10.0
125 | 123 -40.0 -740.0 10.0
126 | 124 -40.0 -760.0 10.0
127 | 125 -40.0 -780.0 10.0
128 | 126 -40.0 -800.0 10.0
129 | 127 -40.0 -820.0 10.0
130 | 128 -40.0 -840.0 10.0
131 | 129 -20.0 0.0 10.0
132 | 130 -20.0 -20.0 10.0
133 | 131 -20.0 -40.0 10.0
134 | 132 -20.0 -60.0 10.0
135 | 133 -20.0 -80.0 10.0
136 | 134 -20.0 -100.0 10.0
137 | 135 -20.0 -120.0 10.0
138 | 136 -20.0 -140.0 10.0
139 | 137 -20.0 -160.0 10.0
140 | 138 -20.0 -180.0 10.0
141 | 139 -20.0 -200.0 10.0
142 | 140 -20.0 -220.0 10.0
143 | 141 -20.0 -240.0 10.0
144 | 142 -20.0 -260.0 10.0
145 | 143 -20.0 -280.0 10.0
146 | 144 -20.0 -300.0 10.0
147 | 145 -20.0 -320.0 10.0
148 | 146 -20.0 -340.0 10.0
149 | 147 -20.0 -360.0 10.0
150 | 148 -20.0 -380.0 10.0
151 | 149 -20.0 -400.0 10.0
152 | 150 -20.0 -420.0 10.0
153 | 151 -20.0 -440.0 10.0
154 | 152 -20.0 -460.0 10.0
155 | 153 -20.0 -480.0 10.0
156 | 154 -20.0 -500.0 10.0
157 | 155 -20.0 -520.0 10.0
158 | 156 -20.0 -540.0 10.0
159 | 157 -20.0 -560.0 10.0
160 | 158 -20.0 -580.0 10.0
161 | 159 -20.0 -600.0 10.0
162 | 160 -20.0 -620.0 10.0
163 | 161 -20.0 -640.0 10.0
164 | 162 -20.0 -660.0 10.0
165 | 163 -20.0 -680.0 10.0
166 | 164 -20.0 -700.0 10.0
167 | 165 -20.0 -720.0 10.0
168 | 166 -20.0 -740.0 10.0
169 | 167 -20.0 -760.0 10.0
170 | 168 -20.0 -780.0 10.0
171 | 169 -20.0 -800.0 10.0
172 | 170 -20.0 -820.0 10.0
173 | 171 -20.0 -840.0 10.0
174 | 172 0.0 0.0 10.0
175 | 173 0.0 -20.0 10.0
176 | 174 0.0 -40.0 10.0
177 | 175 0.0 -60.0 10.0
178 | 176 0.0 -80.0 10.0
179 | 177 0.0 -100.0 10.0
180 | 178 0.0 -120.0 10.0
181 | 179 0.0 -140.0 10.0
182 | 180 0.0 -160.0 10.0
183 | 181 0.0 -180.0 10.0
184 | 182 0.0 -200.0 10.0
185 | 183 0.0 -220.0 10.0
186 | 184 0.0 -240.0 10.0
187 | 185 0.0 -260.0 10.0
188 | 186 0.0 -280.0 10.0
189 | 187 0.0 -300.0 10.0
190 | 188 0.0 -320.0 10.0
191 | 189 0.0 -340.0 10.0
192 | 190 0.0 -360.0 10.0
193 | 191 0.0 -380.0 10.0
194 | 192 0.0 -400.0 10.0
195 | 193 0.0 -420.0 10.0
196 | 194 0.0 -440.0 10.0
197 | 195 0.0 -460.0 10.0
198 | 196 0.0 -480.0 10.0
199 | 197 0.0 -500.0 10.0
200 | 198 0.0 -520.0 10.0
201 | 199 0.0 -540.0 10.0
202 | 200 0.0 -560.0 10.0
203 | 201 0.0 -580.0 10.0
204 | 202 0.0 -600.0 10.0
205 | 203 0.0 -620.0 10.0
206 | 204 0.0 -640.0 10.0
207 | 205 0.0 -660.0 10.0
208 | 206 0.0 -680.0 10.0
209 | 207 0.0 -700.0 10.0
210 | 208 0.0 -720.0 10.0
211 | 209 0.0 -740.0 10.0
212 | 210 0.0 -760.0 10.0
213 | 211 0.0 -780.0 10.0
214 | 212 0.0 -800.0 10.0
215 | 213 0.0 -820.0 10.0
216 | 214 0.0 -840.0 10.0
217 | 215 20.0 0.0 10.0
218 | 216 20.0 -20.0 10.0
219 | 217 20.0 -40.0 10.0
220 | 218 20.0 -60.0 10.0
221 | 219 20.0 -80.0 10.0
222 | 220 20.0 -100.0 10.0
223 | 221 20.0 -120.0 10.0
224 | 222 20.0 -140.0 10.0
225 | 223 20.0 -160.0 10.0
226 | 224 20.0 -180.0 10.0
227 | 225 20.0 -200.0 10.0
228 | 226 20.0 -220.0 10.0
229 | 227 20.0 -240.0 10.0
230 | 228 20.0 -260.0 10.0
231 | 229 20.0 -280.0 10.0
232 | 230 20.0 -300.0 10.0
233 | 231 20.0 -320.0 10.0
234 | 232 20.0 -340.0 10.0
235 | 233 20.0 -360.0 10.0
236 | 234 20.0 -380.0 10.0
237 | 235 20.0 -400.0 10.0
238 | 236 20.0 -420.0 10.0
239 | 237 20.0 -440.0 10.0
240 | 238 20.0 -460.0 10.0
241 | 239 20.0 -480.0 10.0
242 | 240 20.0 -500.0 10.0
243 | 241 20.0 -520.0 10.0
244 | 242 20.0 -540.0 10.0
245 | 243 20.0 -560.0 10.0
246 | 244 20.0 -580.0 10.0
247 | 245 20.0 -600.0 10.0
248 | 246 20.0 -620.0 10.0
249 | 247 20.0 -640.0 10.0
250 | 248 20.0 -660.0 10.0
251 | 249 20.0 -680.0 10.0
252 | 250 20.0 -700.0 10.0
253 | 251 20.0 -720.0 10.0
254 | 252 20.0 -740.0 10.0
255 | 253 20.0 -760.0 10.0
256 | 254 20.0 -780.0 10.0
257 | 255 20.0 -800.0 10.0
258 | 256 20.0 -820.0 10.0
259 | 257 20.0 -840.0 10.0
260 | 258 40.0 0.0 10.0
261 | 259 40.0 -20.0 10.0
262 | 260 40.0 -40.0 10.0
263 | 261 40.0 -60.0 10.0
264 | 262 40.0 -80.0 10.0
265 | 263 40.0 -100.0 10.0
266 | 264 40.0 -120.0 10.0
267 | 265 40.0 -140.0 10.0
268 | 266 40.0 -160.0 10.0
269 | 267 40.0 -180.0 10.0
270 | 268 40.0 -200.0 10.0
271 | 269 40.0 -220.0 10.0
272 | 270 40.0 -240.0 10.0
273 | 271 40.0 -260.0 10.0
274 | 272 40.0 -280.0 10.0
275 | 273 40.0 -300.0 10.0
276 | 274 40.0 -320.0 10.0
277 | 275 40.0 -340.0 10.0
278 | 276 40.0 -360.0 10.0
279 | 277 40.0 -380.0 10.0
280 | 278 40.0 -400.0 10.0
281 | 279 40.0 -420.0 10.0
282 | 280 40.0 -440.0 10.0
283 | 281 40.0 -460.0 10.0
284 | 282 40.0 -480.0 10.0
285 | 283 40.0 -500.0 10.0
286 | 284 40.0 -520.0 10.0
287 | 285 40.0 -540.0 10.0
288 | 286 40.0 -560.0 10.0
289 | 287 40.0 -580.0 10.0
290 | 288 40.0 -600.0 10.0
291 | 289 40.0 -620.0 10.0
292 | 290 40.0 -640.0 10.0
293 | 291 40.0 -660.0 10.0
294 | 292 40.0 -680.0 10.0
295 | 293 40.0 -700.0 10.0
296 | 294 40.0 -720.0 10.0
297 | 295 40.0 -740.0 10.0
298 | 296 40.0 -760.0 10.0
299 | 297 40.0 -780.0 10.0
300 | 298 40.0 -800.0 10.0
301 | 299 40.0 -820.0 10.0
302 | 300 40.0 -840.0 10.0
303 | 301 60.0 0.0 10.0
304 | 302 60.0 -20.0 10.0
305 | 303 60.0 -40.0 10.0
306 | 304 60.0 -60.0 10.0
307 | 305 60.0 -80.0 10.0
308 | 306 60.0 -100.0 10.0
309 | 307 60.0 -120.0 10.0
310 | 308 60.0 -140.0 10.0
311 | 309 60.0 -160.0 10.0
312 | 310 60.0 -180.0 10.0
313 | 311 60.0 -200.0 10.0
314 | 312 60.0 -220.0 10.0
315 | 313 60.0 -240.0 10.0
316 | 314 60.0 -260.0 10.0
317 | 315 60.0 -280.0 10.0
318 | 316 60.0 -300.0 10.0
319 | 317 60.0 -320.0 10.0
320 | 318 60.0 -340.0 10.0
321 | 319 60.0 -360.0 10.0
322 | 320 60.0 -380.0 10.0
323 | 321 60.0 -400.0 10.0
324 | 322 60.0 -420.0 10.0
325 | 323 60.0 -440.0 10.0
326 | 324 60.0 -460.0 10.0
327 | 325 60.0 -480.0 10.0
328 | 326 60.0 -500.0 10.0
329 | 327 60.0 -520.0 10.0
330 | 328 60.0 -540.0 10.0
331 | 329 60.0 -560.0 10.0
332 | 330 60.0 -580.0 10.0
333 | 331 60.0 -600.0 10.0
334 | 332 60.0 -620.0 10.0
335 | 333 60.0 -640.0 10.0
336 | 334 60.0 -660.0 10.0
337 | 335 60.0 -680.0 10.0
338 | 336 60.0 -700.0 10.0
339 | 337 60.0 -720.0 10.0
340 | 338 60.0 -740.0 10.0
341 | 339 60.0 -760.0 10.0
342 | 340 60.0 -780.0 10.0
343 | 341 60.0 -800.0 10.0
344 | 342 60.0 -820.0 10.0
345 | 343 60.0 -840.0 10.0
346 | 344 80.0 0.0 10.0
347 | 345 80.0 -20.0 10.0
348 | 346 80.0 -40.0 10.0
349 | 347 80.0 -60.0 10.0
350 | 348 80.0 -80.0 10.0
351 | 349 80.0 -100.0 10.0
352 | 350 80.0 -120.0 10.0
353 | 351 80.0 -140.0 10.0
354 | 352 80.0 -160.0 10.0
355 | 353 80.0 -180.0 10.0
356 | 354 80.0 -200.0 10.0
357 | 355 80.0 -220.0 10.0
358 | 356 80.0 -240.0 10.0
359 | 357 80.0 -260.0 10.0
360 | 358 80.0 -280.0 10.0
361 | 359 80.0 -300.0 10.0
362 | 360 80.0 -320.0 10.0
363 | 361 80.0 -340.0 10.0
364 | 362 80.0 -360.0 10.0
365 | 363 80.0 -380.0 10.0
366 | 364 80.0 -400.0 10.0
367 | 365 80.0 -420.0 10.0
368 | 366 80.0 -440.0 10.0
369 | 367 80.0 -460.0 10.0
370 | 368 80.0 -480.0 10.0
371 | 369 80.0 -500.0 10.0
372 | 370 80.0 -520.0 10.0
373 | 371 80.0 -540.0 10.0
374 | 372 80.0 -560.0 10.0
375 | 373 80.0 -580.0 10.0
376 | 374 80.0 -600.0 10.0
377 | 375 80.0 -620.0 10.0
378 | 376 80.0 -640.0 10.0
379 | 377 80.0 -660.0 10.0
380 | 378 80.0 -680.0 10.0
381 | 379 80.0 -700.0 10.0
382 | 380 80.0 -720.0 10.0
383 | 381 80.0 -740.0 10.0
384 | 382 80.0 -760.0 10.0
385 | 383 80.0 -780.0 10.0
386 | 384 80.0 -800.0 10.0
387 | 385 80.0 -820.0 10.0
388 | 386 80.0 -840.0 10.0
389 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/components/recXelectrodes/mesh_electrode_half.csv:
--------------------------------------------------------------------------------
1 | channel x_pos y_pos z_pos
2 | 0 -80.0 0.0 10.0
3 | 1 -80.0 -20.0 10.0
4 | 2 -80.0 -40.0 10.0
5 | 3 -80.0 -60.0 10.0
6 | 4 -80.0 -80.0 10.0
7 | 5 -80.0 -100.0 10.0
8 | 6 -80.0 -120.0 10.0
9 | 7 -80.0 -140.0 10.0
10 | 8 -80.0 -160.0 10.0
11 | 9 -80.0 -180.0 10.0
12 | 10 -80.0 -200.0 10.0
13 | 11 -80.0 -220.0 10.0
14 | 12 -80.0 -240.0 10.0
15 | 13 -80.0 -260.0 10.0
16 | 14 -80.0 -280.0 10.0
17 | 15 -80.0 -300.0 10.0
18 | 16 -80.0 -320.0 10.0
19 | 17 -80.0 -340.0 10.0
20 | 18 -80.0 -360.0 10.0
21 | 19 -80.0 -380.0 10.0
22 | 20 -80.0 -400.0 10.0
23 | 21 -80.0 -420.0 10.0
24 | 22 -80.0 -440.0 10.0
25 | 23 -80.0 -460.0 10.0
26 | 24 -80.0 -480.0 10.0
27 | 25 -80.0 -500.0 10.0
28 | 26 -80.0 -520.0 10.0
29 | 27 -80.0 -540.0 10.0
30 | 28 -80.0 -560.0 10.0
31 | 29 -80.0 -580.0 10.0
32 | 30 -80.0 -600.0 10.0
33 | 31 -80.0 -620.0 10.0
34 | 32 -80.0 -640.0 10.0
35 | 33 -80.0 -660.0 10.0
36 | 34 -80.0 -680.0 10.0
37 | 35 -80.0 -700.0 10.0
38 | 36 -80.0 -720.0 10.0
39 | 37 -80.0 -740.0 10.0
40 | 38 -80.0 -760.0 10.0
41 | 39 -80.0 -780.0 10.0
42 | 40 -80.0 -800.0 10.0
43 | 41 -80.0 -820.0 10.0
44 | 42 -80.0 -840.0 10.0
45 | 43 -60.0 0.0 10.0
46 | 44 -60.0 -20.0 10.0
47 | 45 -60.0 -40.0 10.0
48 | 46 -60.0 -60.0 10.0
49 | 47 -60.0 -80.0 10.0
50 | 48 -60.0 -100.0 10.0
51 | 49 -60.0 -120.0 10.0
52 | 50 -60.0 -140.0 10.0
53 | 51 -60.0 -160.0 10.0
54 | 52 -60.0 -180.0 10.0
55 | 53 -60.0 -200.0 10.0
56 | 54 -60.0 -220.0 10.0
57 | 55 -60.0 -240.0 10.0
58 | 56 -60.0 -260.0 10.0
59 | 57 -60.0 -280.0 10.0
60 | 58 -60.0 -300.0 10.0
61 | 59 -60.0 -320.0 10.0
62 | 60 -60.0 -340.0 10.0
63 | 61 -60.0 -360.0 10.0
64 | 62 -60.0 -380.0 10.0
65 | 63 -60.0 -400.0 10.0
66 | 64 -60.0 -420.0 10.0
67 | 65 -60.0 -440.0 10.0
68 | 66 -60.0 -460.0 10.0
69 | 67 -60.0 -480.0 10.0
70 | 68 -60.0 -500.0 10.0
71 | 69 -60.0 -520.0 10.0
72 | 70 -60.0 -540.0 10.0
73 | 71 -60.0 -560.0 10.0
74 | 72 -60.0 -580.0 10.0
75 | 73 -60.0 -600.0 10.0
76 | 74 -60.0 -620.0 10.0
77 | 75 -60.0 -640.0 10.0
78 | 76 -60.0 -660.0 10.0
79 | 77 -60.0 -680.0 10.0
80 | 78 -60.0 -700.0 10.0
81 | 79 -60.0 -720.0 10.0
82 | 80 -60.0 -740.0 10.0
83 | 81 -60.0 -760.0 10.0
84 | 82 -60.0 -780.0 10.0
85 | 83 -60.0 -800.0 10.0
86 | 84 -60.0 -820.0 10.0
87 | 85 -60.0 -840.0 10.0
88 | 86 -40.0 0.0 10.0
89 | 87 -40.0 -20.0 10.0
90 | 88 -40.0 -40.0 10.0
91 | 89 -40.0 -60.0 10.0
92 | 90 -40.0 -80.0 10.0
93 | 91 -40.0 -100.0 10.0
94 | 92 -40.0 -120.0 10.0
95 | 93 -40.0 -140.0 10.0
96 | 94 -40.0 -160.0 10.0
97 | 95 -40.0 -180.0 10.0
98 | 96 -40.0 -200.0 10.0
99 | 97 -40.0 -220.0 10.0
100 | 98 -40.0 -240.0 10.0
101 | 99 -40.0 -260.0 10.0
102 | 100 -40.0 -280.0 10.0
103 | 101 -40.0 -300.0 10.0
104 | 102 -40.0 -320.0 10.0
105 | 103 -40.0 -340.0 10.0
106 | 104 -40.0 -360.0 10.0
107 | 105 -40.0 -380.0 10.0
108 | 106 -40.0 -400.0 10.0
109 | 107 -40.0 -420.0 10.0
110 | 108 -40.0 -440.0 10.0
111 | 109 -40.0 -460.0 10.0
112 | 110 -40.0 -480.0 10.0
113 | 111 -40.0 -500.0 10.0
114 | 112 -40.0 -520.0 10.0
115 | 113 -40.0 -540.0 10.0
116 | 114 -40.0 -560.0 10.0
117 | 115 -40.0 -580.0 10.0
118 | 116 -40.0 -600.0 10.0
119 | 117 -40.0 -620.0 10.0
120 | 118 -40.0 -640.0 10.0
121 | 119 -40.0 -660.0 10.0
122 | 120 -40.0 -680.0 10.0
123 | 121 -40.0 -700.0 10.0
124 | 122 -40.0 -720.0 10.0
125 | 123 -40.0 -740.0 10.0
126 | 124 -40.0 -760.0 10.0
127 | 125 -40.0 -780.0 10.0
128 | 126 -40.0 -800.0 10.0
129 | 127 -40.0 -820.0 10.0
130 | 128 -40.0 -840.0 10.0
131 | 129 -20.0 0.0 10.0
132 | 130 -20.0 -20.0 10.0
133 | 131 -20.0 -40.0 10.0
134 | 132 -20.0 -60.0 10.0
135 | 133 -20.0 -80.0 10.0
136 | 134 -20.0 -100.0 10.0
137 | 135 -20.0 -120.0 10.0
138 | 136 -20.0 -140.0 10.0
139 | 137 -20.0 -160.0 10.0
140 | 138 -20.0 -180.0 10.0
141 | 139 -20.0 -200.0 10.0
142 | 140 -20.0 -220.0 10.0
143 | 141 -20.0 -240.0 10.0
144 | 142 -20.0 -260.0 10.0
145 | 143 -20.0 -280.0 10.0
146 | 144 -20.0 -300.0 10.0
147 | 145 -20.0 -320.0 10.0
148 | 146 -20.0 -340.0 10.0
149 | 147 -20.0 -360.0 10.0
150 | 148 -20.0 -380.0 10.0
151 | 149 -20.0 -400.0 10.0
152 | 150 -20.0 -420.0 10.0
153 | 151 -20.0 -440.0 10.0
154 | 152 -20.0 -460.0 10.0
155 | 153 -20.0 -480.0 10.0
156 | 154 -20.0 -500.0 10.0
157 | 155 -20.0 -520.0 10.0
158 | 156 -20.0 -540.0 10.0
159 | 157 -20.0 -560.0 10.0
160 | 158 -20.0 -580.0 10.0
161 | 159 -20.0 -600.0 10.0
162 | 160 -20.0 -620.0 10.0
163 | 161 -20.0 -640.0 10.0
164 | 162 -20.0 -660.0 10.0
165 | 163 -20.0 -680.0 10.0
166 | 164 -20.0 -700.0 10.0
167 | 165 -20.0 -720.0 10.0
168 | 166 -20.0 -740.0 10.0
169 | 167 -20.0 -760.0 10.0
170 | 168 -20.0 -780.0 10.0
171 | 169 -20.0 -800.0 10.0
172 | 170 -20.0 -820.0 10.0
173 | 171 -20.0 -840.0 10.0
174 | 172 0.0 0.0 10.0
175 | 173 0.0 -20.0 10.0
176 | 174 0.0 -40.0 10.0
177 | 175 0.0 -60.0 10.0
178 | 176 0.0 -80.0 10.0
179 | 177 0.0 -100.0 10.0
180 | 178 0.0 -120.0 10.0
181 | 179 0.0 -140.0 10.0
182 | 180 0.0 -160.0 10.0
183 | 181 0.0 -180.0 10.0
184 | 182 0.0 -200.0 10.0
185 | 183 0.0 -220.0 10.0
186 | 184 0.0 -240.0 10.0
187 | 185 0.0 -260.0 10.0
188 | 186 0.0 -280.0 10.0
189 | 187 0.0 -300.0 10.0
190 | 188 0.0 -320.0 10.0
191 | 189 0.0 -340.0 10.0
192 | 190 0.0 -360.0 10.0
193 | 191 0.0 -380.0 10.0
194 | 192 0.0 -400.0 10.0
195 | 193 0.0 -420.0 10.0
196 | 194 0.0 -440.0 10.0
197 | 195 0.0 -460.0 10.0
198 | 196 0.0 -480.0 10.0
199 | 197 0.0 -500.0 10.0
200 | 198 0.0 -520.0 10.0
201 | 199 0.0 -540.0 10.0
202 | 200 0.0 -560.0 10.0
203 | 201 0.0 -580.0 10.0
204 | 202 0.0 -600.0 10.0
205 | 203 0.0 -620.0 10.0
206 | 204 0.0 -640.0 10.0
207 | 205 0.0 -660.0 10.0
208 | 206 0.0 -680.0 10.0
209 | 207 0.0 -700.0 10.0
210 | 208 0.0 -720.0 10.0
211 | 209 0.0 -740.0 10.0
212 | 210 0.0 -760.0 10.0
213 | 211 0.0 -780.0 10.0
214 | 212 0.0 -800.0 10.0
215 | 213 0.0 -820.0 10.0
216 | 214 0.0 -840.0 10.0
217 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/components/synaptic_models/AMPA_ExcToExc.json:
--------------------------------------------------------------------------------
1 | {
2 | "level_of_detail": "exp2syn",
3 | "tau1": 1.0,
4 | "tau2": 3.0,
5 | "erev": 0.0
6 | }
7 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/components/synaptic_models/AMPA_ExcToInh.json:
--------------------------------------------------------------------------------
1 | {
2 | "level_of_detail": "exp2syn",
3 | "tau1": 0.1,
4 | "tau2": 0.5,
5 | "erev": 0.0
6 | }
7 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/components/synaptic_models/GABA_InhToExc.json:
--------------------------------------------------------------------------------
1 | {
2 | "level_of_detail": "exp2syn",
3 | "tau1": 2.7,
4 | "tau2": 15.0,
5 | "erev": -70.0
6 | }
7 |
8 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/components/synaptic_models/GABA_InhToInh.json:
--------------------------------------------------------------------------------
1 | {
2 | "level_of_detail": "exp2syn",
3 | "tau1": 0.2,
4 | "tau2": 8.0,
5 | "erev": -70.0
6 | }
7 |
8 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/components/synaptic_models/instanteneousExc.json:
--------------------------------------------------------------------------------
1 | {
2 | "level_of_detail": "instanteneous",
3 | "sign": 1
4 | }
5 |
6 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/components/synaptic_models/instanteneousInh.json:
--------------------------------------------------------------------------------
1 | {
2 | "level_of_detail": "instanteneous",
3 | "sign": -1
4 | }
5 |
6 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "run": {
3 | "tstop": 3000.0,
4 | "dt": 0.1,
5 | "dL": 20,
6 | "overwrite_output_dir": true,
7 | "spike_threshold": -15,
8 | "save_state":false,
9 | "start_from_state": false,
10 | "nsteps_block":5000,
11 | "save_cell_vars": ["v", "cai"],
12 | "calc_ecp": false,
13 | "connect_internal": true,
14 | "connect_external": {"filter": true}
15 | },
16 |
17 | "external": {
18 |
19 | "filter": {
20 | "spike_trains": "$NETWORK_DIR/source_input/poisson_input_spk_train.nwb",
21 | "edges": "$NETWORK_DIR/source_input/input_edges.h5",
22 | "edge_types": "$NETWORK_DIR/source_input/input_edge_types.csv",
23 | "node_types": "$NETWORK_DIR/source_input/input_node_types.csv",
24 | "nodes": "$NETWORK_DIR/source_input/input_nodes.csv",
25 | "func_labels": [],
26 | "trial": "trial_1"
27 | }
28 |
29 | },
30 |
31 | "internal": {
32 | "nodes": "$NETWORK_DIR/recurrent_network/nodes.csv",
33 | "node_types": "$NETWORK_DIR/recurrent_network/node_types.csv",
34 | "edge_types": "$NETWORK_DIR/recurrent_network/edge_types.csv",
35 | "edges": "$NETWORK_DIR/recurrent_network/edges.h5",
36 | "func_labels": ["pop_name"],
37 | "bio_morph_dir": "$MODELS_DIR/biophysical/morphology",
38 | "bio_ephys_dir": "$MODELS_DIR/biophysical/electrophysiology",
39 | "lif_ephys_dir": "$MODELS_DIR/intfire"
40 |
41 | },
42 |
43 | "output": {
44 | "log": "$OUTPUT_DIR/log.txt",
45 | "spikes_ascii": "$OUTPUT_DIR/spikes.txt",
46 | "spikes_h5": "$OUTPUT_DIR/spikes.h5",
47 | "cell_vars_dir": "$OUTPUT_DIR/cellvars",
48 | "extra_cell_vars": "$OUTPUT_DIR/extra_cell_vars.h5",
49 | "ecp_file": "$OUTPUT_DIR/ecp.h5",
50 | "state_dir": "$OUTPUT_DIR/state",
51 | "output_dir": "$OUTPUT_DIR"
52 | },
53 |
54 | "extracellular_electrode": {
55 | "positions": "$MODELS_DIR/recXelectrodes/linear_electrode.csv"
56 | },
57 |
58 | "components": {
59 | "synapses_dir": "$MODELS_DIR/synaptic_models",
60 | "mechanisms_dir": "$MODELS_DIR/mechanisms",
61 | "bio_morphology_dir": "$MODELS_DIR/biophysical/morphology",
62 | "bio_params_dir": "$MODELS_DIR/biophysical/electrophysiology",
63 | "hoc_template_dir": "$MODELS_DIR/hoc_templates",
64 | "lif_params_dir": "$MODELS_DIR/intfire"
65 | },
66 |
67 |
68 | "recXelectrode": {
69 | "positions": "$MODELS_DIR/recXelectrodes/linear_electrode.csv"
70 | },
71 |
72 | "manifest": {
73 |
74 | "$BASE_DIR": "${configdir}",
75 | "$NETWORK_DIR": "$BASE_DIR/network",
76 | "$MODELS_DIR": "$BASE_DIR/components",
77 | "$OUTPUT_DIR": "$BASE_DIR/sim_results_001"
78 | },
79 |
80 |
81 | "conditions": {
82 | "celsius": 34.0,
83 | "v_init": -80
84 | },
85 |
86 | "groups": {
87 | "save_vars": [0, 1, 2, 3, 4, 5, 6, 7, 8]
88 | }
89 | }
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/schematics_png/External_input_connected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/biophysical_notebook/schematics_png/External_input_connected.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/schematics_png/External_input_created.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/biophysical_notebook/schematics_png/External_input_created.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/schematics_png/Full_figure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/biophysical_notebook/schematics_png/Full_figure.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/schematics_png/Neurons_created.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/biophysical_notebook/schematics_png/Neurons_created.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/schematics_png/Neurons_created_figure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/biophysical_notebook/schematics_png/Neurons_created_figure.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/schematics_png/Recurrent_connected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/biophysical_notebook/schematics_png/Recurrent_connected.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/schematics_png/Recurrent_connected_figure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/biophysical_notebook/schematics_png/Recurrent_connected_figure.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/schematics_png/full_network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/biophysical_notebook/schematics_png/full_network.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/set_cell_params.py:
--------------------------------------------------------------------------------
1 | import json
2 | from neuron import h
3 |
4 |
5 | def IntFire1(cell_prop):
6 | """Set parameters for the IntFire1 cell models."""
7 | params_file = cell_prop['params_file']
8 |
9 | with open(params_file) as params_file:
10 | params = json.load(params_file)
11 |
12 | hobj = h.IntFire1()
13 | hobj.tau = params['tau'] * 1000.0 # Convert from seconds to ms.
14 | hobj.refrac = params['refrac'] * 1000.0 # Convert from seconds to ms.
15 |
16 | return hobj
17 |
18 |
19 | def Biophys1(cell_prop):
20 | """
21 | Set parameters for cells from the Allen Cell Types database
22 | Prior to setting parameters will replace the axon with the stub
23 | """
24 | morphology_file_name = str(cell_prop['morphology_file'])
25 | params_file_name = str(cell_prop['params_file'])
26 |
27 | hobj = h.Biophys1(morphology_file_name)
28 | fix_axon(hobj)
29 | set_params_peri(hobj, params_file_name)
30 |
31 | return hobj
32 |
33 |
34 | def set_params_peri(hobj, params_file_name):
35 | """Set biophysical parameters for the cell
36 |
37 | Parameters
38 | ----------
39 | hobj: instance of a Biophysical template
40 | NEURON's cell object
41 | params_file_name: string
42 | name of json file containing biophysical parameters for cell's model which determine spiking behavior
43 | """
44 |
45 | with open(params_file_name) as biophys_params_file:
46 | biophys_params = json.load(biophys_params_file)
47 |
48 | passive = biophys_params['passive'][0]
49 | conditions = biophys_params['conditions'][0]
50 | genome = biophys_params['genome']
51 |
52 | # Set passive properties
53 | cm_dict = dict([(c['section'], c['cm']) for c in passive['cm']])
54 | for sec in hobj.all:
55 | sec.Ra = passive['ra']
56 | sec.cm = cm_dict[sec.name().split(".")[1][:4]]
57 | sec.insert('pas')
58 |
59 | for seg in sec:
60 | seg.pas.e = passive["e_pas"]
61 |
62 | # Insert channels and set parameters
63 |
64 | for p in genome:
65 | sections = [s for s in hobj.all if s.name().split(".")[1][:4] == p["section"]]
66 |
67 | for sec in sections:
68 | if p["mechanism"] != "":
69 | sec.insert(p["mechanism"])
70 | setattr(sec, p["name"], p["value"])
71 |
72 | # Set reversal potentials
73 | for erev in conditions['erev']:
74 | sections = [s for s in hobj.all if s.name().split(".")[1][:4] == erev["section"]]
75 | for sec in sections:
76 | sec.ena = erev["ena"]
77 | sec.ek = erev["ek"]
78 |
79 |
80 | def fix_axon(hobj):
81 | '''
82 | Replace reconstructed axon with a stub
83 |
84 | Parameters
85 | ----------
86 | hobj: instance of a Biophysical template
87 | NEURON's cell object
88 | '''
89 |
90 | for sec in hobj.axon:
91 | h.delete_section(sec=sec)
92 |
93 | h.execute('create axon[2]', hobj)
94 |
95 | for sec in hobj.axon:
96 | sec.L = 30
97 | sec.diam = 1
98 | hobj.axonal.append(sec=sec)
99 | hobj.all.append(sec=sec) # need to remove this comment
100 |
101 | hobj.axon[0].connect(hobj.soma[0], 0.5, 0)
102 | hobj.axon[1].connect(hobj.axon[0], 1, 0)
103 |
104 | h.define_shape()
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/set_syn_params.py:
--------------------------------------------------------------------------------
1 | from neuron import h
2 |
3 |
4 | def exp2syn(syn_params, xs, secs):
5 | '''
6 | Create a list of exp2syn synapses
7 |
8 | Parameters
9 | ----------
10 | syn_params: dict
11 | parameters of a synapse
12 | xs: float
13 | normalized distance along the section
14 |
15 | secs: hoc object
16 | target section
17 |
18 | Returns
19 | -------
20 | syns: synapse objects
21 |
22 | '''
23 | syns = []
24 |
25 | for x, sec in zip(xs, secs):
26 | syn = h.Exp2Syn(x, sec=sec)
27 | syn.e = syn_params['erev']
28 | syn.tau1 = syn_params['tau1']
29 | syn.tau2 = syn_params['tau2']
30 | syns.append(syn)
31 | return syns
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/biophysical_notebook/set_weights.py:
--------------------------------------------------------------------------------
1 | import math
2 |
3 |
4 | def gaussianLL(tar_prop,src_prop,con_prop):
5 | src_tuning = src_prop['tuning_angle']
6 | tar_tuning = tar_prop['tuning_angle']
7 |
8 | w0 = con_prop["weight_max"]
9 | sigma = con_prop["weight_sigma"]
10 |
11 | delta_tuning = abs(abs(abs(180.0 - abs(float(tar_tuning) - float(src_tuning)) % 360.0) - 90.0) - 90.0)
12 | weight = w0*math.exp(-(delta_tuning / sigma) ** 2)
13 |
14 | return weight
15 |
16 |
17 |
18 | def wmax(tar_prop,src_prop,con_prop):
19 |
20 | w0 = con_prop["weight_max"]
21 | return w0
22 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "run": {
3 | "duration": 3000.0,
4 | "dt": 0.1,
5 | "overwrite_output_dir": true,
6 | "save_state":false,
7 | "start_from_state": false,
8 | "block": false,
9 | "connect_internal": true,
10 | "connect_external": {"filter": true}
11 | },
12 |
13 | "external": {
14 |
15 | "filter": {
16 | "spike_trains": "$NETWORK_DIR/source_input/poisson_input_spk_train.nwb",
17 | "connections": "$NETWORK_DIR/source_input/input_edges.h5",
18 | "edge_types": "$NETWORK_DIR/source_input/input_edge_types.csv",
19 | "cell_models": "$NETWORK_DIR/source_input/input_node_types.csv",
20 | "cells": "$NETWORK_DIR/source_input/input_nodes.csv",
21 | "func_labels": ["location"],
22 | "trial": "trial_1"
23 | }
24 |
25 | },
26 |
27 | "internal": {
28 | "cells": "$NETWORK_DIR/recurrent_network/nodes.csv",
29 | "cell_models": "$NETWORK_DIR/recurrent_network/node_types.csv",
30 | "edge_types": "$NETWORK_DIR/recurrent_network/edge_types.csv",
31 | "connections": "$NETWORK_DIR/recurrent_network/edges.h5",
32 | "func_labels": ["pop_name"],
33 | "bio_morph_dir": "$MODELS_DIR/biophysical/morphology",
34 | "bio_ephys_dir": "$MODELS_DIR/biophysical/electrophysiology",
35 | "lif_ephys_dir": "$MODELS_DIR/intfire"
36 |
37 | },
38 |
39 | "output": {
40 | "log": "$OUTPUT_DIR/log.txt",
41 | "spikes_ascii": "$OUTPUT_DIR/spikes.txt",
42 | "spikes_h5": "$OUTPUT_DIR/spikes.h5",
43 | "cell_vars_dir": "$OUTPUT_DIR/cellvars",
44 | "extra_cell_vars": "$OUTPUT_DIR/extra_cell_vars.h5",
45 | "ecp_file": "$OUTPUT_DIR/ecp.h5",
46 | "state_dir": "$OUTPUT_DIR/state",
47 | "output_dir": "$OUTPUT_DIR"
48 | },
49 |
50 | "components": {
51 | "models_dir": "$MODELS_DIR/cell_models",
52 | "synapses_dir": "$MODELS_DIR/synaptic_models"
53 | },
54 |
55 |
56 | "recXelectrode": {
57 | "positions": "$MODELS_DIR/recXelectrodes/linear_electrode.csv"
58 | },
59 |
60 | "manifest": {
61 |
62 | "$BASE_DIR": "${configdir}",
63 | "$NETWORK_DIR": "$BASE_DIR/network",
64 | "$MODELS_DIR": "$BASE_DIR/models",
65 | "$OUTPUT_DIR": "$BASE_DIR/point_output_001"
66 | },
67 |
68 |
69 | "conditions": {
70 | "celsius": 34.0,
71 | "v_init": -80
72 | },
73 |
74 | "groups": {
75 | "save_vars": [0, 1, 2, 3, 4, 5, 6, 7]
76 | }
77 | }
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/472363762_fit.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 44.9,
4 | "C_m": 239.0,
5 | "t_ref": 3.0,
6 | "E_L": -78.0,
7 | "V_th": -43.0,
8 | "V_reset": -55.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/472363762_point.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 44.9,
4 | "C_m": 239.0,
5 | "t_ref": 3.0,
6 | "E_L": -78.0,
7 | "V_th": -43.0,
8 | "V_reset": -55.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/472912177_fit.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 22.2,
4 | "C_m": 180.0,
5 | "t_ref": 3.0,
6 | "E_L": -82.0,
7 | "V_th": -35.0,
8 | "V_reset": -50.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/472912177_point.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 22.2,
4 | "C_m": 180.0,
5 | "t_ref": 3.0,
6 | "E_L": -82.0,
7 | "V_th": -35.0,
8 | "V_reset": -50.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/473862421_point.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 12.5,
4 | "C_m": 78.0,
5 | "t_ref": 3.0,
6 | "E_L": -73.0,
7 | "V_th": -37.0,
8 | "V_reset": -55.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/473863035_point.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 22.1,
4 | "C_m": 117.0,
5 | "t_ref": 3.0,
6 | "E_L": -78.0,
7 | "V_th": -47.0,
8 | "V_reset": -50.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/473863510_point.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 11.5,
4 | "C_m": 53.0,
5 | "t_ref": 3.0,
6 | "E_L": -72.0,
7 | "V_th": -25.0,
8 | "V_reset": -50.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/IntFire1_exc_1.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 24.0,
4 | "C_m": 120.0,
5 | "t_ref": 3.0,
6 | "E_L": -75.0,
7 | "V_th": -37.0,
8 | "V_reset": -53.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/IntFire1_exc_fit.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 24.0,
4 | "C_m": 120.0,
5 | "t_ref": 3.0,
6 | "E_L": -75.0,
7 | "V_th": -37.0,
8 | "V_reset": -53.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/IntFire1_exc_point.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 24.0,
4 | "C_m": 120.0,
5 | "t_ref": 3.0,
6 | "E_L": -75.0,
7 | "V_th": -37.0,
8 | "V_reset": -53.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/IntFire1_inh_1.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 7.0,
4 | "C_m": 50.0,
5 | "t_ref": 3.0,
6 | "E_L": -77.0,
7 | "V_th": -36.0,
8 | "V_reset": -52.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/IntFire1_inh_fit.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 7.0,
4 | "C_m": 50.0,
5 | "t_ref": 3.0,
6 | "E_L": -77.0,
7 | "V_th": -36.0,
8 | "V_reset": -52.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/IntFire1_inh_point.json:
--------------------------------------------------------------------------------
1 | {
2 | "I_e": 0.0,
3 | "tau_m": 7.0,
4 | "C_m": 50.0,
5 | "t_ref": 3.0,
6 | "E_L": -77.0,
7 | "V_th": -36.0,
8 | "V_reset": -52.0
9 | }
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/cell_models/filter_point.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | }
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/synaptic_models/AMPA_ExcToExc.json:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/synaptic_models/AMPA_ExcToInh.json:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/synaptic_models/ExcToExc.json:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/synaptic_models/ExcToInh.json:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/synaptic_models/GABA_InhToExc.json:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/synaptic_models/GABA_InhToInh.json:
--------------------------------------------------------------------------------
1 | {
2 | "level_of_detail": "exp2syn",
3 | "tau1": 0.2,
4 | "tau2": 8.0,
5 | "erev": -70.0
6 | }
7 |
8 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/synaptic_models/InhToExc.json:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/synaptic_models/InhToInh.json:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/synaptic_models/instanteneousExc.json:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/models/synaptic_models/instanteneousInh.json:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/network/recurrent_network/edge_types.csv:
--------------------------------------------------------------------------------
1 | edge_type_id target_query source_query weight_max distance_range target_sections delay params_file set_params_function synapse_model weight_function
2 | 0 level_of_detail=='biophysical'&ei=='i' ei=='i' -10.0 "[0.0, 1e+20]" "['somatic', 'basal']" 2.0 GABA_InhToInh.json exp2syn static_synapse wmax
3 | 1 level_of_detail=='intfire'&ei=='i' ei=='i' -50.0 2.0 instanteneousInh.json static_synapse wmax
4 | 2 level_of_detail=='biophysical'&ei=='e' ei=='i' -50.0 "[0.0, 50.0]" "['somatic', 'basal', 'apical']" 2.0 GABA_InhToExc.json exp2syn static_synapse wmax
5 | 3 level_of_detail=='intfire'&ei=='e' ei=='i' -10.0 2.0 instanteneousInh.json static_synapse wmax
6 | 4 pop_name=='PV1' ei=='e' 100.0 "[0.0, 1e+20]" "['somatic', 'basal']" 2.0 AMPA_ExcToInh.json exp2syn static_synapse wmax
7 | 5 pop_name=='LIF_inh' ei=='e' 100.0 2.0 instanteneousExc.json static_synapse wmax
8 | 6 pop_name=='Scnn1a' ei=='e' 100.0 "[30.0, 150.0]" "['basal', 'apical']" 2.0 AMPA_ExcToExc.json exp2syn static_synapse wmax
9 | 7 pop_name=='LIF_exc' ei=='e' 100.0 2.0 instanteneousExc.json static_synapse wmax
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/network/recurrent_network/edges.h5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/pointnet_notebook/network/recurrent_network/edges.h5
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/network/recurrent_network/node_types.csv:
--------------------------------------------------------------------------------
1 | node_type_id model_type params_file level_of_detail morphology_file rotation_angle_zaxis set_params_function
2 | 10002 iaf_psc_alpha 472912177_fit.json biophysical Pvalb-IRES-Cre_Ai14_IVSCC_-176847.04.02.01_470522102_m.swc -2.539551891 Biophys1
3 | 10001 iaf_psc_alpha 472363762_fit.json biophysical Scnn1a-Tg3-Cre_Ai14_IVSCC_-177300.01.02.01_473845048_m.swc -3.646878266 Biophys1
4 | 90002 iaf_psc_alpha IntFire1_inh_1.json intfire NA NA IntFire1
5 | 90001 iaf_psc_alpha IntFire1_exc_1.json intfire NA NA IntFire1
6 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/network/recurrent_network/nodes.csv:
--------------------------------------------------------------------------------
1 | node_id node_type_id x_soma y_soma z_soma rotation_angle_yaxis pop_name ei
2 | 0 10002 0.59970086791473476 0.7669456700222288 0.63342296667967057 2.8855805437712054 PV1 i
3 | 1 10002 0.64573574296980885 0.41286627582336111 0.89823631588142072 2.1657588793230116 PV1 i
4 | 2 10001 0.1675878347205868 0.30591729535179824 0.31342078710130283 5.1876700684739037 Scnn1a e
5 | 3 10001 0.71617645939637709 0.68016880563220883 0.70761584532823629 1.6431578525680703 Scnn1a e
6 | 4 90002 0.13093610138425726 0.48812555606917907 0.93341052317501738 2.258221401812377 LIF_inh i
7 | 5 90002 0.81237871087206437 0.64678320267548151 0.91214503640257605 1.5857854835635639 LIF_inh i
8 | 6 90001 0.9188885897309842 0.87509533743231505 0.74657421524993361 1.0660517798843969 LIF_exc e
9 | 7 90001 0.087999125302931192 0.6027056373291817 0.92473051991482436 6.2787411022712538 LIF_exc e
10 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/network/source_input/input_edge_types.csv:
--------------------------------------------------------------------------------
1 | edge_type_id target_query source_query weight_max distance_range target_sections delay params_file set_params_function synapse_model weight_function
2 | 7 pop_name=='Scnn1a' * 25.0 "[0.0, 150.0]" "['basal', 'apical']" 2.0 AMPA_ExcToExc.json exp2syn static_synapse wmax
3 | 8 pop_name=='LIF_exc' * 50.0 2.0 instanteneousExc.json static_synapse wmax
4 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/network/source_input/input_edges.h5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/pointnet_notebook/network/source_input/input_edges.h5
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/network/source_input/input_node_types.csv:
--------------------------------------------------------------------------------
1 | node_type_id model_type params_file level_of_detail
2 | 1001 spike_generator filter_point.json filter
3 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/network/source_input/input_nodes.csv:
--------------------------------------------------------------------------------
1 | node_id node_type_id ei pop_name
2 | 0 1001 e input_filter
3 | 1 1001 e input_filter
4 | 2 1001 e input_filter
5 | 3 1001 e input_filter
6 | 4 1001 e input_filter
7 | 5 1001 e input_filter
8 | 6 1001 e input_filter
9 | 7 1001 e input_filter
10 | 8 1001 e input_filter
11 | 9 1001 e input_filter
12 | 10 1001 e input_filter
13 | 11 1001 e input_filter
14 | 12 1001 e input_filter
15 | 13 1001 e input_filter
16 | 14 1001 e input_filter
17 | 15 1001 e input_filter
18 | 16 1001 e input_filter
19 | 17 1001 e input_filter
20 | 18 1001 e input_filter
21 | 19 1001 e input_filter
22 | 20 1001 e input_filter
23 | 21 1001 e input_filter
24 | 22 1001 e input_filter
25 | 23 1001 e input_filter
26 | 24 1001 e input_filter
27 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/network/source_input/poisson_input_spk_train.nwb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/pointnet_notebook/network/source_input/poisson_input_spk_train.nwb
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/pointnet_notebook/set_weights.py:
--------------------------------------------------------------------------------
1 | import math
2 |
3 |
4 | def gaussianLL(tar_prop,src_prop,con_prop):
5 | src_tuning = src_prop['tuning_angle']
6 | tar_tuning = tar_prop['tuning_angle']
7 |
8 | w0 = con_prop["weight_max"]
9 | sigma = con_prop["weight_sigma"]
10 |
11 | delta_tuning = abs(abs(abs(180.0 - abs(float(tar_tuning) - float(src_tuning)) % 360.0) - 90.0) - 90.0)
12 | weight = w0*math.exp(-(delta_tuning / sigma) ** 2)
13 |
14 | return weight
15 |
16 |
17 |
18 | def wmax(tar_prop, src_prop, con_prop, nsyn):
19 | return con_prop["weight_max"]*nsyn
20 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/components/pop_models/excitatory_pop.json:
--------------------------------------------------------------------------------
1 | {
2 | "tau_m": 0.0429,
3 | "record": true,
4 | "v_min": -0.05,
5 | "v_max": 0.02,
6 | "dv": 0.0001,
7 | "update_method": "gmres",
8 | "approx_order": null
9 | }
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/components/pop_models/filter_pop.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | }
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/components/pop_models/inhibitory_pop.json:
--------------------------------------------------------------------------------
1 | {
2 | "tau_m": 0.0299,
3 | "record": true,
4 | "v_min": -0.05,
5 | "v_max": 0.02,
6 | "dv": 0.0001,
7 | "update_method": "gmres",
8 | "approx_order": null
9 | }
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/config.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | "run": {
4 | "duration": 3.0,
5 | "dt": 0.0002,
6 | "overwrite_output_dir": true,
7 | "connect_internal": true,
8 | "connect_external": {"filter": true},
9 | "block": false,
10 | "blocksize": 1000.0
11 | },
12 |
13 | "external": {
14 | "filter": {
15 | "spike_trains": "$NETWORK_DIR/source_input/poisson_input_spk_train.nwb",
16 | "edge_types": "$NETWORK_DIR/source_input/input_edge_types.csv",
17 | "node_types": "$NETWORK_DIR/source_input/input_node_types.csv",
18 | "trial": "trial_1"
19 | }
20 | },
21 |
22 | "internal": {
23 | "node_types": "$NETWORK_DIR/recurrent_network/node_types.csv",
24 | "edge_types": "$NETWORK_DIR/recurrent_network/edge_types.csv",
25 | "edges": "$NETWORK_DIR/recurrent_network/edges.h5"
26 | },
27 |
28 | "output": {
29 | "show_plots": false,
30 | "rates_file": "$OUTPUT_DIR/spike_rates.txt",
31 | "log_file": "$OUTPUT_DIR/logging.txt"
32 | },
33 |
34 | "components": {
35 | "models_dir": "$MODELS_DIR/pop_models",
36 | "synapses_dir": "$MODELS_DIR/synaptic_models"
37 | },
38 |
39 | "manifest": {
40 | "$BASE_DIR": "${configdir}",
41 | "$NETWORK_DIR": "$BASE_DIR/network",
42 | "$MODELS_DIR": "$BASE_DIR/components",
43 | "$OUTPUT_DIR": "$BASE_DIR/output"
44 | }
45 | }
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/network/recurrent_network/edge_types.csv:
--------------------------------------------------------------------------------
1 | edge_type_id target_query source_query weight delay nsyns params_file
2 | 1 pop_name=='inhibitory' pop_name=='excitatory' 0.005 0.002 20 ExcToInh.json
3 | 2 pop_name=='excitatory' pop_name=='inhibitory' -0.001 0.002 10 InhToExc.json
4 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/network/recurrent_network/node_types.csv:
--------------------------------------------------------------------------------
1 | node_type_id pop_name params_file
2 | 0 excitatory excitatory_pop.json
3 | 1 inhibitory inhibitory_pop.json
4 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/network/recurrent_network/nodes.csv:
--------------------------------------------------------------------------------
1 | pop_name
2 | inhibitory
3 | excitatory
4 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/network/recurrent_network_v2/edge_types.csv:
--------------------------------------------------------------------------------
1 | edge_type_id target_query source_query weight delay nsyns params_file
2 | 0 pop_name=='excitatory' pop_name=='input_filter' 0.0015 0.002 11 InpToExc.json
3 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/network/recurrent_network_v2/node_types.csv:
--------------------------------------------------------------------------------
1 | node_type_id pop_name params_file
2 | 0 excitatory components_v2/pop_models/excitatory_pop.json
3 | filter_001 input_filter NA
4 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/network/source_input/edge_types.csv:
--------------------------------------------------------------------------------
1 | edge_type_id target_query source_query weight delay nsyns params_file
2 | 0 pop_name=='excitatory' pop_name=='ext_excitatory' 0.0025 0.002 10 InpToExc.json
3 | 2 pop_name=='inhibitory' pop_name=='ext_excitatory' 0.005 0.002 20 ExcToInh.json
4 | 3 pop_name=='inhibitory' pop_name=='ext_excitatory' 0.005 0.002 20 ExcToInh.json
5 | 4 pop_name=='inhibitory' pop_name=='ext_excitatory' 0.005 0.002 20 ExcToInh.json
6 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/network/source_input/input_edge_types.csv:
--------------------------------------------------------------------------------
1 | edge_type_id target_query source_query weight delay nsyns params_file
2 | 0 pop_name=='excitatory' pop_name=='input_filter' 0.0025 0.002 10 InpToExc.json
3 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/network/source_input/input_node_types.csv:
--------------------------------------------------------------------------------
1 | node_type_id level_of_detail ei pop_name
2 | filter_001 filter e input_filter
3 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/network/source_input/input_nodes.csv:
--------------------------------------------------------------------------------
1 | node_id node_type_id ei
2 | 0 filter_001 e
3 |
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/network/source_input/poisson_input_spk_train.nwb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/popnet_notebook/network/source_input/poisson_input_spk_train.nwb
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/schematics_png/DiPDE_ei_net.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/popnet_notebook/schematics_png/DiPDE_ei_net.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/schematics_png/ei_ext_pop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/popnet_notebook/schematics_png/ei_ext_pop.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/schematics_png/ei_ext_pop_conn1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/popnet_notebook/schematics_png/ei_ext_pop_conn1.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/schematics_png/ei_ext_pop_conn1and2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/popnet_notebook/schematics_png/ei_ext_pop_conn1and2.png
--------------------------------------------------------------------------------
/DynamicBrain/Modeling/popnet_notebook/schematics_png/ei_pop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/DynamicBrain/Modeling/popnet_notebook/schematics_png/ei_pop.png
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Allen Institute Software License – This software license is the 2-clause BSD license
2 | plus clause a third clause that prohibits redistribution for commercial purposes without further permission.
3 |
4 | Copyright © 2017. Allen Institute. All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
7 | following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
10 | following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
13 | following disclaimer in the documentation and/or other materials provided with the distribution.
14 |
15 | 3. Redistributions for commercial purposes are not permitted without the Allen Institute’s written permission.
16 | For purposes of this license, commercial purposes is the incorporation of the Allen Institute's software into
17 | anything for which you will charge fees or other compensation. Contact terms@alleninstitute.org for commercial
18 | licensing opportunities.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
26 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
--------------------------------------------------------------------------------
/PythonBootcamp/00_Introduction.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "
\n",
8 | "\n",
9 | "Python Bootcamp
\n",
10 | "August 19-20, 2016
"
11 | ]
12 | },
13 | {
14 | "cell_type": "markdown",
15 | "metadata": {},
16 | "source": [
17 | "\n",
18 | "
Introduction: What is Python?
\n",
19 | "\n",
20 | "
How does Python compare to other programming languages? What are its strengths and weaknesses? Why have we chosen Python for this course?\n",
21 | "\n",
22 | "
"
23 | ]
24 | },
25 | {
26 | "cell_type": "markdown",
27 | "metadata": {},
28 | "source": [
29 | "\n",
30 | "
1. Python is a *general purpose* programming language.
\n",
31 | "\n",
32 | "
Most programming languages used by scientists were designed from the beginning to handle numerical and scientific tasks:\n",
33 | "\n",
34 | " R, MATLAB, Igor, Mathematica, IDL\n",
35 | "\n",
36 | "
Advantages of specialized languages:\n",
37 | "\n",
38 | "
\n",
39 | "- Usually the first to support high-level functinoality needed in science\n",
40 | "
- Language and programming environment are tailored to meet the needs of scientific developers\n",
41 | "
- Lower learning curve\n",
42 | "
\n",
43 | "\n",
44 | "
**General-purpose languages such as Python are intended to be useful for any type of programming, regardless of the topic or functionality needed:**\n",
45 | "\n",
46 | " C, C++, Java, Python\n",
47 | "\n",
48 | "
Python is used in virtually every corner of the software development landscape--web sites, server infrastructure, user interfaces, device control, machine learning, etc. \n",
49 | "\n",
50 | "
Advantages of general-purpose languages:\n",
51 | "\n",
52 | "
\n",
53 | "- More flexibility\n",
54 | "
- Languages require a lot of effort to learn; general-purpose languages offer greater return on that investment\n",
55 | "
- Much larger community of developers, greater longevity\n",
56 | "
- Better language design\n",
57 | "
\n",
58 | "\n",
59 | "
"
60 | ]
61 | },
62 | {
63 | "cell_type": "markdown",
64 | "metadata": {},
65 | "source": [
66 | "\n",
67 | "
2. Python is an *interpreted* programming language.
\n",
68 | "\n",
69 | "
Programming languages can be compiled, interpreted, or a hybrid of the two. \n",
70 | "\n",
71 | "
**Compiled languages** like C, C++, Java, and Julia take the program you write and convert it into optimized, machine-executable code. Often, compiled languages are both *faster to execute* and *more difficult to use*. \n",
72 | "\n",
73 | "
**Interpreted languages** like Python, MATLAB, Igor, and PHP use a pre-compiled interpreter to read your program code and execute it, one step at a time. Often, interpreted languages are *slower to execute* and *easier to use*.\n",
74 | "\n",
75 | "
**Question:** Is Python a slow language?
\n",
76 | "**Answer:** It depends on how you use it.\n",
77 | "\n",
78 | "
Ideally, we would like to have a language that is both fast to execute and easy to use, and Python (like many other languages) uses many different techniques to reduce the overhead incurred by being an interpreted language. We will learn about many of these throughout the day.\n",
79 | "\n",
80 | "
"
81 | ]
82 | },
83 | {
84 | "cell_type": "markdown",
85 | "metadata": {},
86 | "source": [
87 | "\n",
88 | "
3. Python is a community of developers
\n",
89 | "\n",
90 | "
Commercial development environments like MATLAB or Igor benefit from a monolithic community structure:\n",
91 | "\n",
92 | "
\n",
93 | "- One official source for core software packages\n",
94 | "
- One default IDE used by everybody\n",
95 | "
- One cohesive community of developers and staff for support\n",
96 | "
- Usually excellent, comprehensive documentation\n",
97 | "
\n",
98 | "\n",
99 | "
Newcomers to Python are often overwhelmed by the vast and confusing landscape of communities, distributions, 3rd-party modules, and development tools. Never fear! The scientific Python community has organized around a central \"stack\" of tools that are well supported and maintained, and have become the de-facto standards in the field. We will guide you through these core tools before releasing you into the wild.\n",
100 | "\n",
101 | "
Scientific Python Stack ([scipy.org](scipy.org)):\n",
102 | "\n",
103 | " NumPy: N-dimensional array package\n",
104 | " SciPy: Fundamental library for scientific computing\n",
105 | " Matplotlib: Comprehensive 2D Plotting\n",
106 | " IPython/Jupyter: Enhanced Interactive Console\n",
107 | " Sympy: Symbolic mathematics\n",
108 | " pandas: Data structures & analysis\n",
109 | "\n",
110 | "
"
111 | ]
112 | },
113 | {
114 | "cell_type": "markdown",
115 | "metadata": {},
116 | "source": [
117 | "\n",
118 | "
4. A carefully designed, open-source programming language
\n",
119 | "\n",
120 | "
The older, commercial specialty languages come with baggage:\n",
121 | "\n",
122 | "
\n",
123 | "- Evolved from simpler systems, retained idiosyncracies\n",
124 | "
- Lack modern object-oriented language features, or these are tacked on to the original language\n",
125 | "
- Expensive, unreliable, cumbersome licensing schemes\n",
126 | "
- Closed source\n",
127 | "
\n",
128 | "\n",
129 | "
Python is widely regarded as one of the easiest, most intuitive, and most readable programming languages. Its language design combined with its open-source license are major factors in its widespread success.\n",
130 | "\n",
131 | "
"
132 | ]
133 | },
134 | {
135 | "cell_type": "markdown",
136 | "metadata": {},
137 | "source": [
138 | "\n",
139 | "
Where to get help
\n",
140 | "\n",
141 | "
Python documentation (https://www.python.org/doc/)\n",
142 | "
\n",
143 | "- [Tutorial](https://docs.python.org/2/tutorial/index.html)\n",
144 | "
- [Library Reference](https://docs.python.org/2/library/index.html)\n",
145 | "
\n",
146 | "\n",
147 | "
MATLAB-to-Python cheat sheets: \n",
148 | "
\n",
149 | "- http://mathesaurus.sourceforge.net/matlab-numpy.html \n",
150 | "
- http://mathesaurus.sourceforge.net/matlab-python-xref.pdf\n",
151 | "
\n",
152 | "\n",
153 | "\n",
154 | "[Scientific python stack documentation: numpy, scipy, matplotlib](http://scipy.org/docs.html)\n",
155 | "\n",
156 | "[Stack Overflow](http://stackoverflow.com)\n",
157 | " \n",
158 | "
"
159 | ]
160 | }
161 | ],
162 | "metadata": {
163 | "kernelspec": {
164 | "display_name": "Python 2",
165 | "language": "python",
166 | "name": "python2"
167 | },
168 | "language_info": {
169 | "codemirror_mode": {
170 | "name": "ipython",
171 | "version": 2
172 | },
173 | "file_extension": ".py",
174 | "mimetype": "text/x-python",
175 | "name": "python",
176 | "nbconvert_exporter": "python",
177 | "pygments_lexer": "ipython2",
178 | "version": "2.7.13"
179 | }
180 | },
181 | "nbformat": 4,
182 | "nbformat_minor": 0
183 | }
184 |
--------------------------------------------------------------------------------
/PythonBootcamp/08_Development_Tools.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "
\n",
8 | "\n",
9 | "Python Bootcamp
\n",
10 | "August 19-20, 2017
"
11 | ]
12 | },
13 | {
14 | "cell_type": "markdown",
15 | "metadata": {},
16 | "source": [
17 | "\n",
18 | "
Python Development Tools
\n",
19 | "\n",
20 | "\n",
21 | "
Commercial tools like MATLAB and Igor come with a single standardized development environment. In contrast, Python is supported by a large and bewildering ecosystem of development tools. This offers us a great deal of flexibility In this section we will present a few of our favorite tools and discuss their relative strengths and weaknesses.\n",
22 | "
"
23 | ]
24 | },
25 | {
26 | "cell_type": "markdown",
27 | "metadata": {},
28 | "source": [
29 | "\n",
30 | "
What tools do you need? That depends on what you are trying to do. Some environments are designed to streamline certain types of development. The general features we are looking for are:\n",
31 | "\n",
32 | "
\n",
33 | "- Text editor\n",
34 | "
- Debugging tools\n",
35 | "
- Variable explorers\n",
36 | "
- Data visualization\n",
37 | "
- Project management\n",
38 | "
\n",
39 | "\n",
40 | "
"
41 | ]
42 | },
43 | {
44 | "cell_type": "markdown",
45 | "metadata": {},
46 | "source": [
47 | "\n",
48 | "
A note about interactivity
\n",
49 | "\n",
50 | "
**Most general-purpose programming environments are non-interactive:**\n",
51 | "
\n",
52 | "- Write code\n",
53 | "
- Start program, execute code\n",
54 | "
- Stop program\n",
55 | "
- Repeat\n",
56 | "
\n",
57 | "\n",
58 | "
Important reasons for this:\n",
59 | "
\n",
60 | "- Simplicity - interactivity requires complex infrastructure\n",
61 | "
- Repeatability - program must run the same way every time\n",
62 | "
\n",
63 | "\n",
64 | "
**Most scientific programming environments (Igor, Matlab, Mathematica, ...) prefer an interactive experience.**
\n",
65 | "Why? Data analysis is incremental.\n",
66 | "\n",
67 | "
\n",
68 | "- You want to see your data, test some code, check the results, tweak the code, check again, etc.\n",
69 | "
- It would be a pain (and possibly very slow) to have to stop and restart the entire program for every change.\n",
70 | "
\n",
71 | "\n",
72 | "
Interactivity means:\n",
73 | "\n",
74 | "
\n",
75 | "- The program that runs your code does not exit when it finishes running your code.\n",
76 | "
- All of your data remains in memory for you to inspect\n",
77 | "
- Code can be modified and executed in the running process.\n",
78 | "
- Maybe nice GUI tools that let you visualize, save, load data without writing any code.\n",
79 | "
\n",
80 | "\n",
81 | "
**Python supports both types of environment.** The tools we will introduce fall into one category or the other, but all of them incorporate features from both categories.\n",
82 | "
"
83 | ]
84 | },
85 | {
86 | "cell_type": "markdown",
87 | "metadata": {},
88 | "source": [
89 | "\n",
90 | "
Editor + console
\n",
91 | "\n",
92 | "This is the simplest approach to code development. Use a nice text editor (sublime is a good one) that at least handles indentation. Save your code to a file, and run it from a command line like:\n",
93 | "\n",
94 | " > python myfile.py\n",
95 | " \n",
96 | "This approach falls into the \"non-interactive\" category, but there are many tools available to make it more interactive. For example, simply running python with the `-i` flag will cause it to begin an interactive session immediately after your script completes:\n",
97 | "\n",
98 | " > python -i myfile.py\n",
99 | " \n",
100 | "This allows you to inspect the variables generated by your program and experiment with new ideas.\n",
101 | "\n",
102 | "\n",
103 | "
**Pros:**\n",
104 | "
\n",
105 | "- Simple, bare-metal approach. Nice if you want to use python without other user interfaces getting in your way. For example:\n",
106 | "
\n",
107 | "- IDEs introduce useful features at the cost of added complexity. (How much time will you spend configuring your IDE instead of coding?) \n",
108 | "
- Some IDEs have debuggers that slow down your code.\n",
109 | "
- Some IDEs change the way your code runs \"under the hood\".\n",
110 | "
\n",
111 | " - You decide exactly which tools you want to use.\n",
112 | "
\n",
113 | "\n",
114 | "
**Cons:**\n",
115 | "
\n",
116 | "- May be more difficult if you're not familiar with DOS/Bash/other CLI\n",
117 | "
- Non-integrated; you need to manually incorporate many other tools (eg for visualization, version control, debugging, etc.)\n",
118 | "
\n",
119 | "
"
120 | ]
121 | },
122 | {
123 | "cell_type": "markdown",
124 | "metadata": {},
125 | "source": [
126 | "\n",
127 | "
Jupyter (IPython) Notebook
\n",
128 | "\n",
129 | "
Jupyter Notebook provides an *interactive* programming environment similar to the Mathematica notebook.\n",
130 | "
\n",
131 | "- Code is divided into chunks called \"cells\".\n",
132 | "
- Cells can be executed in any order, independently of each other.\n",
133 | "
- Results from cell execution are displayed below each cell.\n",
134 | "
\n",
135 | "\n",
136 | "A Python interpreter runs *continuously* in the background. Every time you execute a cell, the state of the interpreter is updated.\n",
137 | "\n",
138 | "\n",
139 | "
**Pros:**\n",
140 | "
\n",
141 | "- Notebooks are excellent for storing and presenting the results of data analysis, simulations, etc. because code, results, and discussion are all combined in a single document.\n",
142 | "
- Any user should be able to execute your notebook and reproduce your results.\n",
143 | " (this is true of all code, but not necessarily as easy)\n",
144 | "
- Good for prototyping--easy to break up the script into multiple intermediate steps and iteratively develop a small chunk at a time.\n",
145 | "
\n",
146 | "\n",
147 | "
**Cons:**\n",
148 | "
\n",
149 | "- Notebooks are not good for developing large applications or user interfaces.\n",
150 | "
- Difficult to use if your project incorporates multiple Python files.\n",
151 | "
- Possible to generate unreproducible results because cells can be executed out of order.\n",
152 | "
- Awkward web browser interface, text editing is clumsy with limited configurability.\n",
153 | "
- Difficult to integrate with debugging and version integration tools.\n",
154 | "
\n",
155 | "
"
156 | ]
157 | },
158 | {
159 | "cell_type": "markdown",
160 | "metadata": {},
161 | "source": [
162 | "\n",
163 | "
PyCharm (IDE)
\n",
164 | "\n",
165 | "
PyCharm is a popular integrated development environment. It includes a fully-featured text editor, excellent debugging tools, interactive data browsing, project management, and version control integration. It is easy to install but *not* included with Anaconda.\n",
166 | "\n",
167 | "
**Pros:**\n",
168 | "
\n",
169 | "- Excellent, fully-featured text editor.\n",
170 | "
\n",
171 | " - Syntax hilighting, indentation, autocomplete\n",
172 | "
- Context-sensitive help (ctrl-q)\n",
173 | "
- Can view Jupyter Notebook files.\n",
174 | "
\n",
175 | " - Excellent debugging tools\n",
176 | "
\n",
177 | " - Breakpoints / steppping\n",
178 | "
- Stack inspection\n",
179 | "
- Interactive object inspection (plotting with matplotlib!)\n",
180 | "
- Array visualization\n",
181 | "
\n",
182 | " - Project management, code versioning\n",
183 | "
\n",
184 | " - Tracks files and execution environment\n",
185 | "
- If you are working on a project with multiple files, this can be very helpful\n",
186 | "
\n",
187 | "
\n",
188 | "\n",
189 | "
**Cons:**\n",
190 | "
\n",
191 | "- **Lots** of features to wade through, overhead in learning new tools.\n",
192 | "
- Project management can get in the way if you just want to work with a single file.\n",
193 | "
- Interactivity is somewhat limited.\n",
194 | "
\n",
195 | "
"
196 | ]
197 | },
198 | {
199 | "cell_type": "markdown",
200 | "metadata": {},
201 | "source": [
202 | "\n",
203 | "
Spyder
\n",
204 | "\n",
205 | "Spyder is an integrated development environment with many similarities to MATLAB's default environment. It is included with Anaconda and provides a more interactive approach to development. \n",
206 | "\n",
207 | "Matlab + Notebook - like features:\n",
208 | "* Divide script into cells, execute in persistent process\n",
209 | "* Inline matplotlib results\n",
210 | "\n",
211 | "
**Pros:**\n",
212 | "
\n",
213 | "- Decent text editor, debugger, and project management.\n",
214 | "
- More interactive than pycharm--console, variable explorer, visualization tools.\n",
215 | "
- List of set scripts, good for running already-written analysis tools. \n",
216 | "
- Notebook-like features--divide a script into cells and execute in a background Python process.\n",
217 | "
\n",
218 | "\n",
219 | "
**Cons:**\n",
220 | "
\n",
221 | "- Somewhat less mature and polished than pycharm.\n",
222 | "
- Debugger can be difficult to use, no stack inspection.\n",
223 | "
\n",
224 | "
"
225 | ]
226 | }
227 | ],
228 | "metadata": {
229 | "kernelspec": {
230 | "display_name": "Python 2",
231 | "language": "python",
232 | "name": "python2"
233 | },
234 | "language_info": {
235 | "codemirror_mode": {
236 | "name": "ipython",
237 | "version": 2
238 | },
239 | "file_extension": ".py",
240 | "mimetype": "text/x-python",
241 | "name": "python",
242 | "nbconvert_exporter": "python",
243 | "pygments_lexer": "ipython2",
244 | "version": "2.7.13"
245 | }
246 | },
247 | "nbformat": 4,
248 | "nbformat_minor": 0
249 | }
250 |
--------------------------------------------------------------------------------
/PythonBootcamp/11_Image_data.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "
\n",
8 | "\n",
9 | "Python Bootcamp
\n",
10 | "August 19-20, 2017, Seattle, WA
"
11 | ]
12 | },
13 | {
14 | "cell_type": "markdown",
15 | "metadata": {},
16 | "source": [
17 | "\n",
18 | "
Exercise: Numpy, Scipy, Matplotlib
\n",
19 | "\n",
20 | "
The following series of exercises are designed to give you more practice manipulating and plotting data using Numpy, Scipy, and Matplotlib\n",
21 | "
"
22 | ]
23 | },
24 | {
25 | "cell_type": "code",
26 | "execution_count": null,
27 | "metadata": {
28 | "collapsed": true
29 | },
30 | "outputs": [],
31 | "source": [
32 | "import numpy as np\n",
33 | "import matplotlib.pyplot as plt\n",
34 | "import scipy.misc\n",
35 | "import scipy.ndimage\n",
36 | "from __future__ import print_function\n",
37 | "\n",
38 | "%matplotlib notebook"
39 | ]
40 | },
41 | {
42 | "cell_type": "markdown",
43 | "metadata": {},
44 | "source": [
45 | "\n",
46 | "\n",
47 | "
Scipy has a built in image called 'face' that we can use to do some image processing
\n",
48 | "
The exercises below will walk you through various basic operations on this image\n",
49 | "
First, make a variabled called \"face\" that contains the image\n",
50 | "\n",
51 | "
"
52 | ]
53 | },
54 | {
55 | "cell_type": "code",
56 | "execution_count": null,
57 | "metadata": {
58 | "collapsed": false
59 | },
60 | "outputs": [],
61 | "source": [
62 | "face = scipy.misc.face()"
63 | ]
64 | },
65 | {
66 | "cell_type": "markdown",
67 | "metadata": {},
68 | "source": [
69 | "\n",
70 | "\n",
71 | "
What is the image?
\n",
72 | "
Show the image using matplotlib\n",
73 | "
"
74 | ]
75 | },
76 | {
77 | "cell_type": "code",
78 | "execution_count": null,
79 | "metadata": {
80 | "collapsed": false
81 | },
82 | "outputs": [],
83 | "source": [
84 | "# Use imshow"
85 | ]
86 | },
87 | {
88 | "cell_type": "markdown",
89 | "metadata": {},
90 | "source": [
91 | "-left: 3px solid #000; padding: 1px; padding-left: 10px; background: #F0FAFF; \">\n",
92 | "
What is the shape of the image?
\n",
93 | "
\n",
94 | "
"
95 | ]
96 | },
97 | {
98 | "cell_type": "code",
99 | "execution_count": null,
100 | "metadata": {
101 | "collapsed": false
102 | },
103 | "outputs": [],
104 | "source": []
105 | },
106 | {
107 | "cell_type": "markdown",
108 | "metadata": {},
109 | "source": [
110 | "\n",
111 | "\n",
112 | "
Make note of the fact that the first two dimensions are ROWS x COLUMNS. When indexing into this array, you'll need to use this convention, as opposed to thinking of X and Y position (which would actually be column and row, respectively).\n",
113 | "
"
114 | ]
115 | },
116 | {
117 | "cell_type": "markdown",
118 | "metadata": {},
119 | "source": [
120 | "\n",
121 | "
What is the intensity range for the pixel values?
\n",
122 | "
hint: use the 'flatten' method to make a 1-D array, then make a histogram\n",
123 | "
"
124 | ]
125 | },
126 | {
127 | "cell_type": "code",
128 | "execution_count": null,
129 | "metadata": {
130 | "collapsed": false,
131 | "scrolled": false
132 | },
133 | "outputs": [],
134 | "source": [
135 | "face_flat = face.flatten()\n",
136 | "#now make a histogram"
137 | ]
138 | },
139 | {
140 | "cell_type": "markdown",
141 | "metadata": {},
142 | "source": [
143 | "\n",
144 | "
The third image dimension refers to the number of color channels (R,G,B).
\n",
145 | "
Try making an array of equal size to the image, but that contains only the color at a given pixel (for example, find a pixel on a leaf, then display an array that contains only that color)\n",
146 | "
Below is an example of how the plot might look:\n",
147 | "
\n",
148 | "
\n"
149 | ]
150 | },
151 | {
152 | "cell_type": "code",
153 | "execution_count": null,
154 | "metadata": {
155 | "collapsed": false
156 | },
157 | "outputs": [],
158 | "source": []
159 | },
160 | {
161 | "cell_type": "markdown",
162 | "metadata": {},
163 | "source": [
164 | "\n",
165 | "
Convert the image to grayscale instead
\n",
166 | "
To start with, look at any (or all) of the color channels individually. Are they all the same?\n",
167 | "
Below is an example of what a plot of each individual color channel might look like. \n",
168 | "
Note that Matplotlib does not make it easy to put individual colorbars on subplots - scour the documentation or just check out the key to figure this out.\n",
169 | "
\n",
170 | "
\n"
171 | ]
172 | },
173 | {
174 | "cell_type": "code",
175 | "execution_count": null,
176 | "metadata": {
177 | "collapsed": false
178 | },
179 | "outputs": [],
180 | "source": []
181 | },
182 | {
183 | "cell_type": "markdown",
184 | "metadata": {
185 | "collapsed": true
186 | },
187 | "source": [
188 | "\n",
189 | "\n",
190 | "
To properly convert the color channels to gray (luminance), you need to account for our visual system's sensitivity to each individual color: https://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale. Try writing a function to do this, then applying it to the image.\n",
191 | "
"
192 | ]
193 | },
194 | {
195 | "cell_type": "code",
196 | "execution_count": null,
197 | "metadata": {
198 | "collapsed": true
199 | },
200 | "outputs": [],
201 | "source": [
202 | "#try making a function that converts each pixel from RBG to gray"
203 | ]
204 | },
205 | {
206 | "cell_type": "code",
207 | "execution_count": null,
208 | "metadata": {
209 | "collapsed": false
210 | },
211 | "outputs": [],
212 | "source": [
213 | "#apply the function, make a grayscale plot. Be sure to set the colormap appropriately."
214 | ]
215 | },
216 | {
217 | "cell_type": "markdown",
218 | "metadata": {},
219 | "source": [
220 | "\n",
221 | "
Try using scipy's gaussian filter method to smooth (blur) the grayscaled face image
\n",
222 | "
Hint: Look up documentation for scipy.ndimage.filters.gaussian_filter\n",
223 | "
Here's what a blurred image might look like:\n",
224 | "
\n",
225 | "
\n"
226 | ]
227 | },
228 | {
229 | "cell_type": "code",
230 | "execution_count": null,
231 | "metadata": {
232 | "collapsed": true
233 | },
234 | "outputs": [],
235 | "source": []
236 | },
237 | {
238 | "cell_type": "markdown",
239 | "metadata": {},
240 | "source": [
241 | "\n",
242 | "
In the grayscale image, find the pixel with the highest intensity
\n",
243 | "
plot an X over it in the image\n",
244 | "
Here's what it should look like:\n",
245 | "\n",
246 | "
\n",
247 | "
"
248 | ]
249 | },
250 | {
251 | "cell_type": "code",
252 | "execution_count": null,
253 | "metadata": {
254 | "collapsed": false
255 | },
256 | "outputs": [],
257 | "source": []
258 | },
259 | {
260 | "cell_type": "markdown",
261 | "metadata": {},
262 | "source": [
263 | "\n",
264 | "
In the grayscale image, choose a threshold, then make all values above that threshold white and all values below that threshold black
\n",
265 | "
**Bonus exercise: Use a sliderbar widget to make the threshold dynamically adjustable:**\n",
266 | "
see: http://ipywidgets.readthedocs.io/en/latest/examples/Using%20Interact.html\n",
267 | "
Here's what it should look like:\n",
268 | "
\n",
269 | "
\n"
270 | ]
271 | },
272 | {
273 | "cell_type": "code",
274 | "execution_count": null,
275 | "metadata": {
276 | "collapsed": false
277 | },
278 | "outputs": [],
279 | "source": [
280 | "# basic answer\n",
281 | "gray_face_thresholded = gray_face.copy() #make a copy of the data so you don't affect the original image\n",
282 | "\n",
283 | "threshold = 150\n",
284 | "gray_face_thresholded[gray_face_thresholded<=threshold] = 0\n",
285 | "gray_face_thresholded[gray_face_thresholded>threshold] = 1\n",
286 | "\n",
287 | "fig,ax=plt.subplots()\n",
288 | "\n",
289 | "ax.imshow(gray_face_thresholded,cmap='gray')"
290 | ]
291 | },
292 | {
293 | "cell_type": "code",
294 | "execution_count": null,
295 | "metadata": {
296 | "collapsed": false
297 | },
298 | "outputs": [],
299 | "source": [
300 | "# Answer with slider bar\n",
301 | "# have to run 'pip install ipywidgets' from the command line first\n",
302 | "from ipywidgets import interact\n",
303 | "@interact\n",
304 | "def show_thresholded(threshold=(0,255,1)):\n",
305 | " gray_face_thresholded = gray_face.copy() #make a copy of the data so you don't affect the original image\n",
306 | "\n",
307 | " gray_face_thresholded[gray_face_thresholded<=threshold] = 0\n",
308 | " gray_face_thresholded[gray_face_thresholded>threshold] = 1\n",
309 | "\n",
310 | " fig,ax=plt.subplots()\n",
311 | "\n",
312 | " ax.imshow(gray_face_thresholded,cmap='gray')"
313 | ]
314 | },
315 | {
316 | "cell_type": "markdown",
317 | "metadata": {},
318 | "source": [
319 | "\n",
320 | "\n",
321 | "
Try making plots of intensity values for an x,y cross section through the image
\n",
322 | "
For example, a plot might look like this:\n",
323 | "
\n",
324 | "
"
325 | ]
326 | },
327 | {
328 | "cell_type": "code",
329 | "execution_count": null,
330 | "metadata": {
331 | "collapsed": false
332 | },
333 | "outputs": [],
334 | "source": [
335 | "#hint: Use gridspec to define the size and locations of the three plots"
336 | ]
337 | }
338 | ],
339 | "metadata": {
340 | "kernelspec": {
341 | "display_name": "Python 2",
342 | "language": "python",
343 | "name": "python2"
344 | },
345 | "language_info": {
346 | "codemirror_mode": {
347 | "name": "ipython",
348 | "version": 2
349 | },
350 | "file_extension": ".py",
351 | "mimetype": "text/x-python",
352 | "name": "python",
353 | "nbconvert_exporter": "python",
354 | "pygments_lexer": "ipython2",
355 | "version": "2.7.13"
356 | }
357 | },
358 | "nbformat": 4,
359 | "nbformat_minor": 0
360 | }
361 |
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/CrossingDailyBarPlot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/PythonBootcamp/support_files/CrossingDailyBarPlot.png
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/CrossingMonthlyBarPlot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/PythonBootcamp/support_files/CrossingMonthlyBarPlot.png
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/SampleWorkbook.csv:
--------------------------------------------------------------------------------
1 | Column 1,Column 2
2 | one,1
3 | two,2
4 | three,3
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/blurred.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/PythonBootcamp/support_files/blurred.png
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/cropped-SummerWorkshop_Header.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/PythonBootcamp/support_files/cropped-SummerWorkshop_Header.png
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/cross_sections.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/PythonBootcamp/support_files/cross_sections.png
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/grayscales.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/PythonBootcamp/support_files/grayscales.png
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/leafplot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/PythonBootcamp/support_files/leafplot.png
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/maxpixel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/PythonBootcamp/support_files/maxpixel.png
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/neuron.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/PythonBootcamp/support_files/neuron.jpg
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/stinkbug.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/PythonBootcamp/support_files/stinkbug.png
--------------------------------------------------------------------------------
/PythonBootcamp/support_files/thresholdedimage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/PythonBootcamp/support_files/thresholdedimage.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SWDB_2017
2 | 
3 |
4 | This is the repository for the course materials for the 2017 Summer Workshop on the Dynamic Brain.
5 |
6 | # Support Policy
7 |
8 | We are releasing this code as part of the 2017 Summer Workshop on the Dynamic Brain and will only be supporting and developing it for the context of this workshop. The community is welcome to submit issues, but you should not expect an active response outside of the context of the course.
9 |
10 | Copyright 2017 Allen Institute
--------------------------------------------------------------------------------
/resources/Neocortical Interneurons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/resources/Neocortical Interneurons.png
--------------------------------------------------------------------------------
/resources/cropped-SummerWorkshop_Header.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AllenInstitute/SWDB_2017/5bdf9151d803c8bef544fd85ac7a58fc6350268c/resources/cropped-SummerWorkshop_Header.png
--------------------------------------------------------------------------------