| 1 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" |
|---|
| 2 |
xmlns="http://neuralensemble.org/FacetsML" |
|---|
| 3 |
xmlns:class="http://neuralensemble.org/FacetsML/cellclass" |
|---|
| 4 |
xmlns:rand="http://neuralensemble.org/FacetsML/randomNumberGenerator" |
|---|
| 5 |
xmlns:net="http://morphml.org/networkml/schema" |
|---|
| 6 |
xmlns:mml="http://morphml.org/morphml/schema" |
|---|
| 7 |
xmlns:cml="http://morphml.org/channelml/schema" |
|---|
| 8 |
xmlns:meta="http://morphml.org/metadata/schema" |
|---|
| 9 |
xmlns:bio="http://morphml.org/biophysics/schema" |
|---|
| 10 |
xmlns:nml="http://morphml.org/neuroml/schema"> |
|---|
| 11 |
<xsl:output method="xml" indent="yes" xml:space="default"/> |
|---|
| 12 |
<xsl:template match="/"> |
|---|
| 13 |
<xsl:apply-templates select="nml:neuroml"/> |
|---|
| 14 |
</xsl:template> |
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
<xsl:template match="nml:neuroml"> |
|---|
| 18 |
<network xmlns="http://neuralensemble.org/FacetsML" |
|---|
| 19 |
xmlns:class="http://neuralensemble.org/FacetsML/cellclass" |
|---|
| 20 |
xmlns:rand="http://neuralensemble.org/FacetsML/randomNumberGenerator" |
|---|
| 21 |
timestep="0.1" min_delay="0.1" max_delay="0.1" sim_duration="1000"> |
|---|
| 22 |
<extra name="threads" value="2"/> |
|---|
| 23 |
<rng name="rng" seed="98765" generator="NumpyRNG"/> |
|---|
| 24 |
|
|---|
| 25 |
<xsl:apply-templates select="nml:cells"/> |
|---|
| 26 |
|
|---|
| 27 |
<xsl:apply-templates select="net:populations"/> |
|---|
| 28 |
|
|---|
| 29 |
<xsl:apply-templates select="net:projections"/> |
|---|
| 30 |
|
|---|
| 31 |
</network> |
|---|
| 32 |
</xsl:template> |
|---|
| 33 |
|
|---|
| 34 |
<xsl:template match="nml:cells"> |
|---|
| 35 |
<cells> |
|---|
| 36 |
<xsl:apply-templates select="nml:cell"/> |
|---|
| 37 |
</cells> |
|---|
| 38 |
</xsl:template> |
|---|
| 39 |
|
|---|
| 40 |
<xsl:template match="nml:cell"> |
|---|
| 41 |
<cell name="{@name}"> |
|---|
| 42 |
<xsl:call-template name="writeCellClass"> |
|---|
| 43 |
<xsl:with-param name="cell" select="current()"/> |
|---|
| 44 |
</xsl:call-template> |
|---|
| 45 |
</cell> |
|---|
| 46 |
</xsl:template> |
|---|
| 47 |
|
|---|
| 48 |
<xsl:template name="writeCellClass"> |
|---|
| 49 |
<!-- here we look for 4 biomechanisms : |
|---|
| 50 |
ExcitatorySynapse |
|---|
| 51 |
InhibitorySynapse |
|---|
| 52 |
IandF |
|---|
| 53 |
pas --> |
|---|
| 54 |
<xsl:param name="cell"/> |
|---|
| 55 |
<xsl:variable name="ExcitatorySynapse" select="//cml:synapse_type[@name = $cell/nml:biophysics/net:potentialSynapticLocation/net:synapse_type/text()][contains(@name,'xcitatory')]"/> |
|---|
| 56 |
<xsl:variable name="InhibitorySynapse" select="//cml:synapse_type[@name = $cell/nml:biophysics/net:potentialSynapticLocation/net:synapse_type/text()][contains(@name,'nhibitory')]"/> |
|---|
| 57 |
<xsl:variable name="IandF" select="//cml:channel_type[@name = $cell/nml:biophysics/bio:mechanism/@name][cml:current_voltage_relation/cml:integrate_and_fire]"/> |
|---|
| 58 |
<xsl:variable name="pas" select="//cml:channel_type[@name = $cell/nml:biophysics/bio:mechanism/@name][cml:current_voltage_relation/cml:ohmic]"/> |
|---|
| 59 |
<xsl:choose> |
|---|
| 60 |
<!-- for now I just check that each variable is not empty --> |
|---|
| 61 |
<xsl:when test="count($ExcitatorySynapse) = '1' and count($InhibitorySynapse) = '1' and count($IandF) = '1' and count($pas) = '1'"> |
|---|
| 62 |
<xsl:call-template name="writeIF_cond_exp"> |
|---|
| 63 |
<xsl:with-param name="cell" select="$cell"/> |
|---|
| 64 |
<xsl:with-param name="ExcitatorySynapse" select="$ExcitatorySynapse"/> |
|---|
| 65 |
<xsl:with-param name="InhibitorySynapse" select="$InhibitorySynapse"/> |
|---|
| 66 |
<xsl:with-param name="IandF" select="$IandF"/> |
|---|
| 67 |
<xsl:with-param name="pas" select="$pas"/> |
|---|
| 68 |
</xsl:call-template> |
|---|
| 69 |
</xsl:when> |
|---|
| 70 |
</xsl:choose> |
|---|
| 71 |
</xsl:template> |
|---|
| 72 |
|
|---|
| 73 |
<xsl:template name="writeIF_cond_exp"> |
|---|
| 74 |
<xsl:param name="cell"/> |
|---|
| 75 |
<xsl:param name="ExcitatorySynapse"/> |
|---|
| 76 |
<xsl:param name="InhibitorySynapse"/> |
|---|
| 77 |
<xsl:param name="IandF"/> |
|---|
| 78 |
<xsl:param name="pas"/> |
|---|
| 79 |
<xsl:variable name="v_init" select="$cell/nml:biophysics/bio:initialMembPotential/bio:parameter/@value"/> |
|---|
| 80 |
<xsl:variable name="tau_m" select="$IandF/cml:current_voltage_relation/cml:integrate_and_fire/@g_refrac"/> |
|---|
| 81 |
<xsl:variable name="tau_syn_E" select="$ExcitatorySynapse/cml:doub_exp_syn/@decay_time"/> |
|---|
| 82 |
<xsl:variable name="tau_syn_I" select="$InhibitorySynapse/cml:doub_exp_syn/@decay_time"/> |
|---|
| 83 |
|
|---|
| 84 |
<xsl:variable name="v_reset" select="$IandF/cml:current_voltage_relation/cml:integrate_and_fire/@v_reset"/> |
|---|
| 85 |
<xsl:variable name="v_thresh" select="$IandF/cml:current_voltage_relation/cml:integrate_and_fire/@threshold"/> |
|---|
| 86 |
|
|---|
| 87 |
<xsl:variable name="cm" select="$cell/nml:biophysics/bio:mechanism/bio:parameter/@value[../@name = 'gmax']"/> |
|---|
| 88 |
<xsl:variable name="tau_refrac" select="$IandF/cml:current_voltage_relation/cml:integrate_and_fire/@t_refrac"/> |
|---|
| 89 |
|
|---|
| 90 |
<xsl:variable name="e_rev_E" select="$ExcitatorySynapse/cml:doub_exp_syn/@reversal_potential"/> |
|---|
| 91 |
<xsl:variable name="e_rev_I" select="$InhibitorySynapse/cml:doub_exp_syn/@reversal_potential"/> |
|---|
| 92 |
|
|---|
| 93 |
<class:IF_cond_exp i_offset="0.1" v_init="{$v_init}" tau_m="{$tau_m}" tau_syn_E="{$tau_syn_E}" tau_syn_I="{$tau_syn_I}" |
|---|
| 94 |
v_rest="-60." v_reset="{$v_reset}" v_thresh="{$v_thresh}" |
|---|
| 95 |
cm="{$cm}" tau_refrac="{$tau_refrac}" e_rev_E="{$e_rev_E}" |
|---|
| 96 |
e_rev_I="{$e_rev_I}"/> |
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
</xsl:template> |
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
<xsl:template match="net:populations"> |
|---|
| 103 |
<populations> |
|---|
| 104 |
<xsl:apply-templates select="net:population"/> |
|---|
| 105 |
</populations> |
|---|
| 106 |
</xsl:template> |
|---|
| 107 |
|
|---|
| 108 |
<xsl:template match="net:population"> |
|---|
| 109 |
<population name="{@name}"> |
|---|
| 110 |
<dim size="{net:pop_location/net:random_arrangement/net:population_size/text()}"/> |
|---|
| 111 |
<cell_type name="{net:cell_type/text()}"/> |
|---|
| 112 |
<randomInit rng="rng"> |
|---|
| 113 |
<rand:uniform min="-60." max="-50."/> |
|---|
| 114 |
</randomInit> |
|---|
| 115 |
</population> |
|---|
| 116 |
</xsl:template> |
|---|
| 117 |
|
|---|
| 118 |
<xsl:template match="net:projections"> |
|---|
| 119 |
<projections> |
|---|
| 120 |
<xsl:apply-templates select="net:projection"/> |
|---|
| 121 |
</projections> |
|---|
| 122 |
</xsl:template> |
|---|
| 123 |
|
|---|
| 124 |
<xsl:template match="net:projection"> |
|---|
| 125 |
<projection name="{@name}" |
|---|
| 126 |
presynaptic_population_name="{net:source/text()}" |
|---|
| 127 |
postsynaptic_population_name="{net:target/text()}" |
|---|
| 128 |
method="{local-name(net:connectivity_pattern/*)}" |
|---|
| 129 |
weight="{net:synapse_props/net:default_values/@weight}" |
|---|
| 130 |
target="excitatory" |
|---|
| 131 |
rng="rng"> |
|---|
| 132 |
<xsl:apply-templates select="net:connectivity_pattern/*/@*" mode="methodParameter"/> |
|---|
| 133 |
</projection> |
|---|
| 134 |
</xsl:template> |
|---|
| 135 |
|
|---|
| 136 |
<xsl:template match="@*" mode="methodParameter"> |
|---|
| 137 |
<methodParameter name="{local-name()}" value="{current()}"/> |
|---|
| 138 |
</xsl:template> |
|---|
| 139 |
|
|---|
| 140 |
</xsl:stylesheet> |
|---|