1 | |
---|

2 | (* A simple network of excitatory and inhibitory neurons *) |
---|

3 | |
---|

4 | component ExcInhNetwork = |
---|

5 | struct |
---|

6 | |
---|

7 | binding construct_diagram V t gL vL Isyn C theta tspike spike Vreset trefractory refractory_end tstep = |
---|

8 | |
---|

9 | binding subthreshold_eq = [ D (V t) = (((- gL) * (V - vL)) + Isyn) / C ] |
---|

10 | val threshold_detect = [ spike = (V >= theta) ] |
---|

11 | val tspike_assignment = [ tspike = if spike then t else tspike ] |
---|

12 | val subthreshold_regime = Diagram.SEQUENCE subthreshold_eq (Diagram.SEQUENCE threshold_detect tspike_assignment) |
---|

13 | val refractory_eq = [ V = Vreset ] |
---|

14 | val refractory_regime = [ |
---|

15 | [ V = Vreset ] |
---|

16 | [ refractory_end = (t >= (tspike + trefractory)) ] |
---|

17 | [ t = t + tstep ] |
---|

18 | ] |
---|

19 | return Diagram.RTRANSITION subthreshold_regime refractory_regime spike refractory_end |
---|

20 | |
---|

21 | |
---|

22 | binding construct_network N_exc N_inh D_exc D_inh P = |
---|

23 | |
---|

24 | (* a graph to represent the excitatory population *) |
---|

25 | |
---|

26 | binding I_exc = Interval.closed_interval 0d1 N_exc |
---|

27 | binding excitatory_population = Graph.set_node_interval_property (Graph.nodes (N_exc)) |
---|

28 | I_exc `synapticPrototype D_exc |
---|

29 | |
---|

30 | (* a graph to represent the inhibitory population *) |
---|

31 | |
---|

32 | binding I_inh = Interval.closed_interval 0d1 N_inh |
---|

33 | binding inhibitory_population = Graph.set_node_interval_property (Graph.nodes (N_inh)) |
---|

34 | I_inh `synapticPrototype D_inh |
---|

35 | |
---|

36 | (* disjoint union of the two populations *) |
---|

37 | binding populations = Graph.disjoint_union excitatory_population inhibitory_population |
---|

38 | |
---|

39 | (* random graph G(N,P) *) |
---|

40 | binding P = 0.02 |
---|

41 | binding connections = Graph.gnp_graph (N_exc + N_inh) P |
---|

42 | |
---|

43 | (* graph union: node attributes take precedence from left to right *) |
---|

44 | binding populations_and_connections = Graph.union populations connections |
---|

45 | |
---|

46 | (* this procedure determines the synapse prototype for a connection: *) |
---|

47 | binding synapse_prototype G S D = Graph.node_property G S `synapticPrototype |
---|

48 | |
---|

49 | (* final network *) |
---|

50 | binding I_network = Interval.closed_interval 0d1 (N_exc + N_inh) |
---|

51 | binding network = Graph.set_edge_interval_property populations_and_connections |
---|

52 | I_network I_network `synapticPrototype synapse_prototype |
---|

53 | |
---|

54 | |
---|

55 | return network |
---|

56 | |
---|

57 | end |
---|

58 | |
---|

59 | |
---|