Changeset 29574 in project


Ignore:
Timestamp:
08/15/13 07:57:51 (7 years ago)
Author:
Ivan Raikov
Message:

9ML-toolkit: introducing templates for Brunel network example

Location:
release/4/9ML-toolkit/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/4/9ML-toolkit/trunk/examples/Brunel00/Brunel00_network.xml

    r29039 r29574  
    191191
    192192  <group name="Network">
    193 
    194     <population name="Exc">
     193   
     194    <Property><!-- Global delay for all neurons in the group -->
     195       <label>delay</label>
     196       <value>1.5</value>
     197       <unit>ms</unit>
     198    </Property>
     199   
     200    <Property> <!-- Other named properties that are part of the network configuration -->
     201       <label>g</label>
     202       <value>6.0</value> <!-- case B : fast oscillation, irregular activity -->
     203    </Property>
     204
     205    <population name="Exc"> <!-- Excitatory population definition --> 
    195206      <prototype><reference>E</reference></prototype>
    196207      <number>10000</number>
    197208    </population>
    198209
    199     <population name="Inh">
     210    <population name="Inh"> <!-- Inhibitory population definition --> 
    200211      <prototype><reference>I</reference></prototype>
    201212      <number>2500</number>
    202213    </population>
    203214
    204     <population name="Ext">
     215    <population name="Ext"> <!-- External sources definition --> 
    205216      <prototype><reference>E_ext</reference></prototype>
    206217      <number>10000</number>
    207218    </population>
    208219
    209     <set name="All neurons">
     220    <set name="All neurons"> <!-- The set of all neurons --> 
    210221      <union>
    211         <left>Exc</left>
    212         <right>Inh</right>
     222        <left>Exc</left> <right>Inh</right>
    213223      </union>
    214224    </set>
    215225
    216     <projection name="External" >
     226    <!-- Projection from external sources to all neurons --> 
     227    <projection name="External" >
    217228      <source><reference>E_ext</reference></source>
    218229      <target><reference>All neurons</reference></target>
     230      <rule><reference>all-to-all</reference>
     231            <Property name="weight"><value>1.0</value></Property></rule>
    219232    </projection>
    220233
    221     <projection name="Excitation" >
     234    <!-- Projection from excitatory neurons to all neurons --> 
     235    <projection name="Excitation" >
    222236      <source><reference>Exc</reference></source>
    223237      <target><reference>All neurons</reference></target>
     238      <response><reference>DeltaPSR</reference></response>
     239      <rule><reference>random divergent</reference>
     240            <Property name="probability"><value>0.1</value></Property>
     241            <Property name="weight"><value>1.0</value></Property></rule>
    224242    </projection>
    225243
    226     <projection name="Inhibition" >
     244    <!-- Projection from inhibitory neurons to all neurons --> 
     245    <projection name="Inhibition" >
    227246      <source><reference>Inh</reference></source>
    228247      <target><reference>All Neurons</reference></target>
     248      <response><reference>DeltaPSR</reference></response>
     249      <rule><reference>random divergent</reference>
     250            <Property name="probability"><value>0.1</value></Property>
     251            <Property name="weight"><value><MathInline>-g * 1.0</MathInline></value></Property></rule>
    229252    </projection>
    230253
  • release/4/9ML-toolkit/trunk/templates/Network.sml.tmpl

    r29564 r29574  
    22structure {{network.name}} =
    33struct
    4 
    5   val zeropid = Posix.Process.wordToPid (SysWord.fromInt 0)
    6 
    74
    85  fun putStrLn out str =
     
    8582    val Ext_n0 = {{network.stimulusPopulation.start}}
    8683
    87     val Jext   = {{network.stimulusPopulation.weight}}
    88 
    8984    val Ext_f  = PoissonNeuron.Poissonfn       
    9085 
     
    193188
    194189           
    195     fun randomUniformProjection () =
     190    fun fprojection () =
    196191       
    197192        (let
    198193                     
    199             {% for pop in network.populations %}
    200              val S_{{pop.name}} = RTensor.*> {{pop.weight}}
    201                                          (RTensor.map (fn (x) => (if Real.> ({{pop.epsilon}},x) then 1.0 else 0.0))
     194             {% for pr in network.projections %}
     195             {% if pr.type == "random divergent" %}
     196             val S_{{pr.name}} = RTensor.*> {{pr.weight}}
     197                                         (RTensor.map (fn (x) => (if Real.> ({{pr.epsilon}},x) then 1.0 else 0.0))
    202198                                                      (realRandomTensor
    203199                                                           (fn (len) => RandomMTZig.randUniformArray (len,seed_i))
    204                                                            [N,N_{{pop.name}}]))
    205                        
     200                                                           [N_{{pr.target.name}},N_{{pr.src.name}}]))
     201                       
     202             {% else %}
     203             val S_{{pr.name}} = RTensor.*>  {{pr.weight}} (RTensor.new ([N,Np],1.0))
    206204             {% endfor %}
    207205                       
    208              val Sp  = RTensor.*>  Jext (RTensor.new ([N,Np],1.0))
    209206                       
    210207             val S   = foldl1 (fn (x,ax) => RTensor.cat (ax,x,1))
    211208                              [
    212                                {% for pop in network.populations %}
    213                                S_{{pop.name}}
     209                               {% for pr in network.projections %}
     210                               S_{{pr.name}}
    214211                               {% endfor %}
    215                                Sp
    216212                              ]
    217213                       
  • release/4/9ML-toolkit/trunk/ulp.scm

    r29289 r29574  
    33;;
    44;;
    5 ;; Copyright 2010-2012 Ivan Raikov and the Okinawa Institute of
     5;; Copyright 2010-2013 Ivan Raikov and the Okinawa Institute of
    66;; Science and Technology.
    77;;
     
    1919;; <http://www.gnu.org/licenses/>.
    2020;;
     21
     22
     23#|
     24
     25TODO: use term rewriting rules for eval-ul-component, e.g.:
     26
     27     ( (M component (definition $url) $properties) =>
     28       (M component (eval-env (M eval-definition $url)) $properties) )
     29
     30     ( (M component (eval-env $eval-env) $properties) =>
     31       (M component (model-module (eval-env-last-entry $eval-env)) $properties) )
     32
     33     ( (M component (eval-env $eval-env) $properties) =>
     34       (M component (model-module (eval-env-last-entry $eval-env)) $properties) )
     35
     36     ( (M component (model-module $model-module) $properties) =>
     37       (eval-term (M apply-terms (Longid (Pdot (entry-name $model-module) "construct")) $properties)) )
     38
     39     ( (M eval-definition $url ) =>
     40       (eval-source (fetch (uri-reference $url)) current-scope current-type-env current-eval-env ) )
     41
     42     ( (M apply-terms $operator (seq $term $rest)) =>
     43       (M apply-terms (Apply $operator $term) $rest) )
     44       
     45     ( (M apply-terms $operator (seq-empty)) => $operator )
     46|#
    2147
    2248
     
    559585
    560586
     587(define (eval-ul-group x)
     588
     589  (let (
     590        (group-name  (sxml:attr x 'name))
     591        (properties  ((sxpath `(// nml:properties nml:Property nml:value))  x))
     592        (populations ((sxpath `(// nml:population))  x))
     593        (projections ((sxpath `(// nml:projection)) x))
     594        )
     595
     596    (d "UL group: ~A properties: ~A populations: ~A projections: ~A~%"
     597       properties populations projections)
     598
     599    (if (null? populations)
     600        (error 'eval-ul-group "group without populations" x))
     601
     602   
     603
     604
     605
    561606(define (apply-terms operator terms)
    562607  (if (null? terms) operator
     
    564609       (Apply operator (car terms))
    565610       (cdr terms))))
    566 
    567 #|
    568 
    569 TODO: use term rewriting rules for eval-ul-component, e.g.:
    570 
    571      ( (M component (definition $url) $properties) =>
    572        (M component (eval-env (M eval-definition $url)) $properties) )
    573 
    574      ( (M component (eval-env $eval-env) $properties) =>
    575        (M component (model-module (eval-env-last-entry $eval-env)) $properties) )
    576 
    577      ( (M component (eval-env $eval-env) $properties) =>
    578        (M component (model-module (eval-env-last-entry $eval-env)) $properties) )
    579 
    580      ( (M component (model-module $model-module) $properties) =>
    581        (eval-term (M apply-terms (Longid (Pdot (entry-name $model-module) "construct")) $properties)) )
    582 
    583      ( (M eval-definition $url ) =>
    584        (eval-source (fetch (uri-reference $url)) current-scope current-type-env current-eval-env ) )
    585 
    586      ( (M apply-terms $operator (seq $term $rest)) =>
    587        (M apply-terms (Apply $operator $term) $rest) )
    588        
    589      ( (M apply-terms $operator (seq-empty)) => $operator )
    590 |#
    591611
    592612 
Note: See TracChangeset for help on using the changeset viewer.